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 | 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
zuice-0.3.0.tar.gz
(10.0 kB
view details)
File details
Details for the file zuice-0.3.0.tar.gz
.
File metadata
- Download URL: zuice-0.3.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
9bf8a82bb46b7f6454bfee20291125e620cb89b9d02f182840c68c7ff5301b40
|
|
MD5 |
7f5514a3cad8b4cf7db33c39f9897454
|
|
BLAKE2b-256 |
10b1a6b02c683939462670060a8f21dda3518e08811674f40062fcdecc5c039a
|