Skip to main content

Dependency Injection for Humans

Project description

Build Status Coverage Status Requirements Status Code Quality Status Python Package Version

Dependency Injection for Humans.

Installation

All released versions are hosted on the Python Package Index. You can install this package with following command.

pip install dependencies

Usage

Dependency injection without dependencies

robot = Robot(
    servo=Servo(amplifier=Amplifier()),
    controller=Controller(),
    settings=Settings(environment="production"))

Dependency injection with dependencies

class Container(Injector):
    robot = Robot
    servo = Servo
    amplifier = Amplifier
    controller = Controller
    settings = Settings
    environment = "production"

robot = Container.robot

License

Dependencies library is offered under LGPL license.

Changelog

0.13 (2016-10-09)

  • Performance improvements.

0.12 (2016-09-29)

  • Allow multiple inheritance for Injector subclasses.

  • Evaluate dependencies once.

  • Add use decorator.

  • Allow nested injectors.

0.11 (2016-08-22)

  • Twelve times speed up.

  • Protect from incorrect operations with attribute assignment.

  • Deny *args and **kwargs in the injectable classes.

  • Classes can be used as default argument values only if argument name ends with _cls.

  • Remove six library from install requires.

0.10 (2016-06-09)

  • Turn into module.

0.9 (2016-06-08)

  • Dependency assignment and cancellation for Injector subclasses.

0.8 (2016-06-05)

  • Correct syntax error for Python 2.6

0.7 (2016-06-04)

  • Raise DependencyError for mutual recursion in constructor arguments and specified dependencies.

  • Show injected dependencies in the dir result.

  • Deny to instantiate Injector and its subclasses.

0.6 (2016-03-09)

  • Deprecate c alias. Use real classes.

  • Allow to use let directly on Injector.

  • Do not instantiate dependencies named with cls at the end.

0.5 (2016-03-03)

  • Avoid attribute search recursion. This occurs with inheritance chain length started at 3 and missing dependency on first level.

  • Add c alias for Injector subclass access.

  • Add let factory to temporarily overwrite specified dependencies.

0.4 (2016-03-03)

  • Detect object.__init__ and skip it in the argument injection.

0.3 (2016-03-02)

  • Deprecate injectable mechanism. Injector may inject any arguments to any classes. Injector now support multiple DI targets. All possible targets now specified in the Injector attributes. Only single base inheritance allowed for Injector subclasses.

0.2 (2016-02-13)

  • Allows to override dependencies specified with Injector by inheritance from this Injector subclass.

0.1 (2016-01-31)

  • Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dependencies-0.13.tar.gz (7.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dependencies-0.13-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

dependencies-0.13-py2-none-any.whl (7.7 kB view details)

Uploaded Python 2

File details

Details for the file dependencies-0.13.tar.gz.

File metadata

  • Download URL: dependencies-0.13.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dependencies-0.13.tar.gz
Algorithm Hash digest
SHA256 87ea47a0a2dabf71b40b7558b023e8a8f49438531694aed01ae6eb5d462f7df0
MD5 673950fe1e5f9fff34e00772f5ab1f63
BLAKE2b-256 2298473e9f56287f8d4d82e07e0010a625654e2fb3a812e4a193cf87753d9de0

See more details on using hashes here.

File details

Details for the file dependencies-0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for dependencies-0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 66d79b20c41bdba019b756fe41ea35d85ba5b70fb2191c24559bd2cc27726a51
MD5 c366edf81db6eca69a8677a5d7704b0b
BLAKE2b-256 06f18cbee046bbcd54bd26acfac06c8159cb6aeeb80191185733440c47aa6fbd

See more details on using hashes here.

File details

Details for the file dependencies-0.13-py2-none-any.whl.

File metadata

File hashes

Hashes for dependencies-0.13-py2-none-any.whl
Algorithm Hash digest
SHA256 0df4a4922d7f8427a82ef2469b2e37f0b9f8583e874cee22b068344f0b742c1a
MD5 73f4ad72ae966c23a21ad70f96c05fdf
BLAKE2b-256 9d322b561405a1c9d92d09119f3cc7bd8e7c52f6767378ac0ca88a1673e23190

See more details on using hashes here.

Supported by

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