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.0a0.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.0a0.tar.gz.
File metadata
- Download URL: skuf-0.2.0a0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.8 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdef5a33c9736a40793f880a51f7707b3e4e22ace785e58ac63873a669668ddb
|
|
| MD5 |
b486a3d5446618b8d3762526cf148574
|
|
| BLAKE2b-256 |
14a3b00216a12c61b164302f5d5d83c8f1b7916ac250d01d7339639e8e3a2e9b
|
File details
Details for the file skuf-0.2.0a0-py3-none-any.whl.
File metadata
- Download URL: skuf-0.2.0a0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.8 Darwin/24.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56b416cd2de1396525a631e4f661dedb7c8d80d08e8211d3abed93d70b5e8281
|
|
| MD5 |
306bd12215c2bbb1af9301c64a3f5bbf
|
|
| BLAKE2b-256 |
b50720bdc9ed57b00af8c5faa708ff37bf2348f146d97783d71fb655203f551c
|