Skip to content

Support pint 0.26 - #84

Merged
dalito merged 3 commits into
mainfrom
support-pint-0-26
Nov 5, 2026
Merged

dalito merged 3 commits into
mainfrom
support-pint-0-26

Conversation

@dalito

@dalito dalito commented Nov 5, 2026

Copy link
Copy Markdown
Owner

pint 0.26 made three changes that break ucumvert:

  • Invalid unit aliases are rejected at definition time (Pint should validate aliases hgrecco/pint#1918), so PintUcumRegistry() failed to load because of the i.U. alias. pint never resolved that alias, since it parses it as i * U.
  • Unknown operators such as [ now raise (Currency symbols $ € £ cannot be used  hgrecco/pint#1814). ucumvert passed bracketed atoms like [in_i] to pint and relied on pint skipping the brackets. Both transformers and the mapping report generator now strip the brackets themselves, which also fixes UcumToPintStrTransformer emitting m[IU] (read by pint as meter * IU instead of milli-IU).
  • Quantity.__repr__ changed (Quantity repr hgrecco/pint#1495), which only affected a CLI test.

Code that passes bracketed UCUM atoms directly to a pint registry, e.g. PintUcumRegistry()("[IU]") instead of from_ucum("[IU]"), fails with pint 0.26 regardless of this change.

The full suite passes with pint 0.25.3 and 0.26.2. The generated mapping report is unchanged.

Closes #82

pint 0.26.2 validates aliases at definition time (hgrecco/pint#1918), so
the registry failed to load. The alias was never usable: pint parses
i.U. as i * U.
pint 0.26.2 raises on unknown operators such as "[" (hgrecco/pint#1814)
instead of silently skipping them, which ucumvert relied on to resolve
atoms like [in_i] to their alias in pint_ucum_defs.txt. The string
transformer also emitted m[IU], which earlier pint read as meter * IU.
@dalito
dalito merged commit 21ae31a into main Nov 5, 2026
5 checks passed
@dalito
dalito deleted the support-pint-0-26 branch November 5, 2026 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PintUcumRegistry fails to load with pint 0.26.2

1 participant