Skip to main content

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


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.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

depends_tools-1.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file depends_tools-1.1.0.tar.gz.

File metadata

  • Download URL: depends_tools-1.1.0.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

Hashes for depends_tools-1.1.0.tar.gz
Algorithm Hash digest
SHA256 11facfac35276654d852e5bb0171715db03abbc51d6a823794439c0f24549a45
MD5 ddbf359002e7c7ff7ec730af63a29a0b
BLAKE2b-256 f5157842d3da14a189b83e0d0016b2e66ec2918b10022d696025422365e1f54c

See more details on using hashes here.

File details

Details for the file depends_tools-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: depends_tools-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for depends_tools-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d41bb2c77ddf5808edd37480ab298aea6014dbdcb2e38fb3463c93b5303d725a
MD5 28118f1a218f9f3ff2a28328284b7c18
BLAKE2b-256 c0a364285b9539be870453ec3b1850f0ed57c305e065c6954f1baabaf90782ca

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