AllUnitConvert
AllUnitConvert (AUC) is a lightweight Python library for common unit conversions, including SI units.
Installation
python -m pip install allunitconvert
Quick start
import allunitconvert as auc
print(auc.convert(5, "km", "m")) # 5000.0
print(auc.convert(25, "C", "F")) # 77.0
print(auc.convert(1, "kg", "g")) # 1000.0
print(auc.convert(1, "GB", "MB")) # 1000.0
Supported dimensions
- Length: mm, cm, m, km, in, ft, yd, mi
- Mass: mg, g, kg, tonne, lb, oz
- Time: ms, s, min, h, day
- Temperature: C, F, K
- Area: mm2, cm2, m2, km2, ha, acre
- Volume: mL, L, m3, cm3, US gal
- Speed: m/s, km/h, mph
- Pressure: Pa, kPa, MPa, bar, atm, psi
- Energy: J, kJ, cal, kcal, Wh, kWh
- Power: W, kW, MW, hp
- Frequency: Hz, kHz, MHz, GHz
- Force: N, kN, lbf
- Electric current: A, mA, kA
- Voltage: V, mV, kV
- Digital storage: B, kB, MB, GB, TB (decimal SI); KiB, MiB, GiB, TiB (binary)
SI decimal prefixes use powers of 1000. Binary data units use powers of 1024.
Generic conversion
auc.convert(100, "cm", "m")
auc.convert(36, "km/h", "m/s")
auc.convert(0, "C", "K")
Unknown units and incompatible dimensions raise ValueError.
Legacy functions
The functions from version 0.1.0 remain available:
auc.km_to_m(5)
auc.m_to_km(1000)
auc.cm_to_m(100)
auc.kg_to_g(2)
auc.g_to_kg(1000)
auc.c_to_f(25)
auc.f_to_c(77)
auc.gb_to_bytes(1)
auc.gb_to_mb(1)
auc.mb_to_gb(1024)
auc.sec_to_min(60)
auc.min_to_hour(120)
auc.kmh_to_ms(36)
auc.ms_to_kmh(10)
Legacy gb_to_mb and mb_to_gb use the historical 1024-based convention for compatibility. Use convert() for decimal SI units or GiB/MiB for binary units.
Command line
auc --help
auc --version
auc 5 km m
auc 25 C F
auc --list-units
PyPI
https://pypi.org/project/allunitconvert/
License
MIT
Metadata
Release files for allunitconvert 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| allunitconvert-1.0.0.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| allunitconvert-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.1 kB
Release files / allunitconvert-1.0.0.tar.gz
| Download URL | allunitconvert-1.0.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe6e2fc179623d209babe76a83f1f254ad382718e263b9bd0ca9e60fbc278367
|
|
BLAKE2b-256 checksum How to use checksums |
d01b49eecaf750c4cc355dadb7d4e800588cd297aad6ff2c21299230d9e857f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / allunitconvert-1.0.0-py3-none-any.whl
| Download URL | allunitconvert-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
547ac2921d6293be40beaf8b699ca28c493cc8c07529141fbea831765b3b798c
|
|
BLAKE2b-256 checksum How to use checksums |
12a1f7a0ba747c02690812339d910f946b188a417e110ffabb0ab4351d115230
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|