Repository navigation
v1.10.0
Routes Number.to() through the active UnitSystem, establishing
UnitSystem as the authority for unit resolution and graph lookup. This
is the first step toward retiring module-level global state; all existing
call sites continue to work without changes.
Added
-
UnitSystem.resolve_unit(name)— resolves a unit name, alias,
scale-prefixed name, or composite expression string to aUnitor
UnitProduct, drawing from the system's unit registry. Delegates to
parse_unit()withsystem=self. -
Top-level exports:
active(),use()— the active-system
accessor and context-manager scoping function are now importable
directly fromucon.active()returns the currently active
UnitSystem, falling back toUnitSystem.from_globals()when none
has been set. -
get_default_graph()checks active system — resolution priority
is now: context-local graph (fromusing_conversion_graph) →
activeUnitSystem'sconversion_graph→ module-level default
(legacy fallback). -
tests/ucon/test_deprecation.py— parametrized test coverage for
all deprecated symbols emittingDeprecationWarning.
Changed
-
Number.to()routes throughactive()— when neithersystem=
norgraph=is provided,Number.to()obtains both the conversion
graph and unit resolver from the activeUnitSysteminstead of
importingget_default_graphandparse_unitdirectly. Callers see
no behavioral change; the method signature is unchanged. -
Deprecation warnings upgraded to
DeprecationWarning— the
following symbols previously emittedPendingDeprecationWarning
(introduced in v1.8) and now emitDeprecationWarning, the standard
signal that removal is forthcoming in v2.0:UnitSystem.conversionsproperty (useconversion_graph)UnitSystem(conversions=...)constructor kwarg (useconversion_graph=)using_graph()(useusing_conversion_graph())set_default_basis_graph()(usewith use(system): ...)reset_default_basis_graph()(usewith use(system): ...)
Notes
-
UnitSystemis not yet exported as the real class fromucon. The
PEP-562 aliasucon.UnitSystem → BaseUnitsremains active with a
DeprecationWarning. The alias will be retired andUnitSystem
exported directly in v2.0. -
Module-level globals are still functional. This release wires
UnitSystemas the routing authority but does not deprecate
set_default_graph(),reset_default_graph(), orfrom_globals().
Those deprecations land in a subsequent v1.x release once test
infrastructure has migrated touse()scoping.