Skip to main content

A dependency injection framework for Python

Project description

import zuice

class BlogPostLister(zuice.Base):
    _fetcher = zuice.dependency(BlogPostFetcher)

    def all(self):
        return ", ".join(post.name for post in self._fetcher.fetch_all())

bindings = zuice.Bindings()
bindings.bind(BlogPostFetcher).to_instance(blog_post_fetcher)

injector = zuice.Injector(bindings)
assert injector.get(BlogPostFetcher) is blog_post_fetcher
injector.get(BlogPostLister) # constructs BlogPostLister using the bound instance of BlogPostFetcher

Project details


Release history Release notifications

This version
History Node

0.3.0

History Node

0.3.0-pre5

History Node

0.3.0-pre4

History Node

0.3.0-pre3

History Node

0.3.0-pre2

History Node

0.3.0-pre1

History Node

0.2.5

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
zuice-0.3.0.tar.gz (10.0 kB) Copy SHA256 hash SHA256 Source None Feb 15, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page