Skip to main content

pydepi

A .NET-inspired, type-hint driven dependency injection container for Python.

pydepi resolves dependency graphs from constructor type annotations. It has no dependencies and knows nothing about the web — framework support ships as separate packages, so installing the container never drags a web framework into your environment.

pip install pydepi
from depi import ServiceCollection

class Config:
    def __init__(self):
        self.dsn = 'postgres://localhost/app'

class Database:
    def __init__(self, config: Config):      # resolved from the annotation
        self.dsn = config.dsn

services = ServiceCollection()
services.add_singleton(Config)
services.add_scoped(Database)

provider = services.build_provider()

with provider.create_scope() as scope:
    db = scope.resolve(Database)

Lifetimes

  • Transient – a new instance on every resolution
  • Singleton – one instance for the life of the provider
  • Scoped – one instance per scope, typically per HTTP request

Scopes dispose their instances on exit, and async with awaits async cleanup first.

Framework integrations

Each is a separate distribution depending on this one:

Package Import
pydepi-flask depi_flask
pydepi-quart depi_quart
pydepi-fastapi depi_fastapi
pydepi-django depi_django

Install one by name — pip install pydepi-flask. The extra pydepi[flask] works too, but the distribution name is the more accurate form: these are separate packages, versioned and released independently of core, not optional features of it.

Full documentation — tutorial, concepts, guides, integrations, and API reference — is at danleonard-nj.github.io/depi.

License

MIT

Metadata

Release files for pydepi 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydepi 0.1.1
File Size Uploaded Provenance Actions
pydepi-0.1.1.tar.gz 15.3 kB With provenance Details for pydepi-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydepi 0.1.1
File Interpreter ABI Platform Actions
pydepi-0.1.1-py3-none-any.whl Python 3 none any Details for pydepi-0.1.1-py3-none-any.whl

Total release size: 30.9 kB

Release files / pydepi-0.1.1.tar.gz

Download URL pydepi-0.1.1.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4bff9c149f2570af124cd3f651536add87d0a7f3d2fec3b9d64aaa503fa33b6b
BLAKE2b-256 checksum
How to use checksums
63a478e4bb72f8933c423b29f36bf3cde544b600d98e97ce7a978c9822f8b059
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / pydepi-0.1.1-py3-none-any.whl

Download URL pydepi-0.1.1-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
875aa45e46f44f9c66b86ce8ba29f30e0d703d9e2a6e2d303a258d4f61e644da
BLAKE2b-256 checksum
How to use checksums
865926b2c1bd15fd891b67acac71f655b9c32cbeb0ad6d9d09a38ed3ddc3509c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for pydepi 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pydepi-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page