{"id":29085207,"url":"https://github.com/tahaaa22/cli-calculator","last_synced_at":"2026-04-24T20:31:20.195Z","repository":{"id":298771805,"uuid":"997640850","full_name":"tahaaa22/CLI-calculator","owner":"tahaaa22","description":"A command-line calculator project with a C backend, Python interface via C-Python API, and multiple supporting tools like Ninja, Sphinx documentation, pre-commit hooks, and GitHub Actions CI/CD.","archived":false,"fork":false,"pushed_at":"2025-06-22T11:43:54.000Z","size":99,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-27T22:45:17.331Z","etag":null,"topics":["c","c-python-extensions","cli","python"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tahaaa22.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-06T22:03:39.000Z","updated_at":"2025-06-13T00:07:55.000Z","dependencies_parsed_at":"2025-06-12T21:46:00.378Z","dependency_job_id":"84304613-53c5-49ee-a4d8-0698509481ee","html_url":"https://github.com/tahaaa22/CLI-calculator","commit_stats":null,"previous_names":["tahaaa22/cli-calculator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tahaaa22/CLI-calculator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahaaa22%2FCLI-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahaaa22%2FCLI-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahaaa22%2FCLI-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahaaa22%2FCLI-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tahaaa22","download_url":"https://codeload.github.com/tahaaa22/CLI-calculator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tahaaa22%2FCLI-calculator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32239443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","c-python-extensions","cli","python"],"created_at":"2025-06-27T22:39:24.228Z","updated_at":"2026-04-24T20:31:20.189Z","avatar_url":"https://github.com/tahaaa22.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  CLI Calculator\r\n\r\nA command-line calculator project with a C backend, Python interface via C-Python API, and multiple supporting tools like Ninja, Sphinx documentation, pre-commit hooks, and GitHub Actions CI/CD.\r\n\r\n---\r\n\r\n## 📦 Project Structure\r\n```\r\nCLI-calculator/\r\n├── c_backend/\r\n│ ├── calc.c # C backend logic\r\n│ ├── calc.h # C function declarations\r\n│\r\n├── python_interface/\r\n│ ├── calculator.c # Python C extension wrapper\r\n│ ├── init.py # Python package initializer\r\n│ ├── cli.py # CLI tool (argparse)\r\n│\r\n├──  tests/\r\n│ └── test_calc.c # C unit tests\r\n│ └── test_calculator.py # Python unit tests\r\n│\r\n├── docs/\r\n│ ├── source/ # reStructuredText source files\r\n│ └── conf.py # Sphinx config\r\n│ └── Makefile/ # Generated documentation\r\n│\r\n├── .github/\r\n│ └── workflows/\r\n│ └── ci.yml # GitHub Actions CI/CD workflow\r\n│\r\n├── .pre-commit-config.yaml # Pre-commit hooks config\r\n├── build.ninja # Ninja build system file\r\n├── setup.py # Python packaging setup\r\n├── pyproject.toml # PEP 518 build system file\r\n├── requirements.txt # Python dependencies\r\n├── Doxyfile # Doxygen setup file\r\n└── README.md # This file\r\n```\r\n\r\n---\r\n\r\n### Notes\r\n   1) Python 3.12 assumed — adjust paths in build.ninja if needed.\r\n\r\n   2) \u003cPython.h\u003e is added in the c package.\r\n      if not search for folder path Python.h (usually in appdata/local/programs/python/pythonver/include)\r\n      then add the folder extension to your C interpreter. \r\n\r\n---\r\n\r\n## 📖 Features\r\n\r\n✅ Modular C backend logic  \r\n✅ Python C extension module  \r\n✅ Command-line interface with `argparse`  \r\n✅ C and Python unit tests  \r\n✅ Ninja build system (Windows-optimized)  \r\n✅ Sphinx developer documentation  \r\n✅ Pre-commit hooks for code formatting and linting  \r\n✅ GitHub Actions CI/CD workflow  \r\n\r\n---\r\n\r\n## 🚀 Quick Installation Options\r\n\r\n### Important Note\r\n\u003e It is recommended to create a local environment inside the folder to avoid issues coming from having multiple interpreters installed, even on Anaconda.\r\n```\r\npython -m venv .venv\r\ncd .venv/Scripts\r\nactivate.bat\r\ncd ..\r\ncd ..\r\n```\r\nThis step is important for any of the following methods.\r\n\r\n### 📌 Method 1 — Install with Make (if you have Chocolatey)\r\n\r\n\u003e Recommended if you have Chocolatey installed. Install Make via Chocolatey in an elevated windows powershell (Administrator):\r\n\r\n```\r\nchoco install make\r\n```\r\nThen:\r\n\r\n1️⃣ Clone the repository:\r\n```\r\ngit clone https://github.com/tahaaa22/CLI-calculator\r\ncd CLI-calculator\r\n```\r\n2️⃣ Install project dependencies:\r\n```\r\npip install -r requirements.txt\r\n```\r\n3️⃣ Install pre-commit hooks:\r\n```\r\npython -m pre_commit install\r\npython -m pre_commit run --all-files\r\n```\r\n4️⃣ Install and build:\r\n```\r\nmake install\r\nmake build\r\n```\r\n5️⃣ Run tests:\r\n```\r\nmake test_python\r\n```\r\n6️⃣ Clean build artifacts:\r\n```\r\nmake clean\r\n```\r\n### 📌 Method 2 — Install with pip (editable install)\r\n1️⃣ Clone the repository:\r\n```\r\ngit clone https://github.com/tahaaa22/CLI-calculator\r\ncd CLI-calculator\r\n```\r\n2️⃣ Install dependencies:\r\n```\r\npip install -r requirements.txt\r\npython -m pre_commit install\r\n```\r\n3️⃣ Install in development (editable) mode:\r\n```\r\npip install -e .\r\n```\r\n4️⃣ Test it in Python shell:\r\n```\r\n\u003e\u003e\u003e import calculator as cal\r\n\u003e\u003e\u003e cal.mul(1, 2)\r\n2.0\r\n\u003e\u003e\u003e cal.add(5.5, 3.2)\r\n8.7\r\n\u003e\u003e\u003e cal.divide(10, 2)\r\n5.0\r\n\u003e\u003e\u003e cal.sub(15, 7)\r\n8.0\r\n\u003e\u003e\u003e exit()\r\n```\r\n\r\n### 🔧 Ninja-based Build Workflow (Recommended for Windows)\r\n1️⃣ Install dependencies:\r\n```\r\npip install -r requirements.txt\r\npip install sphinx pre-commit ninja\r\n```\r\n✅ Install Ninja executable:\r\n\r\n   1) Download: https://github.com/ninja-build/ninja/releases\r\n\r\n   2) Extract ninja.exe to a folder\r\n\r\n   3) Add the folder to your system PATH\r\n\r\n2️⃣ Build the extension:\r\n```\r\nninja extbuild\r\n```\r\n3️⃣ Run C unit tests:\r\n```\r\nninja testc_compile\r\nninja testc_run\r\nninja testc\r\n```\r\n4️⃣ Run Python unit tests:\r\n```\r\nninja testpy\r\n```\r\n5️⃣ Run the CLI:\r\n```\r\npython python_interface/cli.py add 5 3\r\n```\r\n\r\n---\r\n\r\n### Generate Sphinx docs and run:\r\n\r\n   Install Doxygen :\r\n      https://www.doxygen.nl/download.html\r\n\r\n(make sure you are in the root)\r\n\r\n```\r\ndoxygen Doxyfile\r\nsphinx-build -b html docs/source docs/build\r\ncd docs/build\r\nstart index.html\r\n```\r\n\r\nor via Ninja:\r\n```\r\ncd ..\r\ncd .. #return to the root\r\nninja docs\r\n```\r\n7️⃣ Clean build artifacts:\r\n```\r\nninja cleanall\r\n```\r\n---\r\n\r\n### Pre-commit setup:\r\n```\r\npython -m pre_commit install\r\npython -m pre_commit run --all-files\r\n```\r\n\r\n---\r\n\r\n### 📜 License\r\nMIT License © 2025 Ahmed Taha\r\n\r\n---\r\n\r\n### 📧 Contact\r\n- [Ahmed Taha](https://github.com/tahaaa22)\r\n- [Ghada tarek](https://github.com/ghada-elboghdady)\r\n- [Amr doma](https://github.com/AmrDoma)\r\n- [Youssef awad](https://github.com/Youssef-Awad2004)\r\n- [Sama Mohamed](https://github.com/SamaMohamed10)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftahaaa22%2Fcli-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftahaaa22%2Fcli-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftahaaa22%2Fcli-calculator/lists"}