awesome-repositories.com
博客
awesome-repositories.com

通过 AI 驱动的搜索,发现最优秀的开源仓库。

探索精选搜索开源替代品自托管软件博客网站地图
项目关于排名机制媒体报道MCP 服务器
法律隐私政策服务条款
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
ets-labs avatar

ets-labs/python-dependency-injector

0
View on GitHub↗
4,805 星标·344 分支·Python·bsd-3-clause·3 次浏览python-dependency-injector.ets-labs.org↗

Python Dependency Injector

This is a dependency injection framework and inversion of control container for Python. It decouples object creation from business logic by managing how services and their dependencies are assembled, delivered, and linked within an application.

The framework is distinguished by its ability to perform automated component wiring, using import hooks and decorators to inject dependencies into functions and classes across different modules. It supports non-blocking flows through an asynchronous dependency resolver and manages the initialization and shutdown sequences of shared external resources as a resource lifecycle manager.

It provides a comprehensive suite of provider types, including singletons, factories, and placeholders, to control object lifetimes and assembly. The system includes capabilities for application configuration management via YAML, JSON, and environment variables, as well as tools for software test isolation through runtime dependency overriding.

Integration utilities are available for bridging managed dependencies into web frameworks, ASGI lifecycles, and event handlers.

Features

  • Dependency Injection - Provides a comprehensive framework for managing object lifecycles and decoupling components through dependency injection.
  • Automated Dependency Wiring - Installs a module loader hook to automatically resolve and wire dependencies when modules are imported into the application.
  • Declarative Registries - Organizes dependency providers as class attributes to decouple object creation from business logic.
  • Asynchronous Dependencies - Resolves dependencies using awaitables to support non-blocking initialization and shutdown of shared resources.
  • Dependency Wiring Hooks - Installs a module loader hook to automatically resolve and inject dependencies when modules are imported.

AI 搜索

探索更多 awesome 仓库

用简单的语言描述您的需求 —— AI 将根据相关性为您从数千个精选开源项目中进行排序。

Start searching with AI
  • Automated Component Wiring - Injects dependencies into functions and classes across modules without manually passing objects through every layer.
  • Dependency Injection Containers - Defines the assembly of services and their dependencies in a central container to decouple object creation from usage.
  • Callable Wiring - Binds container providers to functions or methods across different modules and packages using decorators.
  • Component Wiring - Aggregates multiple package containers into a single application container to resolve dependencies and connect decoupled modules.
  • Structured Provider Containers - Organizes providers as class attributes to create a structured, reusable assembly of dependencies.
  • Dependency Injection Frameworks - Implements inversion of control to manage component dependencies and object lifecycles in Python.
  • Automatic Constructor Injection - Supplies required objects to functions or classes at runtime using markers to eliminate manual instantiation.
  • Dynamic Dependency Overriding - Replaces a provider with another implementation at runtime to facilitate testing with stubs.
  • Factory-Based Instantiation - Creates new object instances by injecting defined dependencies or assigning attributes during initialization.
  • Object Assembly Management - Manages the assembly and linking of objects using diverse provider types to handle complex dependency graphs.
  • Object Lifecycle Management - Manages object instantiation through specific provider types like singletons, factories, and asynchronous coroutines.
  • External Resource Initialization - Manages the setup and teardown of shared external resources, such as connection pools, and injects them into dependent services.
  • Asynchronous Providers - Resolves dependencies asynchronously using await expressions to handle non-blocking object initialization.
  • Inversion-of-Control Containers - Provides a central registry for defining object instantiation and linkage to manage complex dependency graphs.
  • Object Lifetime Management - Controls whether a dependency is created as a new instance every time or as a single shared instance.
  • Resource Lifecycle Managers - Handles the initialization and shutdown of shared components using functions, context managers, or asynchronous initializers.
  • Shared Resource Lifecycles - Coordinates the initialization and shutdown sequences of shared external resources and singletons.
  • Service Instance Managers - Implements singleton management to ensure a single instance of a dependency is returned on all requests.
  • Dependency Mocking - Replaces production dependencies with mocks or alternative implementations during test execution to isolate the system.
  • Execution Scope Resource Management - Initializes and configures shared resources like logging, event loops, or thread pools for specific execution scopes.
  • Scope-Based Resource Cleanup - Provides automated initialization and shutdown of resources when functions are called via function wiring.
  • Dynamic Provider Switching - Selects between different provider implementations at runtime based on a specific configuration value.
  • Configuration Merging - Combines settings from multiple external sources like YAML, JSON, and environment variables into a unified registry.
  • Multi-Container Organization - Allows distributing object assembly across multiple declarative containers to manage complexity in large applications.
  • Package Dependency Decoupling - Defines external dependencies within a package container using placeholders to maintain implementation agnosticism.
  • Provider Lifecycle Management - Manages the reset of singleton instances and copying of container states to control object instantiation.
  • String-Based Class Import - Resolves and instantiates objects using absolute or relative module path strings instead of direct class references.
  • Dependency Argument Injection - Binds a specific function or callable object to a dependency to pass it into other services.
  • Dependency Injection Hooks - Implements import hooks to automatically wire containers to modules as they are dynamically imported.
  • Dependency Placeholders - Uses abstract placeholders to define required dependencies that must be concrete implementations before application assembly.
  • Application Configuration - Loads and injects settings from environment variables, YAML, JSON, or INI files into application components.
  • Callable-Based Resolution - Resolves and provides objects by calling a function or class with specified positional and keyword arguments.
  • Module-Level Injection - Wires specific modules to a container to inject dependencies directly into functions or endpoints.
  • Resolution Verification - Checks if all dependencies in a container are defined or have defaults and raises an error if unresolved.
  • Schema-Based Container Initialization - Builds dependency providers automatically using definitions provided in JSON or YAML schema files.
  • Abstract Dependency Definitions - Creates placeholder factories for base classes that must be overridden with concrete implementations.
  • Dependency Placeholders - Creates placeholders for required objects to ensure provided instances match a specified type.
  • Provider Definition Inheritance - Enables extending existing containers to inherit and reuse dependency definitions while specializing new providers.
  • Provider Delegation - Enables injecting a provider instead of the created object, allowing components to produce new instances on demand.
  • Provider Grouping - Groups several factories under a single provider and selects the active one based on a runtime key.
  • Static Object Injection - Provides mechanisms to inject pre-defined objects or constant values exactly as they are into the dependency graph.
  • Dynamic Assembly Configurations - Provides the ability to determine application structure at runtime via configuration files or external data.
  • Runtime Configuration Overrides - Replaces registered provider implementations at execution time to facilitate mocking and environment-specific configuration.
  • Test Isolation - Allows replacing production service implementations with mocks or stubs during testing to isolate components.
  • Request Context Management - Creates singletons scoped to specific execution contexts to ensure separate instances for each request.
  • Web Framework Integrations - Passes request-scoped resources into handlers, views, and endpoints of web frameworks to simplify dependency management.
  • General Utilities - Framework for managing dependency injection in Python.
  • Star 历史

    ets-labs/python-dependency-injector 的 Star 历史图表ets-labs/python-dependency-injector 的 Star 历史图表

    Python Dependency Injector 的开源替代方案

    相似的开源项目,按与 Python Dependency Injector 的功能重合度排序。
    • jeffijoe/awilixjeffijoe 的头像

      jeffijoe/awilix

      4,088在 GitHub 上查看↗

      Awilix is a JavaScript dependency injection framework and inversion of control container. It provides a centralized system for registering and resolving services, decoupling application components by automating how dependencies are created and passed to the functions or classes that require them. The framework features an automatic module loader that scans the filesystem using glob patterns to register dependencies based on filenames and exports. It supports parameter-name-based injection and proxy-based resolution to manage how dependencies are delivered to constructors and functions. The s

      TypeScriptawilixdependency-injectionioc
      在 GitHub 上查看↗4,088
    • php-di/php-diPHP-DI 的头像

      PHP-DI/PHP-DI

      2,773在 GitHub 上查看↗

      PHP-DI is an inversion of control container designed to manage object lifecycles and dependency resolution within PHP applications. It functions as a centralized registry that automates the wiring of components, allowing for the decoupling of services from their concrete implementations. The library distinguishes itself by utilizing reflection to inspect class constructor signatures, enabling automatic dependency injection without requiring manual configuration for standard scenarios. It supports recursive resolution of dependency graphs and provides mechanisms for lazy object instantiation,

      PHPcontainer-interopdependency-injectionioc
      在 GitHub 上查看↗2,773
    • typestack/typeditypestack 的头像

      typestack/typedi

      4,242在 GitHub 上查看↗

      TypeDI is a TypeScript dependency injection container and inversion of control tool. It functions as a centralized registry and service locator that manages object instantiation and decouples component dependencies using type inference and decorators. The project provides scoped dependency management to isolate service instances within specific contexts, preventing data leakage between different execution flows. It supports flexible service resolution through the use of type-safe tokens and the ability to map unique identifiers or class constructors to specific service instances. The contain

      TypeScriptdependency-injectioninversion-of-controlioc
      在 GitHub 上查看↗4,242
    • autofac/autofacautofac 的头像

      autofac/Autofac

      4,649在 GitHub 上查看↗

      Autofac is a dependency injection framework and inversion of control container for .NET. It functions as a component registration engine that decouples class implementations from their dependencies by injecting required services via constructors or properties. The project includes an assembly scanning library to automatically discover and register components within compiled binaries based on specific type criteria. It provides a service lifetime manager to control object memory duration using singletons, instance-per-dependency, or isolated request scopes. The framework covers a broad range

      C#autofacc-sharpdependency-injection
      在 GitHub 上查看↗4,649
    查看 Python Dependency Injector 的所有 30 个替代方案→

    常见问题解答

    ets-labs/python-dependency-injector 是做什么的?

    This is a dependency injection framework and inversion of control container for Python. It decouples object creation from business logic by managing how services and their dependencies are assembled, delivered, and linked within an application.

    ets-labs/python-dependency-injector 的主要功能有哪些?

    ets-labs/python-dependency-injector 的主要功能包括:Dependency Injection, Automated Dependency Wiring, Declarative Registries, Asynchronous Dependencies, Dependency Wiring Hooks, Automated Component Wiring, Dependency Injection Containers, Callable Wiring。

    ets-labs/python-dependency-injector 有哪些开源替代品?

    ets-labs/python-dependency-injector 的开源替代品包括: jeffijoe/awilix — Awilix is a JavaScript dependency injection framework and inversion of control container. It provides a centralized… php-di/php-di — PHP-DI is an inversion of control container designed to manage object lifecycles and dependency resolution within PHP… typestack/typedi — TypeDI is a TypeScript dependency injection container and inversion of control tool. It functions as a centralized… autofac/autofac — Autofac is a dependency injection framework and inversion of control container for .NET. It functions as a component… derekyrc/mini-spring — mini-spring is a Java dependency injection framework and inversion of control container. It manages the full lifecycle… fuzhengwei/small-spring — Small-Spring is a simplified Java implementation of the Spring framework designed to study the internal architecture…