Skip to main content

dagsweep

Declarative, prefix-reusing parameter sweeps over a step DAG. Problem-agnostic: it knows nothing about your algorithms — only ports and variants.

You describe each step as a connector (named inputs/outputs, optional, with a list of variants to sweep). dagsweep wires the steps by port name, topologically orders them, and sweeps every combination — computing each shared prefix exactly once and reusing it for every child. The reuse is keyed on the chosen variant indices (a cheap token), never on a hash of the data, so large intermediate objects cost nothing to cache.

Why

A grid sweep A × B × C is a prefix tree: consecutive configurations share a long prefix. Hand-written nested loops capture that reuse but are rigid — a new step means editing the loop. dagsweep keeps the reuse but makes the structure declarative: add a step by appending one Step.

Example

from dagsweep import Step, Pipeline

pipe = Pipeline([
    Step("rank",  run_rank,  consumes=("rules", "measures"),
         produces="ranked", variants=rankers),
    Step("prune", run_prune, consumes=("ranked",),
         produces="pruned", variants=pruners),
    Step("clf",   run_clf,   consumes=("pruned",),
         produces="model",  variants=classifiers),
])

results = pipe.run(
    seed={"rules": rules, "measures": im},
    sink=lambda ctx: evaluate(ctx["model"]),
)
# [("BordaRank+M1Prune+OrdinalClassifier", <metric>), ...]  one record per leaf

rank runs once per ranker, prune once per (ranker, pruner), clf once per leaf — automatically.

The one rule: steps must be pure

fn(variant, *inputs) -> output must not mutate its inputs after returning them. The executor memoizes and shares outputs across configurations; mutating a shared output in place corrupts siblings. Purity is also what makes per-step parallelism safe (see Step.parallel, reserved).

Concepts

  • Port — a named value in the run context. A step produces one port and consumes zero or more. Ports not produced by any step are seeds, supplied to run.
  • Variant — one choice on a step's sweep axis. variants=(None,) is a step with no algorithm choice (a fixed transform).
  • Optional step — optional=True: when the chosen variant is None the step is skipped and its output is taken from fallback. Put None in variants to sweep "with and without" the step.
  • Wiring is implicit — consumes/produces names form the DAG; declaration order does not matter, dependencies decide execution order.

Validation rejects duplicate writers, cycles, unreachable fallbacks, and missing seeds with clear errors.

Metadata

Release files for dagsweep 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dagsweep 0.1.1
File Size Uploaded Provenance Actions
dagsweep-0.1.1.tar.gz 7.6 kB Without provenance Details for dagsweep-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dagsweep 0.1.1
File Interpreter ABI Platform Actions
dagsweep-0.1.1-py3-none-any.whl Python 3 none any Details for dagsweep-0.1.1-py3-none-any.whl

Total release size: 15.2 kB

Release files / dagsweep-0.1.1.tar.gz

Download URL dagsweep-0.1.1.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
13ef630fe3800faf9f6829ce5cfe315139263c0dd2188521344b1e68e468cc49
BLAKE2b-256 checksum
How to use checksums
61145a89149bd7fcd1fb019189527cf28a8583b8281160b97980bd255f892164
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / dagsweep-0.1.1-py3-none-any.whl

Download URL dagsweep-0.1.1-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c688d9d12348696e223a80b50c6aca48ddb1dd71e9dbbcb52b7e3b7b6d692aa0
BLAKE2b-256 checksum
How to use checksums
7a23756d63989d5de229c359a5fc88bf8c382c06a15dcb53189523faa023447b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Security for dagsweep 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page