Dependency injection library
Project description
# FunDI
Solution for problem no one had before
Fun stays for function(or for fun if you wish) and DI for Dependency Injection
This library provides fast(to write!) and convenient(to use!) Dependency Injection for functional programming on python.
Why?
This library was inspired by FastAPI's dependency injection. The reasons for its existence are simple:
- A standalone dependency injection library. DI shouldn't be tied to a specific framework.
- It simplifies code writing. Dependency injection reduces boilerplate and improves maintainability.
- Lack of DI libraries for functional programming in Python. Or maybe I just didn't want to find one :3
No more words, let's try!
from contextlib import ExitStack
from fundi import scan, from_, inject
def require_user():
return "Alice"
def greet(user: str = from_(require_user)):
print(f"Hello, {user}!")
inject({}, scan(greet))
See the documentation to get more examples: https://fundi.readthedocs.io/en/latest/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fundi-1.3.6.tar.gz.
File metadata
- Download URL: fundi-1.3.6.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcd61dbef355cf45287162181baebb456291718920a89e2346564267982b5ec2
|
|
| MD5 |
949427ab3433585ebb5edb479aaeafd4
|
|
| BLAKE2b-256 |
da3f35583697c59df99916feeeea7ed7fc7c3e7fde5dc1b2d7231c538382eb83
|
File details
Details for the file fundi-1.3.6-py3-none-any.whl.
File metadata
- Download URL: fundi-1.3.6-py3-none-any.whl
- Upload date:
- Size: 41.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c424150646136f18c26fe5ad932e3b5f99d144bde742070c59632829dcec4020
|
|
| MD5 |
423f781100a17d0fb9f8341ba8270066
|
|
| BLAKE2b-256 |
c7eb535e80e962e688d158678086ecffb4fc094bc707f77318fa45931b6fd667
|