Skip to main content

FlexLock

Python configuration and run provenance for research and offline data processing.

Documentation · MIT licensed

FlexLock lets you write a config in Python, select and override it from the CLI, and execute locally or through cluster workers. Run records capture configuration, declared source/data dependencies, upstream producers, outputs and return values.

The 0.10.0 release removes automatic cross-run cache search and partial-stage resume policy. See breaking changes.

Configuration and execution

# cfgmod.py
from flexlock import py2cfg
from myproject.stages import prepare, train

cfg = dict(
    runs_root='/shared/project/runs',
    track='intensity', arm='baseline', run='20261016-seed3',
    run_dir='${runs_root}/${track}/${arm}/${run}',
    upstream_run='/shared/project/runs/preparation/base/20261001/prepare',
    main=py2cfg(train,
        save_dir='${run_dir}/train',
        input_path='${run_lock:${upstream_run},config.output_path}',
        checkpoint_path='${run_dir}/train/model.pt',
        _snapshot_=dict(data=dict(dataset='${...input_path}')),
        _outputs_=dict(model=dict(path='model.pt', sha256=True))),
)
flexlock-run -d cfgmod.cfg -s main -o upstream_run=/shared/runs/other/prepare
flexlock-run -d cfgmod.cfg -s main --sweep-file configs/smoke.yaml --n_jobs 2
flexlock-run -d cfgmod.cfg -s main --slurm-config configs/slurm_gpu.yaml

Choose fresh destinations for independent runs. Occupied run directories raise before scheduler submission; active ownership also prevents forced overwrites. Use the workflow recipes for named sweeps, per-item destinations and explicit producer selection.

Python submission uses the same execution kernel:

from flexlock import Project

project = Project('cfgmod.cfg')
result = project.submit('main')
result.raise_on_failure()
print(result.save_dir, result.result)

Provenance and explicit reuse

Source snapshots describe the declared repository scope, including include/exclude patterns. Data hashes and upstream bindings record what the callable consumed. Comparison tools provide evidence for deciding whether preparation remains acceptable after a code change; FlexLock does not choose that scientific policy.

flexlock-diff /shared/runs/producer_a /shared/runs/producer_b

Consumers bind concrete producer paths with run_lock. FlexLock resolves and records the selected producer accurately and rejects identity changes at consumption time. It does not silently substitute a newer producer.

selected = project.submit(cfg, save_dir_policy='skip')

skip reuses exactly the selected complete destination after authoritative-record and declared-output validation. It returns the producer's recorded config. It does not certify equivalence to a new config or current source. force=True intentionally reruns in place and records the new attempt while keeping products in place.

Sweeps and ordered stages

Sweep files keep large cohorts out of comma-separated CLI arguments. Workers claim tasks from a shared SQLite queue, allowing many items with a bounded worker allocation. Project coverage checks distinguish successful processing, valid empty outcomes, exclusions, missing products and failures.

CLI -s prepare train assess executes selected stages in order on one allocation, with distinct provenance and fail-fast execution. Independent pipeline items can run in parallel. Stages needing different resources use separate scheduler jobs and --after, with concrete future producer paths and an accepted-ID ledger.

An unchanged recorded queue can continue pending work without rerunning done rows. For a partially completed pipeline, explicitly select remaining stages, bind retained producers and use fresh destinations. There is no automatic marker-based stage skip.

Further reading

Install this release with pip install flexlock==0.10.0 or from the quentinf00 Conda channel. See the migration notes before upgrading existing callers.

Metadata

Release files for flexlock 0.10.0

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

Source distribution (sdist)

Source distribution for flexlock 0.10.0
File Size Uploaded Provenance Actions
flexlock-0.10.0.tar.gz 460.3 kB Without provenance Details for flexlock-0.10.0.tar.gz

Built distribution (wheel)

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

Total release size: 653.7 kB

Release files / flexlock-0.10.0.tar.gz

Download URL flexlock-0.10.0.tar.gz
Size 460.3 kB
Tags Source
SHA-256 checksum
How to use checksums
059c5d3bcaf47c4cfe2166cd76368702db453d022b3cc0e8f7197aec5d5aa20a
BLAKE2b-256 checksum
How to use checksums
cecf4a4ef39a8fd6d7bde4a1293ad1bdffa30e040318d3402a2bcd815ca5f0ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / flexlock-0.10.0-py3-none-any.whl

Download URL flexlock-0.10.0-py3-none-any.whl
Size 193.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e20225640738c8f4f1a72202315f9de6fc9fd2309487326c349c1573e4568dae
BLAKE2b-256 checksum
How to use checksums
cdf8b7acf18ec7e60cf2cf64a68ceaf5eec1b2279f5c48cb28d11b9de22ebce9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Security for flexlock 0.10.0

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.

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