Usage scenarios

One service graph across multiple Python entrypoints.

Injex is most useful when application services are reused from more than one place: an API, CLI command, background worker, and test suite.

API
Service layer wiring

Wire repositories, gateways, clients, and use cases once at startup. Handlers resolve or receive application services without owning construction logic.

CLI
Shared command setup

Commands can share settings, API clients, repositories, and services without module-level singletons.

Job
Background workers

Register long-lived clients as singletons and create one scope per job or message for short-lived state.

Test
Temporary overrides

Use override() to replace slow or external services with fakes inside one test block.

Startup validation

Add container.assert_valid() to application startup or CI smoke checks when you want missing registrations and cycles to fail early.

container = build_container()
container.assert_valid()

run_app(container)

These are usage scenarios, not production adoption claims. The docs show where the library fits and where it should stay out of the way.