--- id: rodi version: "2.1.0" license: MIT License Copyright (c) 2018 Roberto Prevato Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) license_treatment: permissive maintenance: active --- # rodi — Implementation of dependency injection for Python 3 License: permissive · Maintenance: active · Downloads: 85.4K/mo ## What it is and what it does Rodi implements a dependency injection container that builds an object graph by inspecting type hints and class annotations at runtime, then generates efficient resolver functions to instantiate services on demand. It supports three service lifestyles: singleton (one instance per container), transient (new instance each time), and scoped (one instance per resolution call). The container is designed to be configured once at application startup and left unchanged during normal execution, making it suitable for web frameworks and other long-running applications. The library operates without requiring changes to existing class source code—it reads constructor signatures and annotations to infer dependencies automatically. It validates the dependency graph when building resolver functions (detecting circular dependencies or missing services upfront), so runtime resolution has minimal overhead. Rodi offers both a generic protocol-based API for swappable DI implementations and a concrete implementation for direct use. Use it for: - Bootstrap a web application with centralized service registration and inject dependencies into request handlers - Build a CLI tool that instantiates command handlers with their required services registered once at startup - Create a plugin architecture where services are registered dynamically and resolved by type when plugins are loaded - Manage database connections, loggers, and configuration objects as singletons across an application - Test application code by registering mock or stub services in place of real implementations ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Rodi is a dependency injection container for Python that resolves and instantiates service dependencies based on type hints, class annotations, or configured names, supporting singleton, transient, and scoped lifestyles. Yes. Rodi is actively maintained, has no external dependencies, supports modern Python versions (3.10+), carries a permissive MIT license, and solves a real problem for applications that need structured dependency management. It is particularly valuable in web frameworks and larger applications where service lifecycle management matters. No known security vulnerabilities. ## Install pip install rodi uv add rodi poetry add rodi ## Installing rodi Before you install: Low friction install with no runtime dependencies. Active maintenance as of 2026-03-08 with 239 repository stars. Supports Python 3.10 through 3.14. License in practice: MIT License permits unrestricted use, modification, and distribution with minimal restrictions—suitable for commercial and proprietary projects. Quickstart: pip install rodi from rodi import Container container = Container() container.register(MyService) service = container.resolve(MyService) Requires Python 3.10 or later. Verify before relying: - Whether type resolution handles forward references and string annotations correctly - Performance characteristics when resolving deeply nested dependency graphs - Compatibility with async/await patterns in service initialization ## Package facts - License: MIT License Copyright (c) 2018 Roberto Prevato Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 85.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dependency injection python, service container type hints, ioc container python, dependency resolution, type-based service registration, singleton transient scoped services, python di framework, dependency-injection, service-container, ioc [View on SkillFed](https://skillfed.io/packages/rodi) · [View on PyPI](https://pypi.org/project/rodi/)