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-3.0.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

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

nexuscalc-3.0.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nexuscalc-3.0.0.tar.gz
Algorithm Hash digest
SHA256 2c79275894a851a9c3c1b31e06bc62a5577d67f1ab6ab8ff32dce900c2623a4e
MD5 ba739a889f8e81f413e0ba5d5bbb9f79
BLAKE2b-256 072c524eea443cb06d3941c97c4f60c578324625958478f8e17faf1e1451723f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for nexuscalc-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50836ecdf8be907801b1d806a53e116c16737a33da44bc96c3dab1d18e954338
MD5 9e066680dd867ba75f4e3796a16ba50f
BLAKE2b-256 d526142c73d136ada853e9f792911df2f231334ef1ecfeaa70fee4ed544904cb

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