Skip to main content

Lagom, a type based dependency injection container

Project description

Lagom - Dependency injection container

Build Status Scrutinizer Code Quality Code Coverage PyPI Downloads

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]

Full docs here here

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

lagom-0.19.0.tar.gz (23.6 kB view hashes)

Uploaded Source

Built Distribution

lagom-0.19.0-py2.py3-none-any.whl (22.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page