Skip to main content

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["Model"]):
        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.make()
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).make()
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 using pure Python dataclass factories and dependency injection.},
      author={Joshua V. Dillon},
      year={2026},
      howpublished={Github},
      url={https://github.com/jvdillon/configgle},
}

License

Apache License 2.0

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

configgle-1.0.0.tar.gz (150.0 kB view details)

Uploaded Source

Built Distribution

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

configgle-1.0.0-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file configgle-1.0.0.tar.gz.

File metadata

  • Download URL: configgle-1.0.0.tar.gz
  • Upload date:
  • Size: 150.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for configgle-1.0.0.tar.gz
Algorithm Hash digest
SHA256 22c9c11b5ccdb8fc74ddb5ca275ec9c566eccc94af0becfa04ebd98075b6337c
MD5 3f9d87d04ca2211c0f16b01afbae8197
BLAKE2b-256 f3b4d8b4f0f4bd1b041f42f739323848d58b041b2f1da85c9799cd3892bcbc89

See more details on using hashes here.

File details

Details for the file configgle-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: configgle-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for configgle-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d05be0dc1dd082f7d63dc7cb93b4388a9c13fd436714df8e6603ff17c0f3705
MD5 cef3007769421fe91c5c9727b4bd78ce
BLAKE2b-256 cbc39886ae0f59c80d8be4250fb2b5a822620bbd7ffd9214ec798b415d632b6e

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