-
Notifications
You must be signed in to change notification settings - Fork 1
Home
github-actions[bot] edited this page May 12, 2026
·
7 revisions
PyJeb is a lightweight Python library to validate and variabilize configuration files.
It lets you define a control schema describing the expected structure of any YAML or JSON configuration, then applies it to validate values, inject defaults, and resolve variables — all in one call.
- Validate configuration structure: required fields, types, format, allowed values
- Set default values for optional fields
- Inject dynamic values: system variables, user variables, custom functions
- Case-insensitive parameter matching
- Expose configuration as an attribute-accessible Python object
pip install pyjeb- Write your configuration file (YAML or JSON)
- Define a control list describing expected fields
- Call
control_and_setup
The following example validates and enriches data ingestion job configurations loaded from a YAML file.
import yaml
from pyjeb import control_and_setup
with open("job.yaml") as f:
config = yaml.safe_load(f)
controls = [
{ "name": "source", "type": "dict" },
{ "name": "source.path" },
{ "name": "source.format", "validset": ["csv", "json", "parquet"] },
{ "name": "source.pattern", "default": "*" },
{ "name": "target", "type": "dict" },
{ "name": "target.path" },
{ "name": "target.mode", "default": "append", "validset": ["append", "overwrite"] },
{ "name": "enabled", "type": "boolean", "default": True },
{ "name": "max_retries", "type": "integer", "default": 3 },
{ "name": "threshold", "type": "decimal", "default": 0.95 },
{ "name": "tags", "type": "list", "default": [] },
]
variables = { "env": "prod" }
for job_name, job_config in config.items():
job = control_and_setup(job_config, controls, variables=variables, to_object=True)
print(f"{job_name}: {job.source.path}")| Page | Description |
|---|---|
| Getting Started | Step-by-step guide with a full working example |
| control_and_setup | API reference for the main function |
| Controls — Overview | All control fields and their purpose |
| Controls — Types | Supported types and type casting |
| Controls — Validset | Restrict values to an allowed set |
| Controls — Regex | Validate values against a regular expression |
| Controls — Expressions | Conditional value mapping with expressions |
| Controls — Conditional Controls | Dynamic control rules with if blocks |
| Variables — Overview | Introduction to the variable system |
| Variables — System | Built-in $sys.timestamp and $sys.date
|
| Variables — User | Custom $var.<name> variables |
| Variables — Functions | Custom $func.<name> functions |
| Exceptions | Error types and when they are raised |