Minimal Dependency Injection & Configuration Framework for Python
Project description
Skuf
Minimal Dependency Injection & Configuration Framework for Python
🚀 Features
- ⚡️ Lightweight and zero-dependency
- 🧩 Simple Dependency Injection container
- 🔐 Type-safe
.env-based configuration loader (likepydantic.BaseSettings) - 🧱 Suitable for scripts, CLI tools, microservices
📦 Installation
pip install skuf
🧰 Dependency Injection
from skuf import DIContainer, Dependency
# Define a Logger
class Logger:
def log(self, msg: str):
print(msg)
DIContainer.register(Logger) # Register the class
logger = DIContainer.resolve(Logger)
def test_func(logger = Dependency(Logger)):
logger.log("Hello, World! From a function!")
logger.log("Hello, World!")
test_func()
# Output:
# Hello, World!
# Hello, World! From a function!
⚙️ Environment Settings
# .env
API_KEY=supersecret
TIMEOUT=5
DEBUG=true
RETRIES=3
ADMINS=123|456
# settings.py
from skuf import BaseSettings
from typing import List
class Settings(BaseSettings):
api_key: str
timeout: int
debug: bool
retries: int
admins: List[int]
settings = Settings()
print(settings.api_key) # supersecret
print(settings.timeout) # 5
print(settings.debug) # True
print(settings.admins) # [123, 456]
✅ Supports types:
- str, int, float, bool
- List[str], List[int], List[float] (via pipe-separated values like A|B|C)
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
skuf-0.2.1a0.tar.gz
(4.9 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 skuf-0.2.1a0.tar.gz.
File metadata
- Download URL: skuf-0.2.1a0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53f0572d983c4a2af2ae9c9bc81243dd4e0b7b86296481db58eb4eb9bd8e2403
|
|
| MD5 |
5f7870cde457e0e428d7b645f7e61763
|
|
| BLAKE2b-256 |
461184ad5b3202a06f1d55109849a7833954493bf82ca568d76d4d8583326499
|
File details
Details for the file skuf-0.2.1a0-py3-none-any.whl.
File metadata
- Download URL: skuf-0.2.1a0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddfc8c1d30dc41cf2f8ae622fed8f1dd4dd97593fff963d2a0ababa077fc62b8
|
|
| MD5 |
f5b16515edcdc615755c7dfadb6d188b
|
|
| BLAKE2b-256 |
ef5cb5c17762ca0d07a6d02662eaa45160f59d1eec06790baabf4cdeb388ab32
|