Skip to main content

Lightweight unit converter library with support for 13 unit categories

Project description

Mahounou UConv (Python)

License: MIT Python 3.10+

Python implementation of the Mahounou UConv family.

Naming convention across ecosystems:

  • NPM: @mahounou/uconv
  • PyPI: mahounou-uconv
  • Composer: mahounou/uconv

Import name in Python remains:

  • from uconv import convert

Installation

From PyPI

pip install mahounou-uconv

From Source

git clone https://github.com/ksnjkdppdojdim-star/UconvPy.git
cd UconvPy
pip install -e .

CLI (Important)

This project installs these Python commands:

  • uconvpy

Examples:

uconvpy 10 km m
uconvpy 60 l/min m3/h
uconvpy list --lang fr
uconvpy categories

Why not install a Python command named uconv by default?

  • Because many machines already have the Node global command uconv from npm install -g @mahounou/uconv.
  • Keeping Python command as uconvpy avoids command conflicts in PATH.

Quick Start (Library)

from uconv import convert

convert('10km', 'm')
convert('0c', 'f')
convert('100km/h', 'm/s')
convert('1kwh', 'j')

API Highlights

from uconv import (
		convert,
		convert_display,
		convert_currency_live,
		parse_input,
		register_unit,
)

Supported Categories

  • distance
  • weight
  • time
  • currency
  • temperature
  • speed
  • area
  • volume
  • energy
  • pressure
  • power
  • data

Project Structure (Scalable, Node-like)

UconvPy/
	uconv/
		__init__.py
		cli.py
		parser.py
		converters/
			area.py
			currency.py
			data.py
			distance.py
			energy.py
			power.py
			pressure.py
			speed.py
			temperature.py
			time.py
			volume.py
			weight.py
		i18n/
			en_US/LC_MESSAGES/
			fr_FR/LC_MESSAGES/
		units/
			area.py
			currency.py
			data.py
			distance.py
			energy.py
			power.py
			pressure.py
			speed.py
			temperature.py
			time.py
			volume.py
			weight.py
			__init__.py
		utils/
			convert.py
	tests/
		test_cli.py
		test_convert.py
		test_currency_live.py
		test_i18n_display.py
	.github/workflows/
		ci.yml
		package-check.yml

Development

git clone https://github.com/ksnjkdppdojdim-star/UconvPy.git
cd UconvPy
pip install -e ".[dev]"
pytest tests -v

License

MIT License - see LICENSE file for details.

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

mahounou_uconv-0.2.4.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

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

mahounou_uconv-0.2.4-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file mahounou_uconv-0.2.4.tar.gz.

File metadata

  • Download URL: mahounou_uconv-0.2.4.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for mahounou_uconv-0.2.4.tar.gz
Algorithm Hash digest
SHA256 4f893e5906702ccefe40b0833a4431723b25754860cd77ba158b0f6d457d2575
MD5 452d39ef96c2d47680ffb30cedba982a
BLAKE2b-256 4d4274a8e7c35d94759a54c68bf86ec4f22216360d595008ad1c80aaa3769288

See more details on using hashes here.

File details

Details for the file mahounou_uconv-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: mahounou_uconv-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for mahounou_uconv-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cf57da539e80ca176480e2c4c99196fadafe22a0cf88ce462617e621bf5f95c4
MD5 ec9ab71d331031deeab5a10c2db3b65b
BLAKE2b-256 6025b664f657e349a8a0479f83930d0c892550ad1ce369046a82477416673dd2

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