--- id: kink version: "0.9.0" license: MIT license_treatment: permissive maintenance: active --- # kink — Dependency injection for python. License: permissive · Maintenance: active · Downloads: 132.7K/mo ## What it is and what it does Kink is a dependency injection container that manages object creation and dependency resolution for Python applications. It allows you to register services (either eagerly or on-demand) in a central container and then automatically inject them into classes and functions via the @inject decorator. The container supports both name-based and type-annotation-based dependency matching, with a clear priority system: manually passed arguments override name matches, which override type annotations. The package solves the problem of tightly coupled code by letting you define dependencies externally rather than hardcoding them. It supports factories (services created fresh on each request), lazy initialization via lambdas, and async operations. With only typing_extensions as a dependency, it integrates cleanly into modern Python projects supporting versions 3.8 through 3.14. Use it for: - Bootstrap configuration and database connections at startup, then inject them throughout your application without passing through signatures. - Build testable class hierarchies by injecting mock implementations in tests while using real implementations in production. - Create plugin or factory patterns where the container automatically instantiates the correct implementation based on type annotations. - Manage async service initialization and lifecycle in asyncio-based applications without manual state management. - Reduce boilerplate in multi-layer applications by letting the container wire dependencies automatically. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Kink is a lightweight dependency injection container for Python that automatically resolves and injects dependencies into classes and functions using decorators and type annotations. Yes. Kink is a solid choice for Python projects that want dependency injection without heavyweight frameworks. It has low install friction, active maintenance, no known vulnerabilities, a permissive MIT license, and broad Python version support. Use it when you want to decouple components and improve testability without adopting a full web framework. ## Install pip install kink uv add kink poetry add kink ## Installing kink Before you install: Installation is straightforward with low friction—a pure Python wheel with only typing_extensions as a runtime dependency. The project is actively maintained with a recent release on 2026-03-19 and shows healthy repository signals. License in practice: MIT license is permissive, allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects. Quickstart: pip install kink from kink import di, inject from typing_extensions import Annotated di["config"] = {"db": "test.db"} di["db_connection"] = lambda di: f"Connection to {di['config']['db']}" @inject class UserService: def __init__(self, db_connection: str): self.db = db_connection service = di[UserService] print(service.db) Verify before relying: - Whether async/await support works with all Python versions listed (3.8–3.14) or has version-specific limitations - Performance characteristics when managing large numbers of services or deeply nested dependency graphs - How custom dependency resolvers integrate with the autowiring mechanism in practice ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 132.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dependency injection container python, autowiring dependency resolver, inversion of control container, service locator pattern, python di framework, automatic dependency resolution, decorator-based injection, dependency-injection, inversion-of-control, autowiring [View on SkillFed](https://skillfed.io/packages/kink) · [View on PyPI](https://pypi.org/project/kink/)