Skip to content
goabongaPublic

About

Typed IoC container for Python: sync and async resolution, transient/singleton/scoped lifecycles, modules, declarative TOML/JSON/YAML wiring and a FastAPI adapter.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Tripack
Tripack

A typed IoC container for Python - sync, async, and FastAPI-ready.

CI Codecov License: MIT Python uv

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.

Documentation

The project site is published from main to GitHub Pages: https://goabonga.github.io/tripack/.

Stability and deprecation policy

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.

Packages

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

Requirements

  • Python 3.13+
  • uv for environment and workspace management

Getting started

# 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_contracts

Versioning and release

Each 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 --push

Published artifacts (PyPI) follow the per-component version computed by multicz.

Contributing

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.

License

Distributed under the MIT License.

About

Typed IoC container for Python: sync and async resolution, transient/singleton/scoped lifecycles, modules, declarative TOML/JSON/YAML wiring and a FastAPI adapter.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages