Skip to main content

Dependency Inversion Principle in Python

Project description

Dependency inversion is essential for writing testable, modular and reusable
libraries.

Dippy makes dependency inversion easier in Python.

--------------------------------------------------------------------------------
links
--------------------------------------------------------------------------------

dippy website:
http://code.google.com/p/dippy/

about dependency inversion:
http://stevewedig.com/dependency_inversion

--------------------------------------------------------------------------------
overview
--------------------------------------------------------------------------------

Interface
A set of required attribute names.

Component
An object fulfilling a specific Interface.

Library
A function that generates Components fulfilling a specific Interface.
(A Library's inputs are its dependencies, much like a module's static imports)

Env
A unique mapping from Interface to Component.

Dependency Interface Annotation
Specifying the expected Interface for each of a library's dependencies.

Dependency Adaptation
If a library's dependency interfaces are annotated, then instead of manually
passing the dependencies into the library, a client can provide an Env that
contains components matching those interfaces. This relieves the client of
knowing how to manually gather all of the dependencies.

--------------------------------------------------------------------------------
examples
--------------------------------------------------------------------------------

1) a thoroughly commented unit test running through most of Dippy's API:
Dippy/dippy/test_cheatsheet.py

2) an example image search project structured with Dippy:
Dippy/dippy/example/example.txt

3) the rest of Dippy's unit tests document expected behavior

--------------------------------------------------------------------------------
project conventions
--------------------------------------------------------------------------------

s instead of self
x__y is a mapping from x to y
underscore, not camel case
2 spaces for indentation
spaces around operators
space after ([{, and before )]}

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

dippy-0.1.0.tar.gz (16.8 kB view details)

Uploaded Source

File details

Details for the file dippy-0.1.0.tar.gz.

File metadata

  • Download URL: dippy-0.1.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dippy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e6f3af33bc0c8d19f6701219baf6a0873ea150e0359eed2a7a99ae06188a532b
MD5 97b18ce24e38ec4997a422644a0e0b14
BLAKE2b-256 650621b575320b150d0af8e65460d62ebd2cdf9dab9b96a3459ae1f43f58cc0c

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