Metadata-Version: 2.1
Name: fast-depends
Version: 1.0.0
Summary: FastDepends - extracted and cleared from HTTP domain Fastapi Dependency Injection System
Project-URL: Homepage, https://lancetnik.github.io/FastDI/
Project-URL: Documentation, https://lancetnik.github.io/FastDI/
Project-URL: Tracker, https://github.com/Lancetnik/FastDI/issues
Project-URL: Source, https://github.com/Lancetnik/FastDI
Author-email: Pastukhov Nikita <diementros@yandex.ru>
License-File: LICENSE
Keywords: dependency injection,fastapi
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Pydantic
Classifier: Framework :: Pydantic :: 1
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.7
Requires-Dist: anyio
Requires-Dist: pydantic>=1.8
Provides-Extra: dev
Requires-Dist: black>=23.3.0; extra == 'dev'
Requires-Dist: fastdepends[doc]; extra == 'dev'
Requires-Dist: fastdepends[test]; extra == 'dev'
Requires-Dist: isort>=5; extra == 'dev'
Requires-Dist: mypy>=1.1; extra == 'dev'
Requires-Dist: ruff>=0.0.260; extra == 'dev'
Provides-Extra: doc
Requires-Dist: mdx-include<2.0.0,>=1.4.1; extra == 'doc'
Requires-Dist: mkdocs-markdownextradata-plugin<0.3.0,>=0.1.7; extra == 'doc'
Requires-Dist: mkdocs-material<9.0.0,>=8.1.4; extra == 'doc'
Requires-Dist: mkdocstrings[python]>=0.18; extra == 'doc'
Provides-Extra: test
Requires-Dist: asyncmock; python_version < '3.8' and extra == 'test'
Requires-Dist: coverage[toml]>=7.2; extra == 'test'
Requires-Dist: pytest-asyncio>=0.21; extra == 'test'
Requires-Dist: pytest-xdist[psutil]; extra == 'test'
Requires-Dist: pytest>=7; extra == 'test'
Description-Content-Type: text/markdown

# FastDI

---

Documentation: https://lancetnik.github.io/FastDI/

---

FastDI - extracted and cleared from HTTP domain logic Fastapi Dependency Injection System.
This is a little library, providing you ability to use lovely Fastapi interfaces at your own
projects or tools.

Thanks to [*fastapi*](https://fastapi.tiangolo.com/) and [*pytest*](https://docs.pytest.org/en/7.3.x/) projects for this
greate functional. This package just a little change Fasapi sources to provide DI functionality pyre-python way.

## Usage

There is no way to make Dependency Injection easier

You can use this library without any frameworks at **sync** and **async** code both

### Async code
```python
import asyncio

from fastdi import inject, Depends

async def dependency(a: int) -> int:
    return a

@inject
async def main(
    a: int,
    b: int,
    c: int = Depends(dependency)
) -> float:
    return a + b + c

assert asyncio.run(main("1", 2)) == 4.0
```

### Sync code
```python
from fastdi import inject, Depends

def dependency(a: int) -> int:
    return a

@inject
def main(
    a: int,
    b: int,
    c: int = Depends(dependency)
) -> float:
    return a + b + c

assert main("1", 2) == 4.0
```

`@inject` decorator playing multiple roles at the same time:

* resolve *Depends* classes
* cast types according python annotation
* validate incoming parameters using *pydantic*

---

### Features
Syncronous code is fully supported at this package: without any `async_to_sync`, `run_sync`, `syncify` or any another tricks.

Also, *FastDI* casts function return the same way, it can be very felpfull to build your own tools.

There is two main defferences from native Fastapi DI System.

---

### Note
Library was build by actual **0.95.0 FastAPI** version.

If we'll be too far behind, please, contact [me](mailto:diementros@yandex.ru)
or contubute yourself. Really appreciate your help.
