Repository navigation
v0.7.0
unitx 0.7.0 adds clearer unit spelling policies and richer unit-expression syntax, and shares the SI definitions used by units and physical constants.
Highlights
prefixable: PrefixPolicy = Trueaccepts a bool or tuple of registered unit spellings, such as('arcsec', 'arcsecond'). Only listed spellings accept prefixes. The existing True/False behavior remains available.- Use
[registered name]inside products, reciprocals, and powers. Standalone hyphenated names and adjacent Unicode integer superscripts such asm²ands⁻¹²are supported. - Unit definitions, spelling resolution, and registration validation now share
unitx.unitregistry, including the publicPrefixPolicytype alias. - SI units and constants share coherent base definitions.
lyderives from the speed of light and Julian year;eVderives from the elementary charge and volt. - The catalog includes are, hectare, Julian year, fixed month interval, light year, unified atomic mass unit, reactive power, and additional common prefixed attributes.
mHgis the registered prefixable unit;mmHguses its milli prefix. The existing pressure conversion scale is preserved, and stacked prefixes are rejected.
Migration
- Square brackets and integer superscripts are reserved syntax and cannot occur in custom registered spellings. Rename affected definitions before rebuilding stored objects.
mmHghas the formal identity of milli-prefixedmHg; rebuild stored units when upgrading. Its conversion scale is unchanged.- Registering
uintroduces ambiguity warnings for ASCII micro spellings such asum. Their meaning is unchanged; useµm,μm, ormicrometreto avoid the warning. ktremains a knot alias; tonne remains unprefixable.yrremains 365 days, whilea_jis exactly 365.25 days.mois one twelfth of a Julian year, not a calendar month.
Validation
- Python 3.12 with the built-in factorization backend: 2528 passed, 2 skipped, including Pyright.
- Python 3.13 with SymPy: 2529 passed (type checks run separately under Python 3.12).
- Ruff, README examples, fresh-process imports, and 2685 spelling/expression round trips passed.
- Wheel/sdist metadata, installed-wheel runtime checks, py.typed packaging, installed README examples, and a strict external Pyright consumer passed.