ump_workflow.env
module ump-workflow
The environment pin: which versions a bundle was saved with, and how the running ones compare.
env_pin records Python, numpy, pandas, finprint, ump_spec and every third-party top-level package the code
module imports (found with ast, never by importing it), keyed by import name. compare_env reads a version
as major.minor.patch: a different major (or, below 1.0, a different minor) or a package no longer installed is
ENV_MAJOR_DRIFT (score refused, refit allowed); any other difference is ENV_DRIFT (a warning).
Classes
Section titled “Classes”EnvReport
Section titled “EnvReport”class
class EnvReportdrift: one row per differing package (package, pinned, running, level); notes in the input-note
shape; score_ok false on any major drift.
Fields
| Name | Type | Default | Description |
|---|---|---|---|
drift | list[dict[str, Any]] | field(default_factory=list) | |
notes | list[dict[str, Any]] | field(default_factory=list) |
Methods and properties (3)
score_ok property
score_ok: boolto_dict method
def to_dict(self) -> dict[str, Any]init constructor
EnvReport( self, drift: list[dict[str, Any]] = list(), notes: list[dict[str, Any]] = list(),) -> NoneSource: packages/ump-workflow/src/ump_workflow/env.py, line 70
Functions
Section titled “Functions”module_imports
Section titled “module_imports”function
def module_imports(source: str) -> list[str]Sorted third-party top-level package names source imports anywhere (relative and stdlib excluded).
Source: packages/ump-workflow/src/ump_workflow/env.py, line 23
running_version
Section titled “running_version”function
def running_version(name: str) -> str | NoneThe installed version of the distribution that provides import name name, or None.
Source: packages/ump-workflow/src/ump_workflow/env.py, line 34
env_pin
Section titled “env_pin”function
def env_pin(source: str) -> dict[str, str | None]Versions to pin for a bundle whose code is source.
Source: packages/ump-workflow/src/ump_workflow/env.py, line 47
compare_env
Section titled “compare_env”function
def compare_env( pinned: Mapping[str, str | None], running: Mapping[str, str | None] | None = None,) -> EnvReportCompare a bundle’s pin with the running versions (running overrides the lookup, for a known set).
Source: packages/ump-workflow/src/ump_workflow/env.py, line 86
Constants
Section titled “Constants”| Name | Type | Value | Description |
|---|---|---|---|
CORE | ('numpy', 'pandas', 'finprint', 'ump_spec') |