Skip to main content

Tools for making configurable Python classes for A/B experiements.

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

configgle combines Python standard patterns (dataclasses) with hierarchical, class-local configuration.

The following libraries span these ideas but none wholly combine them:

  • 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
  • Hydra - Framework for elegantly configuring complex applications
  • ml_collections - Python collections designed for ML use cases
  • OmegaConf - Flexible hierarchical configuration system

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-0.1.2.tar.gz (109.6 kB view details)

Uploaded Source

Built Distribution

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

configgle-0.1.2-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for configgle-0.1.2.tar.gz
Algorithm Hash digest
SHA256 05692e0013f4534bf7ea5d70e9f1bdc02fd0603a75d15ba6052f051c77f52da6
MD5 1e9357fa7f9043acafe484a8c06e2c1e
BLAKE2b-256 ff4ae2dfabeb65d1f95740b9bd204a335dfe1339bc965d26b50102dad246af6e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for configgle-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9542289fd9e2c6be258de852ae6da962ec7da1360e2311ec44da0a09d3886f4a
MD5 34b94a1618ec11bb1f7ce1c5ef8f1b92
BLAKE2b-256 2e23bce3461cc511c6d584176da79f55c091f3f2e36aa22cd5a78597dcce1238

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