🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

zuice

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zuice

A dependency injection framework for Python

0.3.0
PyPI
Maintainers
1

Zuice: dependency injection for Python

Example

.. code-block:: python

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

Keywords

dependency injection di

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts