NumT
NumT is a powerful Python utility library for formatting numbers, currencies, dates, units, and more. It provides a simple and consistent interface for handling various numerical formatting needs.
Features
- Currency formatting with support for multiple formats (Western, Indian, Continental, Swiss)
- SI unit conversions and formatting for length, mass, and time
- Number to word conversion with support for short and long formats
- Human-readable number formatting with customizable precision
Installation
NumT is available on PyPI and can be installed using pip:
pip install numt
Or using Poetry:
poetry add numt
Usage Examples
Currency Formatting
from numt import format_currency
# Western format (default)
print(format_currency(1234567.89)) # $1,234,567.89
# Indian format
print(format_currency(1234567.89, format_type="indian")) # ₹12,34,567.89
# Continental format
print(format_currency(1234567.89, format_type="continental")) # €1.234.567,89
# Swiss format
print(format_currency(1234567.89, format_type="swiss")) # CHF 1'234'567.89
SI Unit Conversions
from numt import convert_si, Length, Mass, Time
# Length conversions
length = Length(1500, "m")
print(length.format()) # 1.50 km
# Mass conversions
mass = Mass(0.5, "kg")
print(mass.format()) # 500.00 g
# Time conversions
time = Time(3660, "s")
print(time.format()) # 1.02 h
# Direct conversion
result = convert_si(1000, "m", "km", "length")
print(result) # 1.0
Number Formatting
from numt import to_words
# Short format
print(to_words(1234567)) # 1.23 M
print(to_words(1234567, format_type="long")) # 1.23 million
# With precision
print(to_words(1234567, precision=1)) # 1.2 M
# Strip zero cents
print(to_words(1000.00, strip_zero_cents=True)) # 1 K
Development
Setup Development Environment
- Clone the repository:
git clone https://github.com/yourusername/numt.git
cd numt
- Install dependencies using Poetry:
poetry install
- Install pre-commit hooks:
poetry run pre-commit install
Running Tests
poetry run pytest
Building the Package
poetry build
Contributing
We welcome contributions! Please see our Contributing Guidelines for details on how to submit pull requests, report issues, and suggest improvements.
Code of Conduct
Please read our Code of Conduct to keep our community approachable and respectable.
License
This project is licensed under the terms of the LICENSE file.
Changelog
See the CHANGELOG.md file for a list of changes between versions.
Metadata
Release files for numt 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| numt-0.1.1.tar.gz | 7.2 kB | Without provenance | Details for numt-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| numt-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for numt-0.1.1-py3-none-any.whl |
Total release size: 16.9 kB
Release files / numt-0.1.1.tar.gz
| Download URL | numt-0.1.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
023301de66f7ceec2a41c4b1255c72e8804c760ea0e0e7b2934e71dc1a4c629d
|
|
BLAKE2b-256 checksum How to use checksums |
26b25320122d658dc562e21d396d56354b77601cd0e272358b083ee8ad3ecb38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.3 Linux/6.11.0-1015-azure
|
Release files / numt-0.1.1-py3-none-any.whl
| Download URL | numt-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
948595bd2f7b59cd7807cfba087f44b3a6783a5daed7994fe88c28ee6e723a3f
|
|
BLAKE2b-256 checksum How to use checksums |
06928cb12b713c362e2f5680166cc752d5267edebd837c67a20db3df422f63b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.3 Linux/6.11.0-1015-azure
|
Security for numt 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.