Dependency Injection Library
Project description
Fast Dependency
Installation
pip install fastdependency
Usage
from fastdependency import Container, Depends
# Define your default global container class.
class MyContainer(Container):
def lock_password(self) -> str:
return "123**456"
# Create an instance of your container and set it as default.
Container.set_default_container(MyContainer())
def username() -> str:
return 'mahdi'
def my_function(
param: int,
username=Depends(username), # Gets it from function.
password=Depends('lock_password'), # Gets it from container.
):
print(param)
print(username)
print(password)
my_function(12)
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
fastdependency-0.1.0.tar.gz
(2.9 kB
view details)
Built Distribution
File details
Details for the file fastdependency-0.1.0.tar.gz
.
File metadata
- Download URL: fastdependency-0.1.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.1 Linux/6.2.0-36-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f3040c690c3ebc12972cad0aeedc148cb7e92d694629f622984097463db9a95 |
|
MD5 | 9ad6f19938056dba452428b5a9d66481 |
|
BLAKE2b-256 | eb830c35bb6c7e47439b41838956ae8de60dcc581045bf8dee157933f45edafc |
File details
Details for the file fastdependency-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: fastdependency-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.1 Linux/6.2.0-36-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7228702e6b388ff1de1ac8f233ef1c53d1560d2e6b6865f39ad09f7b74fb2c83 |
|
MD5 | fb5bd3e4dc5e841f27f65d2d37c91e59 |
|
BLAKE2b-256 | 448552b7640bcbeea554ce130d0549310a100c9020c9182f0a76d0f918f33fd7 |