--- id: punq version: "0.8.0" license: unclear license_treatment: unclear maintenance: active --- # punq — An IOC Container for Python 3.10+ License: unclear · Maintenance: active · Downloads: 105.5K/mo ## What it is and what it does Punq is a lightweight inversion-of-control container that manages object construction and dependency injection in Python applications. It lets you register service implementations against abstract types or keys, then resolve them on demand with automatic recursive dependency injection—all without global state, decorators, or unusual syntax. The library is designed to work cleanly with type checkers like mypy and pyright in strict mode. You create a container at your application's entry point, register your services and their implementations, and then resolve them when needed. Punq handles nested dependencies automatically: if a registered class depends on another registered service, Punq injects it. You can register instances, classes, or provide constructor arguments at registration or resolution time. The library is small, well-tested, and intentionally simple to understand. Use it for: - Wire up application services in a web framework or CLI tool without global state or service-locator antipatterns. - Manage database connections, configuration readers, and other shared resources as singleton or transient instances. - Test code by registering mock implementations of services without modifying production code. - Build modular applications where components declare their dependencies through constructor parameters. - Integrate with type checkers to catch missing or mismatched dependencies at development time. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Punq is a dependency injection container for Python that registers and resolves object dependencies without global state, decorators, or special syntax. Yes. Punq is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a real problem—dependency injection without magic or global state. The only caveat is the unclear license: verify the actual license terms before committing to a production dependency, but the library itself is sound and well-designed. ## Install pip install punq uv add punq poetry add punq ## Installing punq Before you install: Low install friction; single pure-Python wheel with only typing-extensions as a runtime dependency. Active maintenance with a release 42 days ago and last commit on 2026-08-14. License in practice: License treatment is unclear—no SPDX identifier or raw license text is recorded in the metadata. Verify the actual license before use in proprietary or restricted contexts. Quickstart: pip install punq import punq container = punq.Container() container.register("key", instance="value") result = container.resolve("key") Requires Python 3.10 or later (supports up to 3.15). Verify before relying: - Actual license terms—metadata shows no SPDX or raw license field despite active development. ## Package facts - License: not declared (unclear) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 105.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dependency injection container python, ioc container python, service locator python, object dependency resolution, type-safe di framework, lightweight di library, python inversion of control, dependency-injection, ioc-container, type-safe [View on SkillFed](https://skillfed.io/packages/punq) · [View on PyPI](https://pypi.org/project/punq/)