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.8.tar.gz (47.6 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.8-py3-none-any.whl (57.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sparkwheel-0.0.8.tar.gz
  • Upload date:
  • Size: 47.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"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.8.tar.gz
Algorithm Hash digest
SHA256 deb90c1f1ac0efb1124671b1c8b22d930a66fc36b551efc5b922c03d58e44e5b
MD5 7bdef3689a992b1db80d7b4b3421a932
BLAKE2b-256 aac2fb71c547bfaf84d6f63b59a2bef9825d8c8e42372404f6d95c3ba392d0a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sparkwheel-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 57.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 1fbc51ef504efe54567eb7b3ae8fb4b4f812465a5bc485e6795748b473db6c29
MD5 3c05dd82d74582d9b8e6496821638946
BLAKE2b-256 2b762a50da6d80ac7ae69340d575beaca377b025d79ddf88bfdd757f7e35fa27

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