Skip to content

v1.10.0

Choose a tag to compare

@github-actions github-actions released this 23 May 01:55
· 65 commits to main since this release
1.10.0
88807bb

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 a Unit or
    UnitProduct, drawing from the system's unit registry. Delegates to
    parse_unit() with system=self.

  • Top-level exports: active(), use() — the active-system
    accessor and context-manager scoping function are now importable
    directly from ucon. active() returns the currently active
    UnitSystem, falling back to UnitSystem.from_globals() when none
    has been set.

  • get_default_graph() checks active system — resolution priority
    is now: context-local graph (from using_conversion_graph) →
    active UnitSystem's conversion_graph → module-level default
    (legacy fallback).

  • tests/ucon/test_deprecation.py — parametrized test coverage for
    all deprecated symbols emitting DeprecationWarning.

Changed

  • Number.to() routes through active() — when neither system=
    nor graph= is provided, Number.to() obtains both the conversion
    graph and unit resolver from the active UnitSystem instead of
    importing get_default_graph and parse_unit directly. Callers see
    no behavioral change; the method signature is unchanged.

  • Deprecation warnings upgraded to DeprecationWarning — the
    following symbols previously emitted PendingDeprecationWarning
    (introduced in v1.8) and now emit DeprecationWarning, the standard
    signal that removal is forthcoming in v2.0:

Notes

  • UnitSystem is not yet exported as the real class from ucon. The
    PEP-562 alias ucon.UnitSystem → BaseUnits remains active with a
    DeprecationWarning. The alias will be retired and UnitSystem
    exported directly in v2.0.

  • Module-level globals are still functional. This release wires
    UnitSystem as the routing authority but does not deprecate
    set_default_graph(), reset_default_graph(), or from_globals().
    Those deprecations land in a subsequent v1.x release once test
    infrastructure has migrated to use() scoping.