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

[!CAUTION] Beta Version Warning This is a beta release (3.2.0-beta). Features may be unstable or change before the stable release. For production use, please install the latest stable version (3.0.0).

โœจ 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
  • โฟโˆš Nth Root - Nth root of a number
  • ๐Ÿ”ข Percentage - Calculate percentage of a number
  • โ— Factorial - Factorial 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, 12
  • ๐Ÿ“Š 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

[!NOTE] New in 3.2.0-beta

  • Added Percentage operation (option 10)
  • Added Factorial operation (option 11)
  • Quit moved to option 12
  • Added readme() function for easy documentation access

๐Ÿ“ฆ Installation

Stable Version (Recommended)

python -m pip install nexuscalc

Beta Version (For Testing)

python -m pip install nexuscalc==3.2.0-beta

[!WARNING] The beta version may contain bugs. Please report any issues on GitHub.

๐Ÿš€ 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

Read the README from Terminal

from nexuscalc import readme
readme()

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)
result = ops.nth_root(8, 3)      # Returns 2.0 (ยณโˆš8)
result = ops.percentage(20, 100) # Returns 20.0
result = ops.factorial(5)        # Returns 120

๐ŸŽฎ 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 Nth Root โฟโˆš
10 Percentage %
11 Factorial !
12, q, Q, quit, QUIT Exit calculator
h, help, ? Show help
Ctrl+C Cancel current operation
Ctrl+D Exit calculator

๐Ÿ“ Examples

Percentage Example

from nexuscalc import 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. Nth Root โฟโˆš
# 10. Percentage %
# 11. Factorial !
# 12. Quit ๐Ÿšช
# 
# Use 1-12
# NEXUSCALC > 10
# Enter the percentage
# NEXUSCALC > 20
# Enter the number
# NEXUSCALC > 100
# 
# ==================================================
# ๐Ÿ“Š Calculation #1
# ==================================================
#   20% of 100 = 20.0
# ==================================================

Factorial Example

NEXUSCALC > 11
Enter a number
NEXUSCALC > 5

==================================================
๐Ÿ“Š Calculation #2
==================================================
  5! = 120
==================================================

Nth Root Example

NEXUSCALC > 9
Enter the number
NEXUSCALC > 8
Enter the root (n)
NEXUSCALC > 3

==================================================
๐Ÿ“Š Calculation #3
==================================================
  ยณโˆš8 = 2.0
==================================================

๐Ÿ›ก๏ธ Error Handling

NexusCalc handles errors gracefully:

# Even root of negative number
NEXUSCALC > 9
Enter the number
NEXUSCALC > -8
Enter the root (n)
NEXUSCALC > 2

โŒ Error: Cannot take even root of a negative number!

# Factorial of negative number
NEXUSCALC > 11
Enter a number
NEXUSCALC > -5

โŒ Error: Factorial is not defined for negative numbers!

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

[!IMPORTANT] Factorial Limitation Factorial is only defined for non-negative integers up to 100 to prevent overflow.

๐Ÿ“Š 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 โœ… โŒ
Modulo Operation โœ… โš ๏ธ
Exponent Operation โœ… โš ๏ธ
Square Root Operation โœ… โš ๏ธ
Nth Root Operation โœ… โŒ
Percentage Operation โœ… โš ๏ธ
Factorial Operation โœ… โš ๏ธ

๐Ÿ“‹ Version History

Version Status Changes
3.2.0-beta ๐Ÿ”„ BETA Added Percentage, Factorial, Quitโ†’12
3.0.0 โœ… STABLE Added Nth Root, Quitโ†’10
2.6.0 โœ… STABLE Added Square Root, Quitโ†’9
2.5.0 โœ… STABLE Added Exponent, Quitโ†’8
2.1.0 โœ… STABLE Added Modulo, Quitโ†’7
2.0.0 โœ… STABLE Removed calculate(), start_calc() only
1.1.0 โœ… STABLE Added start_calc()
1.0.0 โœ… STABLE Initial release

[!CAUTION] Version 3.2.0-beta is a pre-release. Please test and report any issues before the 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-3.2.0b0.tar.gz (19.7 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.2.0b0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file nexuscalc-3.2.0b0.tar.gz.

File metadata

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

File hashes

Hashes for nexuscalc-3.2.0b0.tar.gz
Algorithm Hash digest
SHA256 f7c1b50483b4b22cf8e64ddf50bc9fc45ed1f53f9d100ff84fc7f18f81317a6f
MD5 a951fbf9adc7688c308dbef5e1240295
BLAKE2b-256 ec79a2de9b1f575bd2f95c1bc7ab3eb5aff494c4b88137bf7ab698176a9f7d5e

See more details on using hashes here.

File details

Details for the file nexuscalc-3.2.0b0-py3-none-any.whl.

File metadata

  • Download URL: nexuscalc-3.2.0b0-py3-none-any.whl
  • Upload date:
  • Size: 18.7 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.2.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef5db742314c3ebd74943ac3528961b5367e24a2925dbda2a855b7adf04a90f7
MD5 5d01faef7a96492c701e8b2ee69cd201
BLAKE2b-256 0c4fe9cae9c155975658340921f77852640e2e182d9267b7248adff4f260d5b8

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