--- id: ucumvert version: "0.3.2" license: MIT license_treatment: permissive maintenance: active --- # ucumvert — Python parser & interface for UCUM (Unified Code for Units of Measure). License: permissive · Maintenance: active · Downloads: 120.5K/mo ## 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 above — 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 pip install ucumvert uv add ucumvert poetry add ucumvert ## Installing 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) # 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_current - Install friction: low - Maintenance: active - Downloads: 120.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags UCUM unit parser, convert UCUM to pint, units of measure parsing, UCUM code converter, scientific unit handling, unit string parser, unit-conversion, scientific-computing [View on SkillFed](https://skillfed.io/packages/ucumvert) · [View on PyPI](https://pypi.org/project/ucumvert/)