A Python dependency injection framework, it's like fastapi.Depends
Project description
py-depends
A lightweight and elegant Python dependency injection framework.
Features
- 🚀 Simple and intuitive API
- 🔄 Support for both sync and async dependencies
- 🏭 Factory pattern support
- 🎯 Type-safe dependency resolution
- 📦 Zero external dependencies
- 🧪 Comprehensive test coverage
Installation
pip install depends-tools
Quick Start
from depends_tools import Depends, inject
# Define a dependency
def get_database():
return "database_connection"
# Use the dependency
@inject
def get_user(db=Depends(get_database)):
return f"User from {db}"
# Resolve dependencies
result = get_user()
print(result) # Output: User from database_connection
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions, please open an issue on GitHub.
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
depends_tools-1.0.1.tar.gz
(7.1 kB
view details)
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 depends_tools-1.0.1.tar.gz.
File metadata
- Download URL: depends_tools-1.0.1.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
121c644e85ccb744f3301938e81e2eddacca69efce83f7b877c38cd1dfbff25f
|
|
| MD5 |
b326df194a326ccd25d65720716442a8
|
|
| BLAKE2b-256 |
69de8068ca54928d133bedf74a16c7bd3cdec5d6e55d7e208c2ddea65252fd8d
|
File details
Details for the file depends_tools-1.0.1-py3-none-any.whl.
File metadata
- Download URL: depends_tools-1.0.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7513a79a3b640591b80fdbeb3bdfad9cbae7443fdbd51050097c628e8e067803
|
|
| MD5 |
4e324e06525203fdf35121717c5671b2
|
|
| BLAKE2b-256 |
b674acf2ab61fb4908e5576238af1d72a90d6f0c22d467e381c61c9dd715bbbc
|