2 Commits
Author SHA1 Message Date
Thomas Roos 247ed1a843 python3-pint: add missing runtime dependencies
pint requires flexcache, flexparser and typing-extensions, but only the
ptest package pulled in flexcache and flexparser, so "import pint" fails
with "No module named 'flexcache'" on an image without the ptest.

pint is extended to native and nativesdk, so flexcache and flexparser
are as well.

AI-Generated: Claude Code, Claude Opus 5.5
Signed-off-by: Thomas Roos <thomas@roosesweb.de>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-11-08 16:03:26 -08:00
Leon Anavi 6540dceb7b python3-pint: Upgrade 0.25.3 -> 0.26.2
Upgrade to release 0.26.2:

Major changes

- check(), +/-, comparisons and to_reduced_units() now use the
  active context, e.g. adding kN and kg in a context relating force
  and mass (#1951, #1748, #1002, #1067)
- <number> / <offset or logarithmic unit> (e.g. 1 / ureg.degC) now
  raises OffsetUnitCalculusError; Unit * bool and Quantity * str
  now raise TypeError
- Add a deprecation warning to ApplicationRegistry.__getitem__()
  matching direct registry item access
- Improve and test / and * between Quantity and Unit, supporting
  more edge cases; improve their type annotations as well
- Preserve the registry's Quantity type in wraps annotations for a
  single return unit, allowing array results to be indexed
- Improve type annotations for Unit: / and ** keep the unit type,
  and __copy__/__deepcopy__ keep the registry subclass

Units and parsing

- Update definition of US survey units to reflect the 2022 revision
  by NIST/NGS
- Fix fathom to equal two international yards; the old value is now
  survey_fathom
- Fix the angular mil so one turn is 6400 mil
- Parse $ as a unit symbol like £, and raise DefinitionSyntaxError
  for unknown operators such as & instead of ignoring them
- Raise DefinitionSyntaxError instead of an internal TypeError for
  addition or subtraction in unit expressions, e.g. kilo-watt
- Reject invalid unit aliases at definition time while preserving
  Unicode and degree aliases

Formatting changes

- Add TypstFormatter and ZeroFormatter to allow formatting to plain
  Typst and zero package
- Format temperature units as valid LaTeX (~L) and siunitx (Lx),
  e.g. \degreeCelsius
- str() and format() of a Unit now use the registry's fmt_locale,
  like Quantities
- Keep the row layout of multi-dimensional arrays in
  Quantity._repr_html_, as repr does
- Fix babel not localizing unit names containing underscores, e.g.
  kilowatt_hour
- Fix formatting a unit with only negative exponents, e.g. 1 /
  second, raising IndexError when a locale is set
- Restore the previous numeric locale when localized formatting
  raises an exception

NumPy

- Support the numpy.vecdot, numpy.matvec and numpy.vecmat ufuncs
  and numpy.linalg.vecdot on Quantities
- Support numpy.repeat on Quantities
- numpy.sum/numpy.nansum now raise DimensionalityError for a bare
  non-zero initial on a dimensioned Quantity, like numpy.max
- Fix numpy.sum/numpy.nansum not converting a Quantity initial
  value, unlike numpy.max/numpy.min
- Fix numpy.nanmax/numpy.nanmin raising ValueError on a Quantity
  initial value, unlike numpy.max/numpy.min
- Fix numpy.clip not converting the units of the numpy 2.1 min/max
  keywords
- Fix recursion in numpy.average with dimensionless Quantity
  weights and returned=False
- Fix assigning offset-unit quantities (e.g. degC into a kelvin
  array) via __setitem__
- Fix numpy.linspace(..., retstep=True) on Quantities failing to
  return separate samples and step; offset temperature steps use
  delta units
- Fix numpy.block raising TypeError for nested lists of Quantities,
  e.g. numpy.block([[a, b], [c, d]])
- Fix numpy.percentile, numpy.nanpercentile, numpy.quantile, and
  numpy.nanquantile raising RecursionError when q is a Quantity
- Fix numpy.tensordot, numpy.cross and the other multiplicative
  functions rejecting positional arguments after the two arrays,
  e.g. numpy.tensordot(a, b, 1)
- Fix numpy.mod, numpy.remainder, numpy.fmod and numpy.floor_divide
  ignoring the units of the divisor when both operands have the
  same dimensionality, e.g. np.mod(7 m, 200 cm) returned 7 m
- Fix numpy.unwrap raising TypeError on the period keyword; a
  Quantity period or discont is converted to the units of the input
- Fix numpy.diff and numpy.ediff1d not converting the units of
  Quantity prepend/append and to_end/to_begin values
- Fix numpy.ptp returning an absolute temperature instead of a
  delta for offset units

Bugfixes

- Fix converting logarithmic units defined with a compound
  reference, e.g. volt / ampere, which dropped all but one
  reference unit
- Fix compound logarithmic units, e.g. Quantity(-161, "dBm/Hz"),
  becoming an undefined delta_ unit that could not be converted
- Fix logarithmic unit conversion and hashing with Decimal
  magnitudes and non_int_type=Decimal, with or without NumPy
- Fix UnitRegistry.wraps() converting only the first variadic
  positional argument and failing on empty *args; preserve
  keyword-only arguments and defaults
- Fix UnitRegistry.check() validating the wrong arguments of
  functions with *args, **kwargs or keyword-only parameters, and
  failing to call functions with positional-only defaults
- Fix 1 * unit skipping auto_reduce_dimensions and
  autoconvert_to_preferred, so it disagreed with every other
  magnitude
- Fix to_preferred raising a spurious DimensionalityError for some
  preferred units
- Fix RecursionError in find_connected_nodes for long chains of
  contexts
- Fix in-place **= changing a Quantity's units when the magnitude
  update fails, e.g. a fractional power of an integer array
- Fix Quantity.dimensionality being stale after an in-place
  operation changes the units
- Fix Quantity.to_compact() raising OffsetUnitCalculusError for
  offset units like degree_Celsius with magnitude below 1

Documentation

- Document is_compatible_with in the tutorial
- Document defining units with a custom Converter
- Document that Unit equality compares definitions, not values,
  e.g. kph != km/hour (#1433, #1876)
- Document how to compare angles that differ by a full turn, e.g.
  -140 degree and 220 degree, using the modulo operator

Development and packaging

- Remove the babel <= 2.8 upper bound from the babel extra
- Fix CI never comparing the matplotlib test figures with the
  baseline images: --mpl was lost with the Travis config in 2021
- Fix CI installing the numpy matrix pin outside the pixi env on
  Windows/macOS, so those legs ran the no-numpy test suite

Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-10-21 17:07:42 -07:00