Lagom is a dependency injection container designed to give you 'just enough' help with building your dependencies.
pip install lagomWhat
Lagom is a dependency injection container designed to give you "just enough" help with building your dependencies. The intention is that almost all of your code doesn't know about or rely on lagom. Lagom will only be involved at the top level to pull everything together.
Features
- Type based auto wiring with zero configuration.
- Fully based on types. Strong integration with mypy.
- Minimal changes to existing code.
- Integration with a few common web frameworks.
- Support for async python.
- Thread-safe at runtime
You can see a comparison to other frameworks here
🎉 Version 2.0.0 is now released! 🎉
For users of python 3.7 and above this should require no changes. Full details can be found in the release notes upgrade instructions.
Installation
pip install lagom
# or:
# pipenv install lagom
# poetry add lagom
Note: if you decide to clone from source then make sure you use the latest version tag. The master branch may contain features that will be removed.
For the versioning policy read here: SemVer in Lagom
Usage
Everything in Lagom is based on types. To create an object you pass the type to the container:
container = Container()
some_thing = container[SomeClass]


