Library for input/output of annotated transition systems (ATSs) in a unified Markov binary (UMB) format. See the format specification for details.
pip install umbiA short example where we read a umbfile into an SimpleAts object, modify initial states, and write it back:
import umbi
ats = umbi.ats.read("in.umb")
ats.initial_states = [ats.num_states - 1]
umbi.ats.write(ats, "out.umb")More examples can be found in the examples folder.
umbi offers multiple levels of abstraction for working with UMB files:
TarFile and TarCoder - low-level access to umbfile 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.
SimpleAts - format-agnostic abstraction for annotated transition systems (states, transitions, annotations, etc.). Recommended for most use cases: easiest to use programmatically and remains stable across UMB format changes. See umbi.ats.examples for usage examples.
umbi provides a basic CLI for umbfile manipulation.
Options:
--import-umb <path>- import umbfile asExplicitUmb--import-ats <path>- import umbfile asSimpleAts--export <path>- export to umbfile (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 DEBUG(optional) create and activate a python environment:
python -m venv .venv
source .venv/bin/activateInstall development dependencies:
pip install .[dev]Run the test suite with pytest:
python -m pytest # run all tests
python -m pytest tests/tar/ # run specific test directory
python -m pytest -k test_name # run tests matching patternCurrent test coverage:
- binary - serialization and binary data handling
- datatypes - data type definitions and conversions
- tar - tarfile I/O and utilities
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 check . --fix # check and fix
ruff format . # format codePyright -- Static type checking. Config: pyproject.toml ([tool.pyright])
pyright # check entire project
pyright umbi/ # check specific directoryTo bump the version, run
bump-my-version bump <patch|minor|major>
git push origin --follow-tagsor run the bump version workflow (via GitHub Actions UI). When the new version tag is pushed, the release workflow is automatically triggered to: