Library for input/output of transition systems in a unified Markov binary (UMB) format. See the format specification for details.
(optional) create and activate a python environment:
python -m venv .venv
source .venv/bin/activateInstall umbi via
pip install umbiRead a umbfile into an ExplicitAts object, modify initial states, and write it back:
import umbi
ats : ExplicitAts = umbi.ats.read("in.umb")
ats.set_initial_states([ats.num_states - 1])
umbi.ats.write(ats, "out.umb")More examples can be found in the ./examples folder.
umbi offers three levels of abstraction for working with UMB files:
TarFile and TarCoder - Low-level access to tarfile contents.
ExplicitUmb - In-memory representation of a typical umbfile. Attributes are standard Python objects (lists, dicts, dataclasses) providing a deserialized view of the file contents.
ExplicitAts - Format-agnostic abstraction for annotated transition systems (states, transitions, annotations). Recommended for most use cases: easiest to use programmatically and remains stable across UMB format changes.
umbi provides a basic CLI for umbfile manipulation.
Options:
--import-umb <path>- Import .umb file asExplicitUmb--import-ats <path>- Import .umb file asExplicitAts--export <path>- Export to .umb file (requires--import-umbor--import-ats)--log-level <LEVEL>- Set logging level:DEBUG,INFO(default),WARNING,ERROR,CRITICAL
Example:
umbi --import-umb input.umb --export output.umb --log-level DEBUGInstall development dependencies:
pip install .[dev]Pre-commit hooks automatically run code quality checks before each commit. Configuration: .pre-commit-config.yaml
Set up the hooks with:
pre-commit installRun hooks manually on all files:
pre-commit run --all-filesIndividual tools can be run manually:
Ruff -- Code formatting and linting. Config: pyproject.toml ([tool.ruff])
ruff check . # check for issues
ruff format . # format code
ruff check . --fix # check and fixPyright -- Static type checking. Config: pyproject.toml ([tool.pyright])
pyright # check entire project
pyright umbi/ # check specific directoryDependencies are pinned in the uv.lock lockfile for reproducible builds. To update the lockfile:
uv lockNew versions are published to PyPI via the release workflow. The workflow is triggered automatically when:
- A new version tag is pushed (format:
v*.*.*) - The bump version workflow completes successfully
Alternatively, the workflow can be triggered manually via GitHub Actions.
The release workflow:
- Updates the uv.lock lockfile to reflect any dependency changes
- Builds the distribution packages
- Publishes to PyPI via trusted publishing
- Updates the stable branch pointer to track the latest release