Skip to main content

A Python package for numerical operations and conversions

Project description

Numo 🔢

Numo is a versatile Python package that combines mathematical operations, unit conversions, currency conversions, and translations in one powerful tool.

Features ✨

  • Mathematical Operations 🧮

    • Basic arithmetic (+, -, *, /, ^, %)
    • Built-in functions (nsum, navg, nmax, nmin)
    • Variable management (x = 5, y = x + 3)
    • Custom function support (numo.add_function("double", lambda params: float(params[0]) * 2))
    • Custom variable support (numo.add_variable("pi", 3.14159))
  • Unit Conversions 📏

    • Length (km, m, cm, mm, mile, etc.)
    • Weight (kg, g, mg, lb, etc.)
    • Volume (l, ml, gal, etc.)
    • Time (hour, minute, second)
    • Digital Storage (gb, mb, kb)
    • Speed (mph, kmph)
    • Area (m², km², etc.)
    • Angular (degree, radian)
  • Currency Conversions 💱

    • Real-time exchange rates
    • Support for major currencies (USD, EUR, GBP, etc.)
    • Accurate and up-to-date conversions
  • Text Translation 🌍

    • Support for multiple languages
    • Simple syntax: "hello in spanish" -> "hola"
    • Powered by Google Translate

Installation 📦

pip install numo

Usage 🚀

Command Line Interface

# Interactive mode
numo

# Single expression
numo -e "2 + 2"

# Process file
numo -f expressions.txt

Python Library

from numo import Numo
import asyncio

async def main():
    numo = Numo()
    
    # Add custom functions
    numo.add_function("double", lambda params: float(params[0]) * 2)
    numo.add_function("sum_squares", lambda params: sum(float(p)**2 for p in params))
    
    # Add custom variables
    numo.add_variable("pi", 3.14159)
    numo.add_variable("gravity", 9.81)
    
    results = await numo.calculate([
        "2 + 2",                  # Math: 4
        "1 km to m",              # Units: 1000 m
        "hello in spanish",       # Translation: hola
        "100 usd to eur",         # Currency: ~85 EUR
        "x = 5",                  # Variables
        "x + 3",                  # Using variables: 8
        "nsum(1, 2, 3, 4, 5)",   # Built-in functions: 15
        "double(5)",              # Custom function: 10
        "2 * pi",                 # Custom variable: 6.28318
        "gravity * 2"             # Custom variable: 19.62
    ])
    
    for expr, result in zip(expressions, results):
        print(f"{expr} = {result}")

if __name__ == "__main__":
    asyncio.run(main())

Examples 📝

# Mathematical Operations
"2 + 2"              # -> 4
"3 * 4"              # -> 12
"2 ^ 3"              # -> 8

# Unit Conversions
"1 km to m"          # -> 1000 m
"100 cm to m"        # -> 1 m
"1 hour to minutes"  # -> 60 minutes

# Currency Conversions
"100 USD to EUR"     # -> 85.3 EUR
"50 EUR to JPY"      # -> 6150 JPY

# Translations
"hello in spanish"   # -> hola
"goodbye in french"  # -> au revoir

# Variables
"x = 5"              # Define variable
"y = x + 3"          # Use variable: 8

# Built-in Functions
"nsum(1,2,3,4)"      # -> 10
"navg(2,4,6,8)"      # -> 5

# Custom Functions
numo.add_function("double", lambda params: float(params[0]) * 2)
"double(5)"          # -> 10

# Custom Variables
numo.add_variable("pi", 3.14159)
"2 * pi"             # -> 6.28318

Development 🛠️

Setup Development Environment

# Clone the repository
git clone https://github.com/furkancosgun/numo.git
cd numo

# Install test dependencies
pip install -e ".[test]"

# Run tests
pytest

Project Structure

numo/
├── src/
│   ├── application/     # Core business logic
│   ├── domain/         # Business rules
│   ├── infrastructure/ # External interfaces
│   └── presentation/   # User interfaces
└── tests/             # Test suite

Contributing 🤝

Contributions are welcome! Please feel free to submit a Pull Request.

License 📄

This project is licensed under the MIT License - see the LICENSE file for details.

Author ✍️

Furkan Coşgun

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

numo-0.1.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

numo-0.1.0-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file numo-0.1.0.tar.gz.

File metadata

  • Download URL: numo-0.1.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.6

File hashes

Hashes for numo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 17cc01231441c618492685638419d68bd8c740a7a4d19b9e79c935382f907a69
MD5 b303b56b2ecc064bfb4cd22803ee482f
BLAKE2b-256 48839d57dbc7162067759996cae9343e4d8ccba6ffffc13becb99acc34cfddf3

See more details on using hashes here.

File details

Details for the file numo-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: numo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.6

File hashes

Hashes for numo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84cd32f9dbda493f1b91e713c9cd18a47170598b4f064143a8773a53c0496f6b
MD5 dbd42973161670c265e9e723bcd9730d
BLAKE2b-256 ab19bed8a2e5009ff92d6c97810e6da60be02258c03df08bc3872b033a889c0d

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