Skip to main content

A powerfull lightweight library to check and variabilize your configuration files

Project description

PyJeb

PyJeb is a lightweight Python library to validate and variabilize your configuration files.

  • 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

Installation

pip install pyjeb

Quick example

job.yaml

ingest_customers:
  source:
    path: "/landing/$var.env/customers/$sys.timestamp('YYYY-MM-DD')"
    format: "csv"
  target:
    path: "/bronze/$var.env/customers"

ingest_orders:
  source:
    path: "/landing/$var.env/orders/$sys.timestamp('YYYY-MM-DD')"
    format: "json"
  target:
    path: "/bronze/$var.env/orders"
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 },
]

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}{job.target.path}")

Output (run on 2026-05-11):

ingest_customers: /landing/prod/customers/2026-05-11 → /bronze/prod/customers
ingest_orders: /landing/prod/orders/2026-05-11 → /bronze/prod/orders

Documentation

Full documentation is available on the GitHub wiki.

Output of the script

--------------- HR - Employees
source.path = '/Landing/HR/Employees/2023-12-14'
source.pattern = '*.csv'
target.path = '/Bronze/HR/Employees'
--------------- HR - Managers
source.path = '/Landing/HR/Managers/2023-12-14'
source.pattern = '*'
target.path = '/Bronze/HR/Managers'
--------------- HR - Payroll
source.path = '/Landing/HR/Payroll/2023-12-14'
source.pattern = '*'
target.path = '/Bronze/HR/Payroll'

control_and_setup function

The function control_and_setup is the only one to use in PyJeb. It use to apply controls and setup default and variables values.

See all about the structure in control_and_setup

Configuration

The configuration is a dictionary of dictionaries. Each key is a section and each section is a dictionary of key-value pairs.

Exemple:

HR - Employees:
  source:
    path: "/Landing/HR/Employees/$sys.timestamp('YYYY-MM-DD')"
    pattern: "*.csv"
  target:
    path: "/Bronze/HR/Employees"
HR - Managers:
  source:
    path: "/Landing/HR/Managers/$sys.timestamp('YYYY-MM-DD')"
  target:
    path: "/Bronze/HR/Managers"
HR - Payroll:
  source:
    path: "/Landing/HR/Payroll/$sys.timestamp('YYYY-MM-DD')"
  target:
    path: "/Bronze/HR/Payroll"

Controls

The controls are a list of dictionaries. Each dictionary is a control to apply on the configuration.

See all about the structure in controls page

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

pyjeb-1.2.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyjeb-1.2.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file pyjeb-1.2.0.tar.gz.

File metadata

  • Download URL: pyjeb-1.2.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for pyjeb-1.2.0.tar.gz
Algorithm Hash digest
SHA256 87d9ce2537818d9b3f6086723d1d4a484e739610d1d893845b523db0ac4dd72d
MD5 8d7882d352b5d8b7b2a153033354ca44
BLAKE2b-256 238c63d94c1e87f109f40bad5a67fc47d1ea9fd0b5d957dc06fb6c81eacee59a

See more details on using hashes here.

File details

Details for the file pyjeb-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyjeb-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for pyjeb-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60479f5c36584efdd8e441d25e38bdddf30da9b96122c2749214b63f3200d90c
MD5 8afa4bdcb023d96ac706b718ad631b98
BLAKE2b-256 ec87f885fb2997ec2fb390af13e8449f9521f85cacbfae03b92e09f959d5e9a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page