{ "info": { "author": "Andreas Lutro", "author_email": "anlutro@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# Diay - a dependency injection library\n\n[![Build Status](https://travis-ci.org/anlutro/diay.py.svg?branch=master)](https://travis-ci.org/anlutro/diay.py)\n[![Latest version on PyPI](https://img.shields.io/pypi/v/diay.svg?maxAge=2592000)](https://pypi.org/project/diay)\n[![Licence](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nDiay is a [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection)/[inversion of control](https://en.wikipedia.org/wiki/Inversion_of_control) library for Python 3.5 and higher. It leverages the type hints introduced in 3.5 to allow you to easily call functions or construct classes that require specific types of objects to function.\n\nAs an extremely basic and somewhat contrived example - the value of the library doesn't really come into play until you have fairly deeply nested dependencies - let's say you want to render a jinja2 template using some data from an API.\n\n```python\ninjector = diay.Injector()\ninjector.set_instance(SomeConfigClass, my_config_object)\n\n@injector.provider\ndef make_jinja_environment() -> jinja2.Environment:\n return jinja2.Environment()\n\n@injector.provider\ndef make_api_client(config: SomeConfigClass) -> some.APIclient:\n return some.APIclient(config.api_token)\n\ndef render(j2env: jinja2.Environment, apiclient: some.APIclient):\n data = apiclient.get('/some/data')\n template = j2env.get_template('some-template.html.j2', data=data)\n return template.render()\n\nhtml = injector.call(render)\n```", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/anlutro/diay.py", "keywords": "dependency injection,inversion of control", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "diay", "package_url": "https://pypi.org/project/diay/", "platform": "", "project_url": "https://pypi.org/project/diay/", "project_urls": { "Homepage": "https://github.com/anlutro/diay.py" }, "release_url": "https://pypi.org/project/diay/0.1.3/", "requires_dist": null, "requires_python": "", "summary": "diay - a dependency injection library", "version": "0.1.3" }, "last_serial": 4111603, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "a0da0d338e9e59ce3755195208d6a396", "sha256": "2d2bb4db3047816af97fbe815ba772381092c9fcc097b271ede2a20d64c7a184" }, "downloads": -1, "filename": "diay-0.1.tar.gz", "has_sig": false, "md5_digest": "a0da0d338e9e59ce3755195208d6a396", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1683, "upload_time": "2018-04-27T10:53:29", "url": "https://files.pythonhosted.org/packages/37/32/1cb16f72eeae1b10043cf493539cb33444bdd28943ca71fc64635eb40a90/diay-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "c73e8dd31e1b5554312c4986f1d76ae5", "sha256": "215f929a764da7726144e37798c5c734b0c5ea5cfd17b86d8cf96eb497c7afe1" }, "downloads": -1, "filename": "diay-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c73e8dd31e1b5554312c4986f1d76ae5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1847, "upload_time": "2018-04-27T11:12:49", "url": "https://files.pythonhosted.org/packages/75/99/4f0a653c5b70daa6bbc4a51793c83723d9d5be22d8d17987b3bd2dc407d3/diay-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "1c1ab84593be374b0f87e853176bf027", "sha256": "45d8802be1539129acab5192b226ff8656bfae8cbb9a7f65e7bf50fdfa7ebbd2" }, "downloads": -1, "filename": "diay-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1c1ab84593be374b0f87e853176bf027", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3730, "upload_time": "2018-04-27T17:41:42", "url": "https://files.pythonhosted.org/packages/be/e2/804cb3ac2f059ed899404c8d495a8da4f9802e93a34e116090cc6841d326/diay-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "45a990d69512777e78c9917e2fc2ee4e", "sha256": "e1f739bb29e7c36d22071fed6843b8ccfc717a015e402bcaa42db2a51e044f4d" }, "downloads": -1, "filename": "diay-0.1.3.tar.gz", "has_sig": false, "md5_digest": "45a990d69512777e78c9917e2fc2ee4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4007, "upload_time": "2018-07-28T12:25:05", "url": "https://files.pythonhosted.org/packages/16/70/3f0ef4762d9576bf7052d51cbbbb11e90b5c8fb5215bdb108d9d88405374/diay-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "45a990d69512777e78c9917e2fc2ee4e", "sha256": "e1f739bb29e7c36d22071fed6843b8ccfc717a015e402bcaa42db2a51e044f4d" }, "downloads": -1, "filename": "diay-0.1.3.tar.gz", "has_sig": false, "md5_digest": "45a990d69512777e78c9917e2fc2ee4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4007, "upload_time": "2018-07-28T12:25:05", "url": "https://files.pythonhosted.org/packages/16/70/3f0ef4762d9576bf7052d51cbbbb11e90b5c8fb5215bdb108d9d88405374/diay-0.1.3.tar.gz" } ] }