Skip to content

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).

class

class EnvReport

drift: one row per differing package (package, pinned, running, level); notes in the input-note shape; score_ok false on any major drift.

Fields

NameTypeDefaultDescription
driftlist[dict[str, Any]]field(default_factory=list)
noteslist[dict[str, Any]]field(default_factory=list)
Methods and properties (3)

score_ok property

score_ok: bool

to_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(),
) -> None

Source: packages/ump-workflow/src/ump_workflow/env.py, line 70

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

function

def running_version(name: str) -> str | None

The installed version of the distribution that provides import name name, or None.

Source: packages/ump-workflow/src/ump_workflow/env.py, line 34

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

function

def compare_env(
pinned: Mapping[str, str | None],
running: Mapping[str, str | None] | None = None,
) -> EnvReport

Compare 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

NameTypeValueDescription
CORE('numpy', 'pandas', 'finprint', 'ump_spec')