A typed IoC container for Python - sync, async, and FastAPI-ready.
Tripack is a dependency-injection container for Python 3.13+, published as three independently versioned packages: the contracts you type against, the resolution runtime, and the container API you call.
It resolves sync and async factories through a single graph, with transient,
singleton and scoped lifecycles and deterministic teardown; composes
registrations into modules; detects dependency cycles at resolution time; and
wires an application declaratively from TOML, JSON or YAML. ASGI primitives
and a FastAPI adapter (TripackAPI with Annotated[T, Inject]) ship with
the container.
The project site is published from main to GitHub Pages:
https://goabonga.github.io/tripack/.
Tripack follows Semantic Versioning and the
standard Python n + 2 deprecation cadence (announce + warn in one
release, remove in the release after the next). Full policy:
docs/stability.md.
The repository is a uv workspace with three independently versioned and published packages.
| Package | Role |
|---|---|
tripack-contracts |
Public contracts of the framework: protocols, interfaces, types, exceptions and annotations. |
tripack-runtime |
Idempotent execution core: resolution, dependency graph, per-scope caching, lifecycle, validation. |
tripack-container |
High-level IoC container API: declarations, wiring, modules, bootstrap. |
tripack/
├── packages/
│ ├── tripack-contracts/
│ ├── tripack-runtime/
│ └── tripack-container/
├── multicz.toml
└── pyproject.toml
- Python 3.13+
- uv for environment and workspace management
# Sync the whole workspace (creates .venv at the repo root).
uv sync --all-packages
# Run the test suite of every package.
uv run pytest
# Run the tests of a single package with coverage.
uv run --package tripack-contracts pytest --cov=tripack_contractsEach package owns its version, changelog and git tag. Versions are bumped from
Conventional Commits by
multicz, which only touches the
components whose paths were modified.
# Preview what would be released against the current branch.
multicz status --since origin/main
# Apply the bumps (CI does this on main).
multicz bump --commit --tag --pushPublished artifacts (PyPI) follow the per-component version computed by multicz.
See CONTRIBUTING.md for the workflow, the commit-message convention, and the test/lint expectations. By participating you agree to the Code of Conduct.
Security issues: please follow the disclosure process in SECURITY.md.
Distributed under the MIT License.