{ "info": { "author": "Justin Smith", "author_email": "smith.justin.c@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "SunnyDI IoC Container\n=====================\n\n.. image:: https://img.shields.io/pypi/v/sunnydi.svg\n :target: https://pypi.python.org/pypi/sunnydi\n\n.. image:: https://img.shields.io/pypi/status/sunnydi.svg\n :target: https://pypi.python.org/pypi/sunnydi\n\n.. image:: https://travis-ci.org/thomasstreet/sunnydi.svg?branch=master\n :target: https://travis-ci.org/thomasstreet/sunnydi\n\n.. image:: https://coveralls.io/repos/github/thomasstreet/sunnydi/badge.svg?branch=master\n :target: https://coveralls.io/github/thomasstreet/sunnydi?branch=master\n\n.. image:: https://readthedocs.org/projects/sunnydi/badge/?version=latest\n :target: http://sunnydi.readthedocs.io/en/latest/?sunnydi=latest\n :alt: Documentation Status\n\nSunnyDI is an `IoC container `_ for\nmanaging and injecting dependencies in Python.\n\nIt is inspired by `Autofac `_ for .NET\nand `Guice `_ for java.\n\nHow to Use\n---------------\nFor our example, we will create an IoC module for our HelloService.:\n\n.. code-block:: python\n\n class HelloService(object):\n def hello(self):\n return 'hello'\n\nCreate a new configuration module that extends `sunnydi.ioc.Module`.\nA module defines how objects will be created, destroyed and provided to other object instances in the IoC object graph.\nIn the most simple configuration, we can just bind a string name to our HelloService class type:\n\n.. code-block:: python\n\n class HelloModule(Module):\n def configure(self):\n self.bind('hello_service')\n .to(HelloService)\n\nWe can then create the injector and resolve our HelloService like this:\n\n.. code-block:: python\n\n >>> hello_module = HelloModule()\n >>> injector = hello_module.create_injector()\n >>> hello_service = injector.get('hello_service')\n\n >>> hello_service.hello()\n 'hello'\n\nResolved instances are provided via constructor arguments to consuming classes.\nFor instance, given the following class:\n\n.. code-block:: python\n\n class MyClass(object):\n\n def __init__(self, hello_service):\n self._hello_service = hello_service\n\n def do_hello(self):\n return self._hello_service.hello()\n\nAn instance of `MyClass` can be resolved with an instance of `HelloService` due to\nthe service's binding name matching the parameter defined in the `MyClass` constructor:\n\n.. code-block:: python\n\n >>> my_class_instance = injector.get(MyClass)\n >>> my_class_instance.do_hello()\n 'hello'\n\nFor advanced usage, checkout the `docs `_", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/thomasstreet/sunnydi", "keywords": "alpha development di dependency injection ioc", "license": "Apache License 2.0", "maintainer": null, "maintainer_email": null, "name": "tycoon", "package_url": "https://pypi.org/project/tycoon/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/tycoon/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/thomasstreet/sunnydi" }, "release_url": "https://pypi.org/project/tycoon/0.0.0/", "requires_dist": null, "requires_python": null, "summary": "SunnyDI dependency injection framework", "version": "0.0.0" }, "last_serial": 2894259, "releases": { "0.0.0": [] }, "urls": [] }