ucumvert
Python parser & interface for UCUM (Unified Code for Units of Measure).
What it is and what it does
ucumvert bridges UCUM (Unified Code for Units of Measure) and Python's pint library. UCUM is a standardized code system for expressing units unambiguously in electronic communication; ucumvert provides a full parser for UCUM syntax and a converter that turns UCUM codes into pint Quantity objects. It includes a custom pint UnitRegistry pre-loaded with all UCUM unit definitions from specification version 2.2, so you can work with UCUM codes directly in pint without manual setup.
The parser is built on lark and generated from the official UCUM specification file (ucum-essence.xml), making it straightforward to update for new UCUM releases. The package handles the fact that some UCUM unit atoms are invalid in pint by maintaining explicit mappings (e.g., cal_[15] → cal_15). It is actively maintained and supports Python 3.11 through 3.14, though it remains in Beta and the maintainer recommends reviewing definitions and test coverage before production use.
Use it for:
- Parse and convert UCUM unit codes in scientific or medical data pipelines where units must be unambiguous and standardized.
- Build a pint-based unit conversion system that needs to handle UCUM notation from external data sources or standards.
- Validate UCUM unit strings and convert them to pint quantities for dimensional analysis in research or engineering applications.
- Extend pint's default unit definitions with the full UCUM catalog for domains that require comprehensive unit coverage.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses UCUM (Unified Code for Units of Measure) unit strings and converts them to pint-compatible units, with a built-in pint registry that includes all UCUM unit definitions.
Yes, if you work with UCUM unit codes and need to convert them to pint. The package is actively maintained, has low install friction, and includes comprehensive UCUM definitions. However, it is in Beta status—the maintainer explicitly warns that bugs may be present and recommends reviewing definitions before production use. Not necessary if you only use standard pint units.
Install
ucumvert on PyPI
pip
pip install ucumvertuv
uv add ucumvertpoetry
poetry add ucumvertInstalling ucumvert
Before you install
Low friction install with only two runtime dependencies (lark and pint). Actively maintained with a recent release; however, the package is in Beta status and the maintainer explicitly notes that bugs may still be present and recommends reviewing definitions before trusting them in production.
License in practice
MIT license with a permissive treatment. Code in the repository is MIT-licensed except for ucum-*.* files in src/ucumvert/vendor, which fall under the UCUM Copyright Notice and License; the maintainer clarifies this is not considered derivative work under §1.3 of that license.
Quickstart
pip install ucumvert
from ucumvert import PintUcumRegistry
ureg = PintUcumRegistry()
result = ureg.from_ucum("m/s2.kg")
print(result) # <Quantity(1.0, 'kilogram * meter / second ** 2')>
Requires Python 3.11 or later.
Verify before relying
- Whether the UCUM-to-pint conversion covers all real-world UCUM codes used in your domain, given the note that only conversion from UCUM to pint is currently supported.
- Performance characteristics when parsing or converting large volumes of UCUM codes.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — lark, pint |
| Maintenance | actively maintained — 71 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 120,451/month — #12,023 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ucumvert-0.3.2-py3-none-any.whl
Keywords: UCUM, parser, units of measurement
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
PintPint defines, operates on, and converts between…
permissive · top 5,000 on PyPI
pint-xarrayAdds physical units support to xarray datasets…
permissive · top 15,000 on PyPI
Pint-PandasPint-Pandas adds physical unit support to…
permissive · top 15,000 on PyPI
hepunitsProvides units and physical constants in the…
permissive · top 15,000 on PyPI
unytAttaches units to NumPy arrays and provides…
permissive · top 15,000 on PyPI
ansys-unitsManages physical quantities with numerical…
permissive · top 15,000 on PyPI
typedunitsImplements unit of measurement arithmetic with…
permissive · top 15,000 on PyPI
isqxisqx provides type-annotation-friendly metadata…
permissive · top 15,000 on PyPI
measurementProvides unit-aware measurement objects for…
permissive · top 5,000 on PyPI
cf-unitscf-units provides units of measure as defined…
permissive · top 15,000 on PyPI