initdi


Nameinitdi JSON
Version 0.19.0 PyPI version JSON
download
home_pagehttps://github.com/antonrh/initdi
SummaryDependency Injection library
upload_time2024-02-22 12:46:33
maintainer
docs_urlNone
authorAnton Ruhlov
requires_python>=3.8,<4.0
licenseMIT
keywords dependency injection dependencies di async asyncio application
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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": "initdi",
    "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/db/74/1d0b9556a9106e446e39c5c68062e5cab64bc637aa7e315c0a7c134fc371/initdi-0.19.0.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.0",
    "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": "70d708f8492a8aa315fdb19b902c4dd00bb36e98d8f79ff74d709caf4a75a4d5",
                "md5": "789194b2ea4a0fcbfc53191dbff74429",
                "sha256": "3a770895568edecd1310d7022ec2be2772591d17f48c85d4ce635d1dea40220b"
            },
            "downloads": -1,
            "filename": "initdi-0.19.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "789194b2ea4a0fcbfc53191dbff74429",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 17437,
            "upload_time": "2024-02-22T12:46:32",
            "upload_time_iso_8601": "2024-02-22T12:46:32.119489Z",
            "url": "https://files.pythonhosted.org/packages/70/d7/08f8492a8aa315fdb19b902c4dd00bb36e98d8f79ff74d709caf4a75a4d5/initdi-0.19.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "db741d0b9556a9106e446e39c5c68062e5cab64bc637aa7e315c0a7c134fc371",
                "md5": "870a3fd2c9796b54c20602aeefd963c3",
                "sha256": "273ef094fc94e498e373f7ff7503b8be381bcfdb47a8332ae82fea93d5f34f4f"
            },
            "downloads": -1,
            "filename": "initdi-0.19.0.tar.gz",
            "has_sig": false,
            "md5_digest": "870a3fd2c9796b54c20602aeefd963c3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 15761,
            "upload_time": "2024-02-22T12:46:33",
            "upload_time_iso_8601": "2024-02-22T12:46:33.768106Z",
            "url": "https://files.pythonhosted.org/packages/db/74/1d0b9556a9106e446e39c5c68062e5cab64bc637aa7e315c0a7c134fc371/initdi-0.19.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-22 12:46:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "antonrh",
    "github_project": "initdi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "initdi"
}
        
Elapsed time: 0.20630s