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.5.tar.gz (43.5 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.5-py3-none-any.whl (53.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sparkwheel-0.0.5.tar.gz
  • Upload date:
  • Size: 43.5 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.5.tar.gz
Algorithm Hash digest
SHA256 c5c4117b1989eea78e99f6663d0c421573f5d6dfcabf8633e77225710d0243fe
MD5 db449766d98cc07bcd8d6bef2dbb606a
BLAKE2b-256 10f04c538e8b5fbea48c999313cd11c73ae52bfcb48235a4bf157a04f32cbcff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sparkwheel-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 53.4 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 363c60c516ffa9a4d7b8aab978181ee0277a05a32182f8118d706e87a9ea3fe5
MD5 5cc906223e484db133058c75d6da97f0
BLAKE2b-256 aa519252dcb284bca884965becbc9b6cce7279011cc99d2a1f04110f1038cfc9

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