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)
  • ๐Ÿ”ข 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 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

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: Using the class (advanced)
from nexuscalc import NexusCalc
calc = NexusCalc()
calc.run()

# Method 4: 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 โœ… โŒ

๐Ÿ“‹ Version History

Version Changes
2.0.0 Removed calculate(), start_calc() is now the only entry point
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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. 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


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.0.0.tar.gz (14.8 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.0.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nexuscalc-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ea021f89ec1e7961b5acdb98b66955e2d9d6f8a2f1ca2dee4cf06ae7c39ab6fd
MD5 d7b983a0a05035948b2f6bb80298cb24
BLAKE2b-256 d223b9fcc24cc63bd9563e695c7400ed41d0a4114044ea02c54b497712b846ac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nexuscalc-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.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-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75e28c9f44bbbbd139422767422a8e66ea62a0654c1ca0295ca71bc73aa12dd6
MD5 7aa6b2b3bef2563c8d78e0a8b9da060c
BLAKE2b-256 10323340e3c3a0df104e5478639165f8b9cb718efa2b9352e3282bcfb20f45a7

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