Skip to main content

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

Project description




Tests 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.load("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.6.tar.gz (44.8 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.6-py3-none-any.whl (54.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sparkwheel-0.0.6.tar.gz
  • Upload date:
  • Size: 44.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"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.6.tar.gz
Algorithm Hash digest
SHA256 50272ca1393a6e1a43ff42c6dfb4d418435dbd65f8a3f60639700838305de639
MD5 64fb1872751f723088c13e32dfd8155e
BLAKE2b-256 55851da0753cd5293e51fbb4ede17f26a471184ead67866912d34fdf51d8951f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sparkwheel-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 54.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 11c4ce2796c191fef16cbde1d240e51fd17c6d2de01cb2514e4c1ec007d0bab4
MD5 ff615a1b55b88d70e06662b8fce7b681
BLAKE2b-256 fcf6bc156ad0673bae7db6cdc1fb44c44dd0ba58c1e0289efe48b804d606d7f9

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