How maldoinc/wireup works
Project Type and Purpose
• This is a Python library (Wireup) providing a dependency-injection (DI) framework for Python 3.8+.
• It is framework-agnostic but offers built-in integrations for FastAPI, Django, Flask and AIOHTTP.
• Primary use case: allow authors to declare & manage services (singletons, scoped, transient) and inject them into applications or functions in a type-safe, performant way.
File Structure Analysis
• Top-level artifacts:
• Makefile, tox.ini, GitHub Actions workflows (.github/workflows) for CI and coverage.
• pyproject.toml for packaging.
• readme.md & docs/ for user documentation (MkDocs).
• test/ for unit and integration tests.
• wireup/ containing the library’s source code.
• Library internals (wireup/):
• _annotations, _decorators, _discovery, errors.py – core DI constructs.
• integration/ – adapters for FastAPI, Django, Flask, AIOHTTP.
• ioc/ – service registry, container implementations (sync/async), override manager, parameter handling, validation.
• Tests mirror integrations and core functionality:
• test/unit – core container, binding, override, scope.
• test/integration – sample apps per framework verifying DI behavior.
README Insights
• Emphasizes key DI features: simple service decorator, function injection, abstract interfaces, managed lifetimes, sync/async factory support, safety via static checks.
• Shows code snippets for service registration, container creation, function injection, overriding for tests, framework setup.