Skip to main content

A powerful YAML-based configuration system with references, expressions, and dynamic instantiation

Project description




CI Coverage PyPI License Documentation


⚙️ YAML configuration meets Python 🐍

Define Python objects in YAML. Reference, compose, and instantiate them effortlessly.


What is Sparkwheel?

Stop hardcoding parameters. Define complex Python objects in clean YAML files, compose them naturally, and instantiate with one line.

# config.yaml
model:
  _target_: torch.nn.Linear
  in_features: 784
  out_features: "%dataset::num_classes"  # Reference other values

dataset:
  num_classes: 10
from sparkwheel import Config

config = Config()
config.update("config.yaml")
model = config.resolve("model")  # Actual torch.nn.Linear(784, 10) instance!

Key Features

  • Declarative Object Creation - Instantiate any Python class from YAML with _target_
  • Smart References - @ for resolved values, % for raw YAML
  • Composition by Default - Configs merge naturally (dicts merge, lists extend)
  • Explicit Operators - = to replace, ~ to delete when needed
  • Python Expressions - Compute values dynamically with $ prefix
  • Schema Validation - Type-check configs with Python dataclasses
  • CLI Overrides - Override any value from command line

Installation

pip install sparkwheel

→ Get Started in 5 Minutes

Coming from Hydra/OmegaConf?

Sparkwheel builds on similar ideas but adds powerful features:

Feature Hydra/OmegaConf Sparkwheel
Config composition Explicit (+, ++) By default (dicts merge, lists extend)
Replace semantics Default Explicit with = operator
Delete keys Not idempotent Idempotent ~ operator
References OmegaConf interpolation @ (resolved) + % (raw YAML)
Python expressions Limited Full Python with $
Schema validation Structured Configs Python dataclasses
List extension Lists replace Lists extend by default

Composition by default means configs merge naturally without operators:

# base.yaml
model:
  hidden_size: 256
  dropout: 0.1

# experiment.yaml
model:
  hidden_size: 512  # Override
  # dropout inherited

Documentation

Community

Contributing

We welcome contributions! See CONTRIBUTING.md for development setup and guidelines.

About

Sparkwheel is a hard fork of MONAI Bundle's configuration system, refined and expanded for general-purpose use. We're deeply grateful to the MONAI team for their excellent foundation.

Sparkwheel powers Lighter, our configuration-driven deep learning framework built on PyTorch Lightning.

License

Apache License 2.0 - See LICENSE for details.

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

sparkwheel-0.0.7.tar.gz (47.3 kB view details)

Uploaded Source

Built Distribution

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

sparkwheel-0.0.7-py3-none-any.whl (56.9 kB view details)

Uploaded Python 3

File details

Details for the file sparkwheel-0.0.7.tar.gz.

File metadata

  • Download URL: sparkwheel-0.0.7.tar.gz
  • Upload date:
  • Size: 47.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sparkwheel-0.0.7.tar.gz
Algorithm Hash digest
SHA256 6208cebb9eba634666e27c93e832a857383fa03397dca22561e3cccaf7e66de9
MD5 0b90de12789d20016e221aa65fff9a30
BLAKE2b-256 4885847390a228c2dc585cdfc55472061b73e141a603e978916e3f6907bec873

See more details on using hashes here.

File details

Details for the file sparkwheel-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: sparkwheel-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 56.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sparkwheel-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e6aad48a0c5574479c3b31ca081b9572d33d046cb27e8ecf5d6949aa0a085563
MD5 11e7c45206a4ed680756537d82065de9
BLAKE2b-256 dd3854a7ccd3a7fa9b7ab8cf02bd249fb9cd3915e0d6799182ba39a45a09ca80

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