๐ข A chill CLI calculator that just works
Project description
๐ข NexusCalc
A powerful interactive CLI calculator that just works.
NexusCalc - because sometimes you need to calculate things and your brain said "no."
โจ Features
- โ Addition - Add two numbers
- โ Subtraction - Subtract second from first
- โ๏ธ Multiplication - Multiply two numbers
- โ Division - Divide first by second (with zero division error handling)
- ๐ Floor - Floor division (integer result)
- ๐ข Floating-point precision - 0.1 + 0.2 = 0.3 (we fixed it!)
- ๐ก๏ธ Error handling - Division by zero? We got you
- โจ๏ธ Regex quit patterns -
q,Q,quit,QUIT,6 - ๐ Calculation counter - Track your math history
- ๐จ Beautiful formatting - Clean, color-coded output
- ๐ก Built-in help - Type
horhelpfor documentation - ๐ง Keyboard interrupts - Ctrl+C gracefully handled
๐ฆ Installation
python -m pip install nexuscalc
๐ Usage
Interactive Mode (Recommended)
from nexuscalc import start_calc
start_calc()
Or using the wrapper:
from nexuscalc import nexuscalc
nexuscalc.start_calc()
Or after installation, just run:
nexuscalc
โ ๏ธ Deprecated (will be removed in 2.0.0)
from nexuscalc import calculate
calculate() # Deprecated - use start_calc() instead
Quick Start
# Method 1: Recommended - Direct function
from nexuscalc import start_calc
start_calc()
# Method 2: Recommended - Using wrapper
from nexuscalc import nexuscalc
nexuscalc.start_calc()
# Method 3: Deprecated (will be removed in 2.0.0)
from nexuscalc import calculate
calculate() # โ ๏ธ Deprecated
# Method 4: Deprecated (will be removed in 2.0.0)
from nexuscalc import nexuscalc
nexuscalc.calculate() # โ ๏ธ Deprecated
# Method 5: Using the class (advanced)
from nexuscalc import NexusCalc
calc = NexusCalc()
calc.run()
# Method 6: Show help
from nexuscalc import nexuscalc
nexuscalc.help()
Programmatic Usage
from nexuscalc.core.operations import Operations
ops = Operations()
result = ops.add(5, 3) # Returns 8
result = ops.divide(10, 2) # Returns 5.0
result = ops.floor_divide(10, 3) # Returns 3
๐ฎ Interactive Commands
While using the calculator, you can type:
| Command | Action |
|---|---|
1-5 |
Select operation |
h, help, ? |
Show help |
q, Q, quit, QUIT, 6 |
Exit calculator |
Ctrl+C |
Cancel current operation |
Ctrl+D |
Exit calculator |
๐ Examples
from nexuscalc import start_calc
# Start the calculator
start_calc()
# Example session:
# ==================================================
# ๐ข NEXUSCALC - Powerful Calculator
# ==================================================
#
# 1. Add โ
# 2. Subtract โ
# 3. Multiply โ๏ธ
# 4. Divide โ
# 5. Floor ๐
# 6. Quit ๐ช
#
# Use 1-5
# NEXUSCALC > 1
# Enter first number
# NEXUSCALC > 0.1
# Enter second number
# NEXUSCALC > 0.2
#
# โ
Result: 0.3
๐ก๏ธ Error Handling
NexusCalc handles errors gracefully:
# Division by zero
NEXUSCALC > 4
Enter first number
NEXUSCALC > 10
Enter second number
NEXUSCALC > 0
โ Division Error: Cannot divide by zero!
๐ก Hint: You cannot divide by zero. Please try a different number.
# Invalid input
NEXUSCALC > 1
Enter first number
NEXUSCALC > hello
โ Error: 'hello' is not a valid number
๐ก Please try again with a valid number.
๐ Why NexusCalc?
| Feature | NexusCalc | Other Calculators |
|---|---|---|
| CLI Interface | โ | โ |
| Error Handling | โ | โ ๏ธ |
| Regex Quit Patterns | โ | โ |
| Floating Point Precision | โ | โ ๏ธ |
| Built-in Help | โ | โ |
| Calculation Counter | โ | โ |
| Keyboard Interrupts | โ | โ |
| Beautiful Output | โ | โ |
| Deprecation Warnings | โ | โ |
๐ Version History
| Version | Changes |
|---|---|
| 1.1.0 | Added start_calc(), deprecated calculate() |
| 1.0.0 | Initial stable release |
๐งช Development
Run tests:
python -m pytest tests/ -v
Run tests with coverage:
python -m pytest tests/ --cov=src/nexuscalc
๐ Project Structure
nexuscalc/
โโโ src/nexuscalc/
โ โโโ core/ # Core calculator logic
โ โโโ parsers/ # Expression parsing
โ โโโ evaluator/ # Expression evaluation
โ โโโ utils/ # Utilities and helpers
โ โโโ exceptions/ # Custom exceptions
โโโ tests/ # Unit tests
โโโ examples/ # Usage examples
โโโ setup.py # Package setup
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
MIT License - see the LICENSE file for details.
๐ค Author
Light Bulb Experiments ยฉ 2026
๐ Acknowledgments
- Built with โ and โค๏ธ
- Inspired by the need for a simple, powerful CLI calculator
- Thanks to all users who made this better
โญ Show Your Support
If you find NexusCalc useful, please consider:
- โญ Starring the repository on GitHub
- ๐ Reporting issues
- ๐ก Suggesting features
- ๐ง Contributing code
Made with โค๏ธ by Light Bulb Experiments
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 nexuscalc-1.1.0.tar.gz.
File metadata
- Download URL: nexuscalc-1.1.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7c35d2c239bdd525dec7ed6bb6fd24705c2cec2fe25f5c3298c1be9a7185cb3
|
|
| MD5 |
9400c23c4552e04d7922f419ec628d79
|
|
| BLAKE2b-256 |
7af28cff3ca28c728216f8b8a42aefa817a8db61db6926a528e6a70be9fccd79
|
File details
Details for the file nexuscalc-1.1.0-py3-none-any.whl.
File metadata
- Download URL: nexuscalc-1.1.0-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd17057eff73cf74246690fbe746737b4d086f7c39bc5ac4e29039afb567ad9c
|
|
| MD5 |
0bec2af282465eaf63b85bee676ad1f9
|
|
| BLAKE2b-256 |
e83b591733b321937550c38048dcc2222e56dee86880394192128ca6e8a15981
|