TyConf - Type-safe Configuration Management for Python with Value Validation
Project description
TyConf
TyConf ≡ Typed Config - A type-safe configuration management library for Python with runtime validation.
What is TyConf?
TyConf is a modern Python library that makes managing application configuration simple, safe, and intuitive. It provides runtime type validation, value validation, read-only properties, and freeze/unfreeze capabilities to help you build robust applications.
Quick Start
from tyconf import TyConf
from tyconf.validators import range
# Create configuration with type-safe properties and validators
config = TyConf(
host=(str, "localhost"),
port=(int, 8080, range(1024, 65535)), # Validated range
debug=(bool, True)
)
# Access values easily
print(config.host) # 'localhost'
config.port = 3000 # Type-checked and range-validated automatically
Key Features
✅ Type Safety - Runtime type validation with support for Optional and Union types
✅ Value Validation - Built-in validators (range, length, regex, etc.) and custom validation functions
✅ Read-Only Properties - Protect critical configuration from accidental changes
✅ Freeze/Unfreeze - Lock entire configuration to prevent modifications
✅ Intuitive API - Both attribute (config.host) and dict-style (config['host']) access
✅ Copy & Reset - Easily duplicate or restore default configurations
✅ Zero Dependencies - Pure Python with no external requirements
Installation
pip install tyconf
Documentation
- User Guide - Comprehensive guide with all features
- API Reference - Complete API documentation
- Best Practices - Tips for effective usage
Examples
See the examples/ directory for complete examples:
- basic_usage.py - Getting started
- advanced_usage.py - Advanced features
- real_world_app.py - Real-world application configuration
- validation_examples.py - Value validation examples
License
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Links
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
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 tyconf-1.1.0.tar.gz.
File metadata
- Download URL: tyconf-1.1.0.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
213e9cea27c45d03ba66d01271ed94bafd95f9ac35e7e983b16bdb08556875aa
|
|
| MD5 |
c794361769b9920ee0b07ed4696f7f1d
|
|
| BLAKE2b-256 |
60f81d33aa0be0f6766cecec1da7f9e27bc4786bf4454f8fea5ee539dd51e126
|
File details
Details for the file tyconf-1.1.0-py3-none-any.whl.
File metadata
- Download URL: tyconf-1.1.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aadd02aa0f0629ba2cddcb16a48483f9e6f51dda23c681d30bc56e5b7149974c
|
|
| MD5 |
dc8e978cdab7cc87693c79e8bf2972ad
|
|
| BLAKE2b-256 |
aa7584d089ab89b16ed2609bbc05e2ac7700ada80e67b44344177ae78c3a514a
|