punq
An IOC Container for Python 3.10+
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later (supports up to 3.15).
- 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 · maintenance · safety
(unclear) — 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.
last release 2026-07-03 (42 days) · last repo commit 2026-08-14 · 429 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 105,453 downloads/mo, #12,699 on PyPI
Alternatives
Verify before relying
pip install punq
import punq
container = punq.Container()
container.register("key", instance="value")
result = container.resolve("key")- Actual license terms—metadata shows no SPDX or raw license field despite active development.
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 on this page. Verify before relying on it.
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
punq on PyPI
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.
Requires Python 3.10 or later (supports up to 3.15).
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")
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 the current Python release <4.0,>=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetyping-extensions |
| Maintenance | Actively maintained 42 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 105,453 / month, #12,699 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Topic :: Software Development :: Libraries :: Python Modules |
Evidence: punq-0.8.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “type-safe di framework”
- punqPunq is a dependency injection container for Python that registers…
- injectorInjector is a Python dependency injection framework that…
- fast-dependsFastDepends provides a standalone dependency injection system…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also slack · rodi · dependency-injector · kink · simple-di · dependencies · in-n-out · injector · alluka · pygnuutils