skillfed

pinject

A pythonic dependency injection library

pinject v0.14.1 125.2K downloads/30d#11,834 on PyPI1,342
Permissive license Apache License 2.0 Abandoned released

What it is and what it does

Pinject is a dependency injection library designed to make object graph assembly straightforward and pythonic. It automatically creates bindings between constructor argument names and class names by following PEP8 conventions—converting CamelCase class names to snake_case argument names—so you can instantiate complex object hierarchies with a single call to new_object_graph() and provide(), without decorators or explicit configuration.

The library depends on six and decorator for compatibility and function wrapping. It includes convenience decorators like @copy_args_to_internal_fields to reduce boilerplate in __init__ methods. However, the project has been archived since 2021 and receives no active maintenance, so it is no longer under active development or receiving updates.

Use it for:

  • Assemble complex object graphs in application startup without writing factory methods or configuration code
  • Build modular Python applications where components are automatically wired based on constructor signatures
  • Reduce boilerplate in __init__ methods using @copy_args_to_internal_fields for classes with many dependencies
  • Prototype or develop applications where implicit binding conventions match your code structure

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Pinject is a dependency injection library that automatically assembles object graphs by matching constructor argument names to class names, eliminating the need for decorators or explicit configuration.

No. While Pinject is a well-designed, low-friction dependency injection library with permissive licensing and no known vulnerabilities, the project is archived and unmaintained since 2021. For new projects, use an actively maintained alternative like dependency-injector or injector. For existing codebases already using Pinject, it remains functional but will not receive bug fixes or security updates.

Install

pinject on PyPI

pip

pip install pinject

uv

uv add pinject

poetry

poetry add pinject

Installing pinject

Before you install

Low friction installation with only two lightweight runtime dependencies (six and decorator). However, the project is archived and has not been updated since 2019, with the last commit in March 2021, so it receives no active maintenance.

License in practice

Licensed under Apache License 2.0 (permissive), allowing use in commercial and private projects with minimal restrictions, though you should include a copy of the license and note any modifications.

Quickstart

pip install pinject

import pinject

class InnerClass:
    def __init__(self):
        self.value = 42

class OuterClass:
    def __init__(self, inner_class):
        self.inner_class = inner_class

obj_graph = pinject.new_object_graph()
outer = obj_graph.provide(OuterClass)
print(outer.inner_class.value)

Verify before relying

  • Whether the package works reliably with modern Python versions (3.9+) given its age and lack of maintenance
  • Compatibility with current versions of runtime dependencies six and decorator
  • Whether the archived repository will accept bug reports or security fixes

Package facts

License Apache License 2.0 (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 2 — six, decorator
Maintenance abandoned — 2,638 days since the last release
Last repo commit (repository archived)
First released
Downloads 125,167/month — #11,834 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pinject-0.14.1-py3-none-any.whl

Tags

dependency injection pythonobject graph assemblyautomatic dependency resolutionpythonic DI frameworkconstructor injection libraryimplicit binding injectionobject instantiation framework
dependency-injectionarchived

More Application Frameworks packages