Hierarchical experiment configuration and dependency injection using pure Python dataclass factories.
Project description
configgle🤭
Tools for making configurable Python classes for A/B experiements.
Installation
python -m pip install configgle
Example
from configgle import Fig
class Model:
class Config(Fig):
hidden_size: int = 256
num_layers: int = 4
def __init__(self, config: Config):
self.config = config
# Create and modify config
config = Model.Config(hidden_size=512)
# Instantiate the parent class
model = config.setup()
print(model.config.hidden_size) # 512
Or use @autofig to auto-generate the Config from __init__:
from configgle import autofig
@autofig
class Model:
def __init__(self, hidden_size: int = 256, num_layers: int = 4):
self.hidden_size = hidden_size
self.num_layers = num_layers
# Config is auto-generated from __init__ signature
model = Model.Config(hidden_size=512).setup()
print(model.hidden_size) # 512
References
Why another config library? There are great options out there, but they either focus more on YAML or wrapper objects. The goal with configgle is a UX that's just simple Python--standard dataclasses, hierarchical, and class-local. No external files, no new syntax to learn.
The following libraries span these ideas but none wholly combine them:
- Hydra - Framework for elegantly configuring complex applications
- OmegaConf - Flexible hierarchical configuration system
- Confugue - Hierarchical configuration with YAML-based object instantiation (most similar to configgle, but uses YAML rather than pure Python)
- Fiddle - Python-first configuration library for ML
- Gin Config - Lightweight configuration framework for Python
- Sacred - Tool to configure, organize, log and reproduce experiments
- ml_collections - Python collections designed for ML use cases
Citing
If you find our work useful, please consider citing:
@misc{dillon2026configgle,
title={Configgle - Hierarchical experiment configuration and dependency injection using pure Python dataclass factories.},
author={Joshua V. Dillon},
year={2026},
howpublished={Github},
url={https://github.com/jvdillon/configgle},
}
License
Apache License 2.0
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
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 configgle-0.1.4.tar.gz.
File metadata
- Download URL: configgle-0.1.4.tar.gz
- Upload date:
- Size: 149.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c8471127ba9bdc87c76d727d197f0561fb324f9631cfd4caa9c1c614f1adcf6
|
|
| MD5 |
a408e2c132df31acceadce4d648915a8
|
|
| BLAKE2b-256 |
4f3fb705b9e4001c5c0481adeac981d40590e10a622ceddb8ef46ab34593e703
|
File details
Details for the file configgle-0.1.4-py3-none-any.whl.
File metadata
- Download URL: configgle-0.1.4-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9462fb1bec360ca235f43955ab0e497bc6e57adc89e87a7c5d62c57d982375a3
|
|
| MD5 |
f4acacb65202ab9b34e04b1969b08722
|
|
| BLAKE2b-256 |
b1d1483358fb436125b3e84b48558bf3df05f3573f86140165789e2cf368b124
|