Picodi Documentation

Picodi is a straightforward and powerful Dependency Injection (DI) library for Python, designed to simplify managing dependencies in both synchronous and asynchronous applications.

Dependency Injection is a design pattern where an object receives its dependencies from an external source rather than creating them itself. Picodi helps you implement this pattern effectively, making your code more modular, testable, and maintainable.

Inspired by FastAPI’s DI system but usable in any Python project (framework-agnostic), Picodi offers:

  • Simplicity: Easy-to-understand API.

  • Flexibility: Works seamlessly in sync and async code.

  • Zero Dependencies: Lightweight and requires only Python.

  • Lifecycle Management: Control over dependency creation and cleanup using scopes and lifespans.

  • Testability: Built-in support for overriding dependencies in tests.

Whether you’re building a web application with FastAPI, a CLI tool, or any other Python project, Picodi can help you manage your dependencies cleanly.

Documentation