# InitDI
> [!IMPORTANT]
> `initdi` previously known as `pyxdi` has been renamed to `initdi` and is now available on PyPI.
> Please `initdi` package instead of `pyxdi` for the latest version and updates.
`InitDI` is a modern, lightweight and async-friendly Python Dependency Injection library that leverages type annotations ([PEP 484](https://peps.python.org/pep-0484/))
to effortlessly manage dependencies in your applications.
[![CI](https://github.com/antonrh/initdi/actions/workflows/ci.yml/badge.svg)](https://github.com/antonrh/initdi/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/antonrh/initdi/branch/main/graph/badge.svg?token=67CLD19I0C)](https://codecov.io/gh/antonrh/initdi)
[![Documentation Status](https://readthedocs.org/projects/initdi/badge/?version=latest)](https://initdi.readthedocs.io/en/latest/?badge=latest)
---
Documentation
http://initdi.readthedocs.io/
---
## Requirements
Python 3.8+
and optional dependencies:
* [anyio](https://github.com/agronholm/anyio) (for supporting synchronous resources with an asynchronous runtime)
## Installation
Install using `pip`:
```shell
pip install initdi
```
or using `poetry`:
```shell
poetry add initdi
```
## Quick Example
*app.py*
```python
from initdi import dep, InitDI
di = InitDI()
@di.provider(scope="singleton")
def message() -> str:
return "Hello, world!"
@di.inject
def say_hello(message: str = dep) -> None:
print(message)
if __name__ == "__main__":
say_hello()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/antonrh/initdi",
"name": "pyxdi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "dependency injection,dependencies,di,async,asyncio,application",
"author": "Anton Ruhlov",
"author_email": "antonruhlov@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/8e/2a/a7890f556baf0a7cf42471cd2d1d20d306db4efab0169c678c64134b0cc6/pyxdi-0.19.1.tar.gz",
"platform": null,
"description": "# InitDI\n\n> [!IMPORTANT]\n> `initdi` previously known as `pyxdi` has been renamed to `initdi` and is now available on PyPI.\n> Please `initdi` package instead of `pyxdi` for the latest version and updates.\n\n\n`InitDI` is a modern, lightweight and async-friendly Python Dependency Injection library that leverages type annotations ([PEP 484](https://peps.python.org/pep-0484/))\nto effortlessly manage dependencies in your applications.\n\n[![CI](https://github.com/antonrh/initdi/actions/workflows/ci.yml/badge.svg)](https://github.com/antonrh/initdi/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/antonrh/initdi/branch/main/graph/badge.svg?token=67CLD19I0C)](https://codecov.io/gh/antonrh/initdi)\n[![Documentation Status](https://readthedocs.org/projects/initdi/badge/?version=latest)](https://initdi.readthedocs.io/en/latest/?badge=latest)\n\n---\nDocumentation\n\nhttp://initdi.readthedocs.io/\n\n---\n\n## Requirements\n\nPython 3.8+\n\nand optional dependencies:\n\n* [anyio](https://github.com/agronholm/anyio) (for supporting synchronous resources with an asynchronous runtime)\n\n\n## Installation\n\nInstall using `pip`:\n\n```shell\npip install initdi\n```\n\nor using `poetry`:\n\n```shell\npoetry add initdi\n```\n\n## Quick Example\n\n*app.py*\n\n```python\nfrom initdi import dep, InitDI\n\ndi = InitDI()\n\n\n@di.provider(scope=\"singleton\")\ndef message() -> str:\n return \"Hello, world!\"\n\n\n@di.inject\ndef say_hello(message: str = dep) -> None:\n print(message)\n\n\nif __name__ == \"__main__\":\n say_hello()\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Dependency Injection library",
"version": "0.19.1",
"project_urls": {
"Homepage": "https://github.com/antonrh/initdi",
"Repository": "https://github.com/antonrh/initdi"
},
"split_keywords": [
"dependency injection",
"dependencies",
"di",
"async",
"asyncio",
"application"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2ee9b2dd556166c0733e62385d425f587f9f90002cd88642d1e0698b5d3b8050",
"md5": "011831bd93126569460c161e22190ca9",
"sha256": "8b4743e291672462bf62caa80beb21b725c77408e024259849c0bce9702942dd"
},
"downloads": -1,
"filename": "pyxdi-0.19.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "011831bd93126569460c161e22190ca9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 17430,
"upload_time": "2024-02-22T12:52:33",
"upload_time_iso_8601": "2024-02-22T12:52:33.844489Z",
"url": "https://files.pythonhosted.org/packages/2e/e9/b2dd556166c0733e62385d425f587f9f90002cd88642d1e0698b5d3b8050/pyxdi-0.19.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8e2aa7890f556baf0a7cf42471cd2d1d20d306db4efab0169c678c64134b0cc6",
"md5": "8557c0b85ef57b644862ca59f70dd8a6",
"sha256": "ec7ed9ac32234b9e80ac66452550eb63aac5cc46f64dc2c1130e522f7bacb434"
},
"downloads": -1,
"filename": "pyxdi-0.19.1.tar.gz",
"has_sig": false,
"md5_digest": "8557c0b85ef57b644862ca59f70dd8a6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 15770,
"upload_time": "2024-02-22T12:52:36",
"upload_time_iso_8601": "2024-02-22T12:52:36.039078Z",
"url": "https://files.pythonhosted.org/packages/8e/2a/a7890f556baf0a7cf42471cd2d1d20d306db4efab0169c678c64134b0cc6/pyxdi-0.19.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-22 12:52:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "antonrh",
"github_project": "initdi",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyxdi"
}