Registry / serialization / dependencies

dependencies

JSON →
library7.7.1pypypi✓ verified 84d ago

A Python library for constructor injection designed with OOP in mind. Current version 7.7.1. It uses a simple decorator-based API to inject dependencies into class constructors, supporting type hints and aliases. Release cadence is irregular.

pip install dependencies
INSTALL
IMPORT
SIG · DEPENDENCIES
D
dependencies
serializationpythonv7.7.1
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v7.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Injector
from dependencies import Injector
from dependencies import Inject

Basic dependency injection setup: bind implementations and get instances.

from dependencies import Inject, This, value class Logger: pass class Database: def __init__(self, logger: Logger = This()): self.logger = logger def configure(binder): db = Database() binder.bind(Database, value(db)) binder.bind(Logger, value(Logger())) container = Inject(autoload=False) container.configure(configure) db = container.instance(Database) print(db.logger.__class__.__name__) # Logger
Debug
Known issues
gotchaInject must be used as a class instance, not a decorator. Common mistake: decorating with @Inject instead of instantiating and calling configure.
fix
Use `container = Inject(); container.configure(...)` instead of `@Inject`.
affects: >=7.0.0
breakingIn version 6.x, `Inject` was a decorator. In 7.x, it became a class. Import paths changed.
fix
Use `from dependencies import Inject` (class). Code using `@inject` must be rewritten.
affects: 7.0.0 to present
deprecatedUsing `This()` with non-type-hinted arguments may be deprecated in future versions.
fix
Always provide type hints for parameters using `This()`.
affects: >=7.0.0
gotchaWhen using `autoload=False`, you must explicitly configure all dependencies. Common mistake: forgetting to bind a dependency leads to `DependencyError`.
fix
Bind all dependencies with `binder.bind(...)` inside `configure` function.
affects: >=7.0.0
gotchaCircular dependencies are not detected automatically and cause recursion errors.
fix
Avoid circular references or use lazy injection with `This(lazy=True)`.
affects: >=7.0.0
Upgrade
Version history
7.7.1latest on PyPI · released Nov 24, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
dependencies — pip install dependencies · libregistry