Skip to main content

🔢 A chill CLI calculator that just works

Project description

🔢 NexusCalc

PyPI version Python versions License: MIT PyPI downloads Made with ☕ Built with ❤️

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)
  • 🔢 Modulo - Remainder after division
  • Exponent - Raise first number to the power of second
  • Square Root - Square root of a number
  • 🔢 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, 9
  • 📊 Calculation counter - Track your math history
  • 🎨 Beautiful formatting - Clean, color-coded output
  • 💡 Built-in help - Type h or help for 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

Programmatic Usage

from nexuscalc.core.operations import Operations

ops = Operations()

# Basic operations
result = ops.add(5, 3)           # Returns 8
result = ops.subtract(10, 4)     # Returns 6
result = ops.multiply(3, 4)      # Returns 12
result = ops.divide(10, 2)       # Returns 5.0

# Advanced operations
result = ops.floor_divide(10, 3) # Returns 3
result = ops.modulo(10, 3)       # Returns 1
result = ops.exponent(2, 3)      # Returns 8 (2^3)
result = ops.square_root(16)     # Returns 4.0 (√16)

🎮 Interactive Commands

While using the calculator, you can type:

Command Action
1 Add ➕
2 Subtract ➖
3 Multiply ✖️
4 Divide ➗
5 Floor 🏠
6 Modulo 🔢
7 Exponent ⚡
8 Square Root √
9, q, Q, quit, QUIT Exit calculator
h, help, ? Show help
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. Modulo 🔢
# 7. Exponent ⚡
# 8. Square Root √
# 9. Quit 🚪
# 
# Use 1-9
# NEXUSCALC > 8
# Enter a number
# NEXUSCALC > 16
# 
# ==================================================
# 📊 Calculation #1
# ==================================================
#   √16 = 4.0
# ==================================================

🛡️ Error Handling

NexusCalc handles errors gracefully:

# Square root of negative number
NEXUSCALC > 8
Enter a number
NEXUSCALC > -16

 Error: Cannot take square root of a negative number!

# 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.

📋 Version History

Version Changes
2.6.0 STABLE - Added Square Root, Quit moved to 9
2.5.0 ✅ STABLE - Added Exponent, Quit moved to 8
2.1.0 ✅ STABLE - Added Modulo, Quit moved to 7
2.0.0 ✅ STABLE - Removed calculate(), start_calc() is the only entry point
1.1.0 ✅ STABLE - Added start_calc(), deprecated calculate()
1.0.0 ✅ STABLE - Initial release

🧪 Development

Run tests:

python -m pytest tests/ -v

Run tests with coverage:

python -m pytest tests/ --cov=src/nexuscalc

📄 License

MIT License - see the LICENSE file for details.

👤 Author

Light Bulb Experiments © 2026


Made with ❤️ by Light Bulb Experiments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nexuscalc-2.6.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nexuscalc-2.6.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file nexuscalc-2.6.0.tar.gz.

File metadata

  • Download URL: nexuscalc-2.6.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for nexuscalc-2.6.0.tar.gz
Algorithm Hash digest
SHA256 4ec91ec6085ec5763c3aced653dd7e648b67c9946d7b54c0a87bda8b8322e93f
MD5 430becfaf08c363bd8ebc64325bf8f8f
BLAKE2b-256 1e79a797096724a530656a598c4aa0cc800824c5afa9797eca7d0c4a72c4fed6

See more details on using hashes here.

File details

Details for the file nexuscalc-2.6.0-py3-none-any.whl.

File metadata

  • Download URL: nexuscalc-2.6.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for nexuscalc-2.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9f4700ff2390c8474600badc278b496e5fdd1a25f157f7dd9467ec5d9266ae9
MD5 def8bcea6cb31d13d1ecfcddadc35df7
BLAKE2b-256 e2d41eccb4e0dfcb61f6425ca910cef03361a968d960df484881c4347e4a0d28

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page