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.5.0.tar.gz (18.3 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.5.0-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fundi-1.5.0.tar.gz
Algorithm Hash digest
SHA256 f0d40da4234ecf769018ec876474e1e8508c42db7d1a65737d4e3e9d66127037
MD5 c9efbb61894a68c09370c59f3255fc20
BLAKE2b-256 ae2a3f4f215fdb7a8c157a9e87adf97db3ce45bf5b7f50ffbd41164a0217fab2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fundi-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb18da64bbb33ec864cad2cbb4ff8f2874d24415d792e1fef56290d0b22d326b
MD5 6a0049fe44993bdda0f7d274399aaa0b
BLAKE2b-256 09a2c184b11358bb944dbbbf3059257a0da36dba5e852f2c312d9d1016f719ad

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