A modular Python calculator with reusable core logic, CLI, REST API, and import — demonstrating a multi-entry architecture.
Project description
Multientry-Calc-Example
An example project of modular Python architecture, featuring a reusable core and multiple entry points: CLI, REST API, and import. This is a demonstration project for learning and testing purposes.
Installation
Install the core library:
pip install .
Install with CLI support:
pip install .[cli]
Install with REST API support:
pip install .[api]
Usage via CLI
After installing with [cli], run:
multicalc add 2 3
multicalc subtract 5 2
multicalc multiply 4 6
multicalc divide 8 2
Usage via REST API
After installing with [api], start the server:
multicalc-serve
Access Swagger docs at: http://localhost:8000/docs
Example endpoints:
GET /add?x=2&y=3GET /subtract?x=5&y=2GET /multiply?x=4&y=6GET /divide?x=8&y=2
Usage as a Library (Import)
Import and use the core calculator in Python:
from multicalc import Calculator
calc = Calculator()
print(calc.add(2, 3))
print(calc.subtract(5, 2))
print(calc.multiply(4, 6))
print(calc.divide(8, 2))
See also the example script in examples/usage.py for more details.
This project is for demonstration and educational purposes only.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file multicalc-1.0.0.tar.gz.
File metadata
- Download URL: multicalc-1.0.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef845b4c827c3941d286dc94794ba849ffb48b126063a748aec745fce22242fe
|
|
| MD5 |
be7d722f09eef50bda4440a6f97ff53f
|
|
| BLAKE2b-256 |
222639b0b873e96021507d8fdd4f1af49b530d0dc45950a7bbdf58b3c693e994
|
File details
Details for the file multicalc-1.0.0-py3-none-any.whl.
File metadata
- Download URL: multicalc-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6d1f4ef0e7da7efb5c69aad0df6429361587b353e17a8c3e0c615a4f3a15a78
|
|
| MD5 |
6688de2045300702eb7ee3539ec6a866
|
|
| BLAKE2b-256 |
44123960cc44c9d7ee1a9cd3e0e9e294296874884f416dd194616fbfef810c28
|