Lagom, a type based dependency injection container
Project description
Lagom - Dependency injection container
What
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.
Installation
pip install lagom
# or:
# pipenv install lagom
# poetry add 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]
Developing/Contributing
Contributions and PRS are welcome. For any large changes please open an issue to discuss first. All PRs should pass the tests, type checking and styling. To get development setup locally:
make install # sets up the pipenv virtualenv
then
make format # To format the code
make test # To make sure the build will pass
Versioning - Semver
This library follows semver as closely as possible (mistakes may occur).
The public interface is considered to be everything in lagom.__all__
. Anything
else is considered an internal implementation detail.
The lagom.experimental
module is an exception to this. This is a place
for new code to be released. The public interface of this code may change
before it settles down and gets moved out of the experimental module.
Design Goals
- The API should expose sensible typing (for use in pycharm/mypy)
- Everything should be done by type. No reliance on names.
- All domain code should remain unmodified. No special decorators.
- Usage of the container should encourage code to be testable without monkey patching.
- Usage of the container should remove the need to depend on global state.
- Embrace modern python features (3.7 at the time of creation)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for lagom-0.19.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20b76bbfe97554aa1bf2a2c68909a6009f5859d5cbfa6d673d6aef79f341bd60 |
|
MD5 | cd4d096d924ade8898cb2b748e08db46 |
|
BLAKE2b-256 | 9e25e01f283c09183ce458fcff6671bf84958475a9efccfb1f0483f4e088d509 |