Skip to main content

Dependency injection library

Project description

FunDI logo

# 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 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/stable/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fundi-1.4.0.tar.gz (38.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fundi-1.4.0-py3-none-any.whl (43.5 kB view details)

Uploaded Python 3

File details

Details for the file fundi-1.4.0.tar.gz.

File metadata

  • Download URL: fundi-1.4.0.tar.gz
  • Upload date:
  • Size: 38.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.8

File hashes

Hashes for fundi-1.4.0.tar.gz
Algorithm Hash digest
SHA256 348271db5ad6add0274af7dd2c97b4909d50095639289d0696a8e8692460c548
MD5 d6968dc7608d41a0c631bd84b940df05
BLAKE2b-256 2bed795750ee4487803447c2f18bd55380060e87a1d71a1a40a128b4316006c3

See more details on using hashes here.

File details

Details for the file fundi-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: fundi-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 43.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.8

File hashes

Hashes for fundi-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3f2df9231b8299c06f41eb40022208ea5a49b6a07b82c3650406358beb4fead
MD5 0cf7674a725fe535237f2675d54e4ed5
BLAKE2b-256 9072c6cc3307d59cf4aa2f55938b720f4508c9dbbcfeece873ee6d0ac2bd860b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page