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.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.11.tar.gz (7.7 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.11-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

dependencies-0.11-py2-none-any.whl (7.2 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for dependencies-0.11.tar.gz
Algorithm Hash digest
SHA256 c3efa0aa02cd1238c4b3e9469f3d98f08ace29656ffee23103e79d535a9fc6e0
MD5 2d96f34b8c4cbe33f1e4f646bcd9cc38
BLAKE2b-256 ab1ac5a8fb1eb0c13e3debb41192f74f31a548fedef6d95678d0ccc5b9229e7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dependencies-0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 8ac0d66b29d06a0dc95d85ad204256cb126b01e46a5534bb8a5a6f0f46964a26
MD5 104e363b58e42940d348ab8bc19ed907
BLAKE2b-256 9a81d24b32d85f068f247f3d9dd5086df922b135a9a445ea955218b11a5fd859

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dependencies-0.11-py2-none-any.whl
Algorithm Hash digest
SHA256 7a28259951ea220283fa479bc098b4bb3e7d0fa855e8755c8d0f83ddc9069c77
MD5 ca7611a5aa9009b8a04b0e7504e7f32b
BLAKE2b-256 d8da43fde1968829b901b20477f4e708ec645890a3921c991a4af57cd05bfdd5

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