# modern-di Powerful dependency-injection framework with IoC container and scopes. ## Quickstart - [Quick-Start](https://modern-di.modern-python.org/index.md): How to install and a minimal container example ## Introduction - [About DI](https://modern-di.modern-python.org/introduction/about-di/index.md): What dependency injection is and the problem it solves - [Resolving](https://modern-di.modern-python.org/introduction/resolving/index.md): Resolving dependencies by type or by provider reference - [Design decisions](https://modern-di.modern-python.org/introduction/design-decisions/index.md): The deliberate API choices behind modern-di - [Comparison](https://modern-di.modern-python.org/introduction/comparison/index.md): How modern-di compares to other DI approaches, including that-depends - [Performance](https://modern-di.modern-python.org/introduction/performance/index.md): Comparative benchmarks vs other DI frameworks, and how to reproduce them - [modern-di for FastAPI users](https://modern-di.modern-python.org/introduction/for-fastapi-users/index.md): Translating FastAPI's Depends idioms to modern-di ## Providers - [Scopes](https://modern-di.modern-python.org/providers/scopes/index.md): The five built-in scopes and the resolution rule - [Lifecycle](https://modern-di.modern-python.org/providers/lifecycle/index.md): How instances are created, cached, and cleaned up - [Factories](https://modern-di.modern-python.org/providers/factories/index.md): Regular vs cached Factory providers - [Context](https://modern-di.modern-python.org/providers/context/index.md): Injecting runtime context values with ContextProvider - [Container](https://modern-di.modern-python.org/providers/container/index.md): The auto-registered provider that resolves to the Container itself - [Alias](https://modern-di.modern-python.org/providers/alias/index.md): Binding one type to an already-registered provider - [Errors and exceptions](https://modern-di.modern-python.org/providers/errors-and-exceptions/index.md): The ModernDIError exception hierarchy - [Advanced / low-level API](https://modern-di.modern-python.org/providers/advanced-api/index.md): Low-level extension points for library authors ## Integrations - [aiogram](https://modern-di.modern-python.org/integrations/aiogram/index.md) - [aiohttp](https://modern-di.modern-python.org/integrations/aiohttp/index.md) - [arq](https://modern-di.modern-python.org/integrations/arq/index.md) - [Celery](https://modern-di.modern-python.org/integrations/celery/index.md) - [FastAPI](https://modern-di.modern-python.org/integrations/fastapi/index.md) - [FastStream](https://modern-di.modern-python.org/integrations/faststream/index.md) - [Flask](https://modern-di.modern-python.org/integrations/flask/index.md) - [gRPC](https://modern-di.modern-python.org/integrations/grpc/index.md) - [Litestar](https://modern-di.modern-python.org/integrations/litestar/index.md) - [Pytest](https://modern-di.modern-python.org/integrations/pytest/index.md): Usage with pytest, with and without modern-di-pytest - [Starlette](https://modern-di.modern-python.org/integrations/starlette/index.md) - [taskiq](https://modern-di.modern-python.org/integrations/taskiq/index.md) - [Typer](https://modern-di.modern-python.org/integrations/typer/index.md) - [Writing an integration](https://modern-di.modern-python.org/integrations/writing-integrations/index.md): Specification for building a new framework integration ## Recipes - [Async SQLAlchemy](https://modern-di.modern-python.org/recipes/sqlalchemy/index.md): Wiring an async SQLAlchemy engine, session, and repositories - [Async resources via lifespan](https://modern-di.modern-python.org/recipes/async-lifespan/index.md): Constructing async resources via the framework lifespan - [Multi-Group organization](https://modern-di.modern-python.org/recipes/multi-group/index.md): Organizing a large container with multiple Groups - [Testing with overrides](https://modern-di.modern-python.org/recipes/testing-overrides/index.md): Swapping dependencies in tests with overrides - [Request-scoped engine selection](https://modern-di.modern-python.org/recipes/request-scoped-engine/index.md): Routing requests to different engines by scope - [Good and bad practices](https://modern-di.modern-python.org/recipes/good-and-bad-practices/index.md): Common DI footguns and how modern-di catches them ## Troubleshooting - [Invalid Child Scope](https://modern-di.modern-python.org/troubleshooting/invalid-child-scope-error/index.md): Diagnosing InvalidChildScopeError - [Max Scope Reached](https://modern-di.modern-python.org/troubleshooting/max-scope-reached-error/index.md): Diagnosing MaxScopeReachedError - [Scope Not Initialized](https://modern-di.modern-python.org/troubleshooting/scope-not-initialized-error/index.md): Diagnosing ScopeNotInitializedError - [Scope Skipped](https://modern-di.modern-python.org/troubleshooting/scope-skipped-error/index.md): Diagnosing ScopeSkippedError - [Invalid Scope Type](https://modern-di.modern-python.org/troubleshooting/invalid-scope-type-error/index.md): Diagnosing InvalidScopeTypeError - [Container Closed](https://modern-di.modern-python.org/troubleshooting/container-closed-error/index.md): Diagnosing ContainerClosedError - [Validation Failed](https://modern-di.modern-python.org/troubleshooting/validation-failed-error/index.md): Diagnosing ValidationFailedError - [Missing Provider For Type](https://modern-di.modern-python.org/troubleshooting/missing-provider/index.md): Diagnosing missing provider registration errors - [Alias Source Not Registered](https://modern-di.modern-python.org/troubleshooting/alias-source-not-registered-error/index.md): Diagnosing AliasSourceNotRegisteredError - [Argument Resolution Error](https://modern-di.modern-python.org/troubleshooting/argument-resolution-error/index.md): Diagnosing ArgumentResolutionError - [Circular Dependency](https://modern-di.modern-python.org/troubleshooting/circular-dependency/index.md): Diagnosing circular dependency errors - [Creator Call Error](https://modern-di.modern-python.org/troubleshooting/creator-call-error/index.md): Diagnosing CreatorCallError - [ContextProvider Has No Value](https://modern-di.modern-python.org/troubleshooting/context-not-set/index.md): Diagnosing ContextProvider-has-no-value errors - [Duplicate Type Error](https://modern-di.modern-python.org/troubleshooting/duplicate-type-error/index.md): Diagnosing duplicate bound_type registration errors - [Child Container Registration](https://modern-di.modern-python.org/troubleshooting/child-container-registration-error/index.md): Diagnosing ChildContainerRegistrationError - [Group Scope Conflict](https://modern-di.modern-python.org/troubleshooting/group-scope-conflict-error/index.md): Diagnosing GroupScopeConflictError - [Provider Scope Frozen](https://modern-di.modern-python.org/troubleshooting/provider-scope-frozen-error/index.md): Diagnosing ProviderScopeFrozenError - [Unknown Factory Kwarg](https://modern-di.modern-python.org/troubleshooting/unknown-factory-kwarg-error/index.md): Diagnosing UnknownFactoryKwargError - [Unsupported Creator Parameter](https://modern-di.modern-python.org/troubleshooting/unsupported-creator-parameter-error/index.md): Diagnosing UnsupportedCreatorParameterError - [Scope Chain Violation](https://modern-di.modern-python.org/troubleshooting/scope-chain/index.md): Diagnosing scope chain violation errors - [Finalizer Error](https://modern-di.modern-python.org/troubleshooting/finalizer-error/index.md): Diagnosing FinalizerError - [Async Finalizer In Sync Close](https://modern-di.modern-python.org/troubleshooting/async-finalizer-in-sync-close-error/index.md): Diagnosing AsyncFinalizerInSyncCloseError - [Group Instantiation Error](https://modern-di.modern-python.org/troubleshooting/group-instantiation-error/index.md): Diagnosing GroupInstantiationError ## Migration - [To 1.x](https://modern-di.modern-python.org/migration/to-1.x/index.md): Migrating from modern-di 0.x to 1.x - [To 2.x](https://modern-di.modern-python.org/migration/to-2.x/index.md): Migrating from modern-di 1.x to 2.x - [To 3.x](https://modern-di.modern-python.org/migration/to-3.x/index.md): Migrating from modern-di 2.x to 3.x - [From that-depends](https://modern-di.modern-python.org/migration/from-that-depends/index.md): Migrating an existing that-depends codebase to modern-di - [From dependency-injector](https://modern-di.modern-python.org/migration/from-dependency-injector/index.md): Migrating an existing dependency-injector codebase to modern-di ## Development - [Contributing](https://modern-di.modern-python.org/dev/contributing/index.md): Contributing guide for local setup and workflow