Runch: refined munch. With generic typing support.
Project description
Runch
Refined munch. Provides basic munch functionality with additional typing support and runtime validation.
Installation
pip install runch
Usage
from runch import RunchModel, RunchConfigReader
class ExampleConfig(RunchModel):
db_host: str
db_port: int
db_user: str
db_password: str
db_name: str
example_config = RunchConfigReader[ExampleConfig].read("example_config_file", "example_config_dir", "yaml")
print(example_config.config.db_host) # with intellicode support & runtime validation
$ touch example_config_dir/example_config_file.yaml
db_host: localhost
db_port: 5432
db_user: user
db_password: password
db_name: database
Model Generator
$ python -m runch <config_name> [config_ext]
Manual:
Generate a model definition from a config file.
config_name: the name of the config file without the extension.
config_ext: the extension of the config file. Default is `yaml`.
Use RUNCH_CONFIG_DIR environment variable to specify the directory of the config files. Default is `./etc`.
Example:
python -m runch my_config
python -m runch my_config yaml
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
runch-1.0.0-py3-none-any.whl
(14.4 kB
view details)
File details
Details for the file runch-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: runch-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.6 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c31ff2b64587c71854a40dfc31c6042d0c12dfe9519e1e371436af74c32d5b54 |
|
MD5 | 40ebb8159e278e2ae90085fdff56f1c3 |
|
BLAKE2b-256 | 51bb570f3a737368d37e706b59cdfa9ccf34f3187856eeb05267e59745bbbdb7 |