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.0.0.tar.gz (6.9 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.0.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: depends_tools-1.0.0.tar.gz
  • Upload date:
  • Size: 6.9 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.0.0.tar.gz
Algorithm Hash digest
SHA256 99aa3a076d79575440a6fa5b08e65d05ab897680ae7eb5a2ded2a8a37bb6704b
MD5 966116999832dae817a546f8ce73a81a
BLAKE2b-256 2780281ae3cbe18a4d8519d7b0f626a53fe1d6cc06947be2ff40519eb99da606

See more details on using hashes here.

File details

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

File metadata

  • Download URL: depends_tools-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f5e04332570428e7739a4ead976d613c95dcdcfa0c7101f5d42bf75207e2686
MD5 ccc5e618180367030db110d63474ceed
BLAKE2b-256 db024703ef4adb0d7e83f53388cdf1ac2c311eb7eff08b69fc3b954825cdb9bd

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