Skip to main content

research-repo-tools

DOI PyPI version License CI CodeQL zizmor Codecov Audit dependencies

Shared setup, checks, notebooks, performance evidence and release tooling for research software repositories. Install one pinned Python package and invoke it through your repository's Just recipes. Keep scientific algorithms, benchmark case selections, native builds and deployment policy in your own project.

Start with installation, try the first workflow, then choose a capability. Package development belongs in CONTRIBUTING.md.

Release availability

Install v0.3.0 from PyPI. See CHANGELOG.md for release notes. Use templates from the same installed release, a reviewed full commit for rehearsal, and a verified published pin for release-intent workflows.

v0.3.0 adds checkout-independent release visibility checks and opt-in reuse of verified benchmark preparation inputs. It also makes unpublished-candidate recovery resumable, tightens archive path validation, and retains nanosecond precision in command-timing summaries.

v0.2.7 includes breaking Python API changes. Update callers to the documented typed variants, including trial orders and release-rule replacements. Review the current API contracts when upgrading custom integrations.

An upstream merge, local wheel or passing source test does not publish a package. Before adopting a new capability, verify its exact PyPI release, update your consumer's pin and lockfile, and run its integration checks. Keep working adapters until that adoption succeeds. Migration guidance covers compatibility changes.

Install with uv

Use an existing consumer Git repository; you do not need to clone this package. Install uv and Git first. Recipes require a POSIX sh on PATH, including on Windows: add Git for Windows' bin directory, typically C:\Program Files\Git\bin. uv supplies managed Python; the published package requires Python 3.15 or newer.

From the consumer root, add the exact published package:

uv add --group tooling --no-sync "research-repo-tools==0.3.0"

Include tooling from dev, retaining your other dependencies. Set .python-version to a compatible selection such as 3.15. Keep any stricter application Python constraints; use the adoption workflow if the project currently requires an older interpreter.

[dependency-groups]
tooling = ["research-repo-tools==0.3.0"]
dev = [{include-group = "tooling"}]

Declare the uv version you installed as tool.uv.required-version = "==X.Y.Z". The toolchain guide explains Rust and optional tool declarations; a Python-only consumer can omit them. Refresh the lock, then export the matching installed Just template:

uv lock
uv run --locked --only-group tooling research-repo-tools templates justfile --output justfile

For an existing justfile, omit --output justfile and merge the printed recipes; the exporter refuses to overwrite files. Review and retain the manifest, lockfile, Python selector and recipes together.

Run the one-time setup:

uv run --locked --managed-python --only-group tooling research-repo-tools setup

Setup verifies the declarations, installs a pinned user-level Just and declared tools, configures PATH and synchronizes the locked development environment. Open a new terminal if PATH changed. A failed step stops setup with a diagnostic; fix that prerequisite and rerun. Installation and recovery explains ownership, native build prerequisites and platform behavior.

Managed Cargo tool installs reuse compilation output across setup and update runs while retaining exact-version installation and executable checks. See local and CI cache configuration before adopting it downstream.

Selecting tools for a job

A narrow CI job can select exact keys from its existing tool catalog. After one-time setup and adopting the matching Just template, use the same repeatable --tool selection for setup, verification, export and execution. For example, with a declared zizmor pin:

just tools-sync --tool zizmor
just tools-check --tool zizmor
just tools-export --tool zizmor
just tools-run --tool zizmor -- zizmor .github/workflows

Export appends checked assignments to GITHUB_ENV; locally pass --file PATH. Repeat --tool for multiple tools. --tool cargo selects only pinned minimal Rust/Cargo for packaging; --tool cargo-edit selects the package providing cargo upgrade. Binary selections such as gitleaks need no Rust; Cargo tools add minimal Rust without the catalog's extra components or targets. Omission keeps full contributor behavior. Selection does not install native libraries or synchronize project Python groups; retain those prerequisites in the owning job.

MCMC can replace its scanner-filtering Python heredoc with these bootstrap-safe CI commands, passing its existing validated scanner name to both selections:

uv run --locked --managed-python --only-group tooling research-repo-tools toolchain sync --tool "$SCANNER"
uv run --locked --managed-python --only-group tooling research-repo-tools toolchain export --tool "$SCANNER"

Keep the scanner allowlist, declared pins, authentication, managed-home and build-cache settings, workflow permissions and scheduling in MCMC. Verify the installed supplier before removing that adapter. The API contract supports the same selection for Python callers.

Additional setup and cleanup

Semgrep consumers request the semgrep extra on their shared package pin, retain the shared Python 3.15 selector, and adopt the package's shared dependency overrides before locking. The consumer lock selects the exact compatible scanner used for fixture and production scans. On macOS, the Semgrep extra requires Apple silicon; Intel Macs are not supported. A package upgrade does not rewrite copied Just recipes; merge the relevant exported recipes as part of each consumer adoption and verify its integration before removing temporary adapters.

Preview obsolete tool installations and retained coverage artifacts with just clean, then use just clean --apply to remove the listed entries. just clean-coverage previews only coverage cleanup; just clean-coverage --apply performs it. Stop coverage runs first. Both preserve the latest .coverage database and current reports. See the coverage cleanup contract for the selected paths and adoption instructions.

Development pins and release dependencies

Downstream development and CI may use a reviewed full commit from the tooling repository's main branch. Replace FULL_40_CHARACTER_SHA with that commit and X.Y.Z with the version declared in its pyproject.toml. Retain the extras your consumer needs.

[dependency-groups]
tooling = ["research-repo-tools[python-tools]==X.Y.Z"]
dev = [{include-group = "tooling"}]

[tool.uv.sources]
research-repo-tools = {git = "https://github.com/acgetchell/research-repo-tools.git", rev = "FULL_40_CHARACTER_SHA"}

[tool.research-repo-tools.release]
published-dependencies = ["research-repo-tools"]

Choose a commit that supplies every interface your consumer uses. Resolve and sync it deliberately, and retain the manifest and lock together. Match any isolated runtime selection to the same repository and full commit. Normal setup, checks and development evidence remain usable. Git provenance must agree with the declaration and lock; a matching version label alone fails.

Before a release campaign, select the published upstream version that supplies the required interfaces. Remove the development source override, set both normal and isolated requirements to that exact PyPI release, then resolve and sync the lock. Run:

just release-dependencies
just performance-prepare tooling/performance-release.toml --release-intent
just performance-release tooling/performance-release.toml --release-intent

Release evidence, asset and approval paths enforce the configured policy again. The pin transition changes evidence inputs: revalidate the final configuration and acquire fresh results when measured inputs changed. Retain earlier results as rehearsal evidence. See the proof, supported artifacts and public API for fail-closed limitations and recovery. No consumer guard implementation or automatic pin/lock rewrite is needed.

Use the shared wrapper for isolated commands. Export the matching python-bootstrap.py template beside the consumer Justfile; it contains the same implementation as research_repo_tools.tooling_runtime. Use the exact published version for isolated release-intent commands:

just templates python-bootstrap.py --output python-bootstrap.py
just tooling-run --version 0.3.0 --release-intent --arguments-json '["release","dependencies"]'

For development, replace --version with --github acgetchell/research-repo-tools --commit FULL_40_CHARACTER_SHA and omit --release-intent. Add --extras python-tools when running checks that need the shared Ruff/ty/pytest profile. Selectors are mutually exclusive. Missing releases, yanked-only releases, missing commits and failed lookups stop before tooling starts; there is no fallback.

GitHub Actions can use the same implementation, with uv already installed. Replace FULL_40_CHARACTER_SHA with the reviewed commit targeted by the v0.3.0 release tag before adding this step.

- uses: acgetchell/research-repo-tools/.github/actions/run-tooling@FULL_40_CHARACTER_SHA # v0.3.0
  with:
    version: '0.3.0'
    release-intent: 'true'
    arguments: '["release", "dependencies"]'

For development, substitute the github and commit inputs for version. root selects the observed consumer/configuration root and extras selects optional package extras. The Action supplies RRT_GITHUB_LOOKUP_TOKEN for commit lookups; the wrapper removes it before launching tooling. Set the same variable outside Actions for authenticated lookups. Caller-supplied GITHUB_TOKEN or GH_TOKEN also authenticate lookups and remain available to tooling commands that require them. Lookup requests never send tokens to PyPI, raw content, or redirect destinations. The wrapper centralizes availability checks and isolated uv invocation; normal dependency pins remain in the manifest/lock, and release gates verify both installations. It never rewrites a consumer's pins or upgrades tooling.

Reproducible isolated release runtimes

The stronger runtime-policy capability selects a dedicated runtime lock, independent of the consumer's development lock. A reviewed manifest binds the complete installed dependency graph, exact wheel bytes, Python/platform, and any required native source-build evidence. The ordinary isolated wrapper above continues to resolve its transitive dependencies independently; --locked with --no-project does not turn that environment into a locked runtime.

Use a trusted bootstrap installation outside the consumer checkout, with the matching release-runtime recipe from the shipped Justfile. With v0.3.0 installed, resolve the dedicated project there:

just release-runtime resolve --directory /trusted/runtime-project --require 'research-repo-tools==0.3.0'

Keep uv as a prerequisite. Add these bootstrap recipes alongside the trusted Justfile; uv details remain inside recipes. runtime-sync installs only wheels from the lock. runtime-builds supports the existing explicit native-build policy, using the bootstrap interpreter rather than executing the target venv:

runtime-builds project:
    uv run --locked research-repo-tools --root "$1" release dependency-builds

runtime-lock project:
    uv lock --no-config --no-build --project "$1"

runtime-sync project *args:
    runtime_project="$1"; shift; uv sync --locked --no-config --no-default-groups --no-build --project "$runtime_project" "$@"

For a wheel-only graph, run just runtime-sync /trusted/runtime-project. If native source builds are required, first configure the dedicated project's dependency-sources.toml and build group using the source-build contract. Run just runtime-lock /trusted/runtime-project, then just runtime-sync with that project and --no-install-package NAME for each selected source build. This creates the venv and installs the remaining locked dependencies. Then run just runtime-builds /trusted/runtime-project to build/install the selected native wheels and authenticate their evidence. Record from the separate bootstrap installation; do not launch the target venv or compile bytecode before recording:

just release-runtime record --project /trusted/runtime-project --output /trusted/runtime-bundle

Review the dedicated lock, runtime.json, retained wheels and native receipts/logs. Pin the printed SHA-256 in protected workflow configuration or another independently authenticated handoff. A digest supplied alongside an untrusted bundle is not authentication. Transfer the bundle, never the machine-local signing key. The selected Python patch version and platform must match on the receiving host:

just release-runtime install --policy /trusted/runtime-bundle/runtime.json --sha256 APPROVED_SHA256 --directory /trusted/writer
just release-runtime verify --policy /trusted/runtime-bundle/runtime.json --sha256 APPROVED_SHA256 --environment /trusted/writer

Installation uses the approved manifest's hashes and retained wheels offline, then verifies the installed graph; it does not trust an editable requirements file. An existing destination is never overwritten. If installation fails, preserve it for inspection and retry with a new directory after repairing the reported input.

Launch release writers through a recipe using the exact installed interpreter, -I -B, and the approved manifest. On Windows, select Scripts/python.exe in place of bin/python. For example, define the following in the trusted Justfile:

runtime-release python policy digest root +args:
    runtime_python="$1"; runtime_policy="$2"; runtime_digest="$3"; runtime_root="$4"; shift 4; "$runtime_python" -I -B -m research_repo_tools.cli --root "$runtime_root" release --isolated-runtime --runtime-policy "$runtime_policy" --runtime-policy-sha256 "$runtime_digest" "$@"

Pass the existing assets, evidence or other release arguments unchanged. The same prefix supports candidate/native evidence, authenticated draft preparation, and checkout-free attachment writers. Keep standalone controller configuration outside the observed checkout and pass its existing --checkout argument where required. The Python API accepts policy= and artifacts= on isolated_release_runtime; runtime policy API describes all public functions and trust boundaries.

This is an additional opt-in runtime guarantee. Existing dependency, native validation, release-identity and publication-approval gates still apply. Exact Git-source development rehearsal remains supported through tooling-run without --release-intent; it does not produce a registry runtime policy or publication authorization. Consumer migration and hosted setup timing follow the supplying package's verified publication in their own adoption trackers.

First workflow

After setup, list your recipes and check Markdown source lines in the consumer:

just help
just files check-lines --limit 160 --include '*.md' --exclude CHANGELOG.md

This read-only check needs no optional scanner or notebook dependencies. It selects tracked and nonignored Markdown, counts every raw line (including tables and code), and returns zero for a clean inventory. Long lines produce file:line: line length N exceeds 160 and status 1. Fix the selected source or declare your intended selection and limit, then rerun.

Use just ... for routine work; no environment activation is needed. Recipes select the locked package internally. The underlying CLI and Python APIs remain available for integrations.

Verified Python and Cargo dependency sources

Use dependency-sources.toml at the checkout root to select upstream Python packages or Cargo crates. Releases accept PyPI and crates.io only; exact GitHub commits are available for development checks and rehearsal.

schema = 1

[projects.rust]
ecosystem = "cargo"
directory = "."
release-owned = ["."]

[sources.upstream]
project = "rust"
package = "upstream-crate"
github = "owner/repository"
commit = "0123456789abcdef0123456789abcdef01234567"

For Python, use ecosystem = "python" and a Python package name. Project directory selects a project within the checkout; an optional source directory selects the package within the upstream repository. Export the annotated template with just templates dependency-sources.toml --output dependency-sources.toml.

just dependency-source upstream
just dependency-source upstream --apply
# Synchronize the native environment and run your downstream checks/rehearsal.

After upstream publication, replace github, commit and the source directory with version = "1.2.3". Preview/apply again, synchronize and revalidate against the published dependency, then run just release-dependencies. Existing rehearsal files remain available, but changed source/lock identities require fresh evidence. The preview verifies availability before asking the native resolver to produce a candidate; apply publishes the manifest and lock together.

The reusable run-tooling Action accepts the same command arguments: use ["deps", "source", "upstream", "--apply"] for an explicit development transition and ["release", "dependencies"] with release-intent: 'true' before release work. Use the pinned Action and exact published tooling version shown above; consumers do not assemble Git URLs or implement their own dependency guard. Workspace ownership, registry proof limits and recovery are described in the dependency source guide.

Source-built Python dependencies

When a locked PyPI dependency needs a native source build, explicitly select it in the canonical policy and pin its build requirements in a locked dependency group. One root Python project is supported for source-build preparation:

[source-builds]
packages = ["package-needing-a-build"]
group = "build"

Run just release-dependency-builds before just release-dependencies. The builder checks the published sdist against the lock, installs hash-locked build tools from wheels into a fresh environment, builds with automatic build dependency resolution disabled, and installs the resulting wheel. It never certifies an existing local installation without rebuilding it. The release gate compares installed files with that authenticated wheel, including supported purelib, platlib, environment-relative data, and unchanged native scripts relocation. Other wheel relocation schemes or rewritten script shebangs remain unsupported.

Backends that package downloaded executables must declare each platform's input under [[source-builds.external]]: package, platform, exact GitHub release asset url, sha256, archive member, and destination wheel-member. The builder independently checks the archive hash and compares the packaged executable byte for byte. This repository's policy provides a complete actionlint example. Keep these pins synchronized when updating that dependency.

Receipts and retained wheels live in ~/.research-repo-tools/source-builds, outside the checkout. RESEARCH_REPO_TOOLS_BUILD_STORE can select another absolute, private directory outside it. Receipts authenticate the source, lock, policy, manifest, build-tool inventory, builder, interpreter, native platform and output wheel using a machine-local key. Changes require rebuilding. Each CI runner creates its own evidence; do not copy signing keys between machines.

This trusts the local runtime, filesystem, native toolchain and verified upstream build hooks. A fresh virtual environment is not a security sandbox; build hooks can execute native tools or access the network. The receipt records observed inputs and output, not a complete system dependency closure, reproducible build, portable attestation, or publisher signature. Keep the store private using user permissions on POSIX and the user profile's ACLs on Windows. If installation fails partway, rerun preparation; release verification continues to reject any unverified installed payload.

Common workflows

These are independent commands; run only the workflow you intend. Some require consumer configuration or optional dependencies described in their guides.

Command Use
just actions-check Check declared workflow/composite pin consistency offline after setup
just changelog-preview --tag v1.2.3 --date YYYY-MM-DD Inspect prospective notes without replacing files
just check Run your configured local checks and native/domain gates
just files check-lines --limit 160 --include '*.md' Check selected raw text without formatting
just help Discover recipes supplied by your installed template
just notebook-inspect notebooks/analysis.ipynb --no-preview Inspect notebook structure without executing cells
just review Run an opt-in CodeRabbit review; stop when paid consent is required
just review-deny PENDING Decline a saved review quote
just review-resume PENDING ARGS... Attempt one explicitly approved paid review with an unenforced quote
just review-uncommitted Review staged, unstaged and non-ignored untracked changes
just setup Recreate the environment from existing declarations
just tools-check Verify installed tools and versions without installing
just update Upgrade declared tools and dependencies, then audit final locks

The complete command and capability reference is organized lexicographically. just help remains the authority for the recipes actually merged into your project. The packaged templates provide thin wrappers; consumers extend checks with their own Rust, scientific and deployment requirements.

CodeRabbit reviews

Install and authenticate CodeRabbit separately; RRT does neither. Keep usage-based continuation On demand. Ordinary reviews never enable credits or automatically retry. The opt-in recipes are outside just check and just ci:

just review
just review main
just review-uncommitted

The default branch base is verified against origin; explicit bases are checked locally. The consumer root needs regular AGENTS.md and exactly one CodeRabbit YAML configuration. Output streams as agent NDJSON. Completion requires CodeRabbit 0.7.7 or newer; 0.7.6 supports quote-and-stop only.

A consent-required result returns status 3 and prints the repository, base, content identity, original provider quote, saved pending_path and pending_identity. The local selected-path count is not a billable count. Show the person the scope, initial/incremental kind, quoted billable files and maximum charge with currency. The currently verified consent event omits currency and review kind; independently confirm those facts or remain stopped. Consumer instructions own per-review approval and restrictions on large paid reviews.

Paid resume is a new invocation without a provider-enforced price cap or content snapshot. Only after explicit approval of that limitation and the exact saved quote, use the following form (the currency and kind here are examples, not values RRT infers):

just review-resume /absolute/pending.json --approve SAVED_PENDING_SHA256 \
  --currency USD --review-kind incremental \
  --terms-source 'Where this currency and review kind were confirmed' \
  --accept-unenforced-quote

It consumes approval once, refreshes without credits, and checks current inputs and quote before enabling credits. Changes require a new quote and approval. If a hard cap is required, do not resume. For refusal, run just review-deny /absolute/pending.json. After uncertain paid completion, reconcile CodeRabbit usage before requesting another review; retain the pending file and its .used receipt. Do not remove the receipt to reuse approval.

See the review API and protocol contract for compatibility, limits, typed results, state retention and residual races. Local checks and agent instructions are cooperative controls; they do not prevent direct CLI bypasses.

Actions pin consistency

Declare the identities to check in .github/action-updates.toml using the Actions consistency policy. Merge actions_inputs, actions-check, and update-actions from the packaged Justfile together. Retain set positional-arguments so preview flags passed to update-actions reach its shell command.

The default shared input is .github/workflows, so workflow-only repositories need no composites directory. For composites, extend the expression with explicit metadata paths (or a directory containing only workflow and composite YAML). Quote each path separately, including paths with spaces:

set positional-arguments

actions_inputs := quote(".github/workflows") + " " + quote(".github/actions/setup-just/action.yml")

actions-check:
    uv run --no-sync --no-python-downloads --offline research-repo-tools actions check --policy .github/action-updates.toml {{ actions_inputs }}

update-actions *args:
    uv run --locked --only-group tooling --inexact research-repo-tools actions update --policy .github/action-updates.toml {{ actions_inputs }} "$@"

Add actions-check to the consumer's check prerequisites. Provision the environment through setup, then run the checker:

just setup
just actions-check

The check uses the existing environment without synchronizing dependencies or downloading Python. It does not validate the dependency lock; keep lock validation in the consumer's normal validation gate. Rerun setup if the required tooling is missing. Use just update-actions --dry-run or just update-actions --check to preview upstream updates before explicitly applying them with just update-actions.

Capability index

Choose a task guide for execution order and outcomes; use its linked reference for exhaustive arguments, configuration and Python contracts.

Task Primary guide Reference
Automate Dependabot review and merge Configure the shared workflow GitHub settings
Build reproducible papers Dates, PDFs and native dependencies Paper APIs
Check code, dependencies and secrets Python, Cargo, Semgrep, SARIF and review Security APIs
Generate changelogs and prepare releases Changelog generation, metadata preparation Release APIs
Inspect and execute notebooks Notebook workflows Notebook APIs
Prepare a retained-evidence release draft Isolated writer and recovery Draft preparation API
Publish reports and figures Preview and publish retained evidence Publication APIs
Publish to PyPI or crates.io Reviewed release procedure Exact-commit evidence, optional reuse
Record complete performance results Prepare, measure/retain, publish README Measurement policy, complete-run APIs
Select files, run commands and export CI values Consumer checks and integration File APIs, process/Just APIs, workflow APIs
Set up or repair tools Installation and ownership Toolchain APIs
Time external commands Exploratory command timing Timing evidence contract
Update dependencies and check/update Actions pins Update and adoption workflows CLI/configuration

Git inspection

Use the index-preserving inspection API to replace local inspection wrappers:

from pathlib import Path

from research_repo_tools.git_inspect import git_diff_paths_bytes, git_status_bytes

root = Path.cwd()
status = git_status_bytes(root).stdout
staged = git_diff_paths_bytes(root, cached=True).stdout.split(b"\0")[:-1]
worktree = git_diff_paths_bytes(root, base="HEAD", paths=["src"]).stdout.split(b"\0")[:-1]

Queries preserve the selected index bytes and return NUL-delimited byte output with literal path selection. See the inspection contract for configuration, deadlines, error handling and guarantee limits.

Notebooks

Add the notebooks extra at your exact tooling version to a separate notebook dependency group. Declare analysis packages and the required Ruff/ty checkers, refresh the lock, then follow notebook setup:

just notebook-sync
just notebook-lint notebooks/analysis.ipynb
just notebook-execute notebooks/analysis.ipynb

Execution preserves source notebooks and writes executed copies plus JSON reports under target/notebooks. A failed cell returns nonzero and identifies the cell. Consumers retain scientific assertions and fast/slow selection. Interactive JupyterLab, explicit source reset and source-policy checks are in the same guide.

Performance

For a release with a published predecessor, configure the installed performance-release.toml template with your measurement, retained-report and document-publication policies. Declare and ignore its scratch directory; keep the report archive outside scratch. Then run:

just performance-prepare tooling/performance-release.toml
just performance-release tooling/performance-release.toml
just performance-readme tooling/performance-release.toml --preview
just performance-readme tooling/performance-release.toml

Owner capture runs the release dependency gate before acquisition, even without --release-intent. Packages selected in published-dependencies must use a published registry release; development source overrides are rejected. Rehearse an unreleased pin without --owner or --release-intent. With published tooling, pass --owner "$owner" to just performance-release to retain the original assertions outside the checkout before report promotion.

For a repository's first stable release, just performance first-release acquires a single current-only run and publishes its absolute timing report. Use this procedure instead of the paired preparation, release and README commands above; paired schema-2 README publication rejects first-release v6 evidence. See the candidate workflow for capture, recovery and draft attachment.

For schema-5 measurement declarations, use a new ignored checkpoint directory whose parent already exists. Interruption recovery also works within schema-6 scheduled trials. Resume explicitly after an interruption:

just performance-release tooling/performance-release.toml --checkpoint target/performance-checkpoint
just performance-release tooling/performance-release.toml --checkpoint target/performance-checkpoint --resume

Completed paired suites retain their original raw bytes and sessions. An incomplete pair is recollected in full. Scheduled recovery retains completed trials and completed suites within the interrupted trial; follow the schedule and recovery contract. --progress json emits versioned status events on stderr; --progress none disables status. Heartbeats default to 300 seconds (five minutes); --progress-cadence 60 or --progress-cadence 600 selects a shorter or longer interval. Stage changes and failures are reported immediately. Report and README retries continue to use retained evidence without measuring again.

Preparation saves independently selected release tags and full commits. Measurement runs the gates and benchmarks, then retains/promotes the complete evidence. To retain eligible exports and executables between preflight and sampling, set preparation-storage-bytes in the schema-5 or schema-6 measurement policy. README publication only consumes retained evidence: repair a presentation failure and retry that last stage without measuring again. The performance guide explains source exports versus worktrees, common versus independent harnesses, parallel suite assembly, ratio eligibility and first-use report state.

The benchmark reuse API derives release archives from one accepted complete-run v4 acquisition. Supply a trusted, independently prepared reuse policy, then plan and publish the archive without invoking benchmarks:

from pathlib import Path

from research_repo_tools.benchmark_reuse import plan_reuse_archive
from research_repo_tools.publication import publish_publication

candidate = plan_reuse_archive(
    Path.cwd(), "target/run.json", "target/evidence.json",
    "tooling/reuse-policy.json", "target/benchmark-release.tar.gz",
)
publish_publication(candidate)

This v1 API requires exact tagged source measurements. The candidate contract supports a single pre-tag acquisition, report/README edits, final-main evidence acceptance, and archive reuse. Its schema-6 measurement declaration includes repeated alternating or seeded randomized trials, retained separately with observed execution receipts. Follow the Step 1 → Step 2 → publication procedure. The derived archive preserves original evidence and does not authenticate CI origin; attachment and approval retain the existing release safeguards. Verify the supplying PyPI release before adoption.

For the pre-tag contract, compose native evidence and independently retained benchmark assertions through the shared CLI. Run from the observed checkout using a trusted, pinned installation outside it (shown as /trusted/release-tools), and retain acceptance outside the checkout. Use this invocation in the consumer's Step 2 recipe; the packaged release-evidence recipe normally uses the checkout's .venv, which cannot verify that same checkout. On Windows, select Scripts/python.exe instead of bin/python:

/trusted/release-tools/bin/python -I -B -m research_repo_tools release evidence candidate tooling/release-evidence.toml \
  --checkout . --payload target/run.json --manifest target/evidence.json \
  --policy target/candidate-policy.json --acquisition-sha256 "$STEP1_ASSERTION_SHA256" \
  --output /durable/accepted.json

At approval, pass --acceptance /durable/accepted.json and a new output path outside the checkout to revalidate that selection. Obtain STEP1_ASSERTION_SHA256 from the trusted acquisition owner's separate handoff. Never derive it from the candidate being checked. These operations perform no benchmark acquisition or preflight.

When Step 1's policy has a pending final commit, add --commit FULL_COMMIT --policy-output /durable/final-policy.json and optionally --native-output /durable/native.json. Verification keeps the final policy in memory, then retains it with the acceptance in one guarded update. The composed path checks dependencies before native verification and again immediately before retention. Keep output paths outside the observed checkout. Use --progress human or --progress json for dependency phases and request/retry counts; release dependencies supports the same modes and defaults to human progress.

For committed schema-2 publisher histories, retain a publication receipt and declare the original report configuration in CandidatePolicy(report="tooling/performance-report.toml", ...). Before promotion, freeze the shared publisher's exact outputs under acquisition-owner control:

from research_repo_tools.candidate_publication import plan_candidate_publication

plan, receipt = plan_candidate_publication(
    root, "target/run.json", "target/evidence.json", step_one_policy,
    acquisition_sha256=trusted_acquisition_digest,
)
# Save receipt and its SHA-256 through the separate trusted handoff.
publish_publication(plan)

The report configuration must predate acquisition. Existing prepared-release adapters can capture this receipt in measure_release(before_promotion=...); the callback saves the handoffs and leaves promotion to measure_release. Commit the generated run trio, index/latest files and reports with the release PR. Step 2 adds --publication-receipt /trusted/publication.json, --publication-sha256 "$STEP1_PUBLICATION_SHA256", and --format summary to the candidate command above. Keep final acceptance and attestations outside committed history. The contract preserves exact old history and rejects arbitrary JSON/output paths.

Releases

Add --format summary to shared evidence verification commands for release/commit, native run/attempt, actual package guarantee, optional benchmark acquisition, signature and artifact-integrity results. --format json prints the same verified record saved by --output; default shared CLI status messages remain compatible. Checks that are not configured are labeled explicitly. Failures print diagnostics and a nonzero status, without a success summary or replacement acceptance.

Follow the ordered release procedure and matching installed RELEASING.md template. Exact-commit checks are the default. CI reuse is an explicit reviewed option with its own eligibility and revalidation; package and artifact checks still apply. Approval, registry publication, attachment uploads and downstream adoption remain distinct actions.

For an existing tag or draft, use the release recovery guide to choose a retry or unpublished-candidate replacement. Its benchmark decision table distinguishes retained measurements from final-commit acceptance. The shared release-registry recipe checks the package and registry already declared in your publication configuration, without uploading. Set TAG to the intended stable release tag in canonical vX.Y.Z format, such as v1.2.3:

TAG=v1.2.3
just release-registry "$TAG" --expect absent

Use --expect present to require an existing version. Lookup failures stop the check; they never count as absence. Full publication verification still requires just release-verify "$TAG" and the repository's post-publication checks.

With the installed CLI on PATH, release visibility checks an immutable release on GitHub and the registry from any directory. Pass each required asset by its exact filename. This example checks a crate release and its benchmark archive.

research-repo-tools release visibility v1.2.3 \
  --repository example/library --registry crates-io --package example-library \
  --required-asset benchmark-1.2.3.tar.gz --attempts 7 --interval 10

The command requires completed, nonempty assets and prints the crates.io archive checksum. Use --target PATH to also require the captured release ID and tag commit. Only an exact registry 404 permits another poll.

The release assets plan command verifies independent repository/tag/commit and push-event assertions, protected-default-branch ancestry, required checks, metadata, generated notes and original signed evidence. release assets prepare-authenticated authenticates the retained handoff's workflow/run/attempt and immutable artifact ID/digest before composing the existing draft writer. CI writers use the isolated, exactly pinned, no-checkout invocation in the two-job workflow and recovery guide. Preserve the complete original state for recovery; a new run or missing journal cannot authorize another draft.

The following recipe is for a trusted local project environment. It executes the project's Justfile and uses its uv environment:

just release-assets prepare /trusted/evidence.toml \
  --repository owner/repository --tag v1.2.3 --commit FULL_COMMIT \
  --expected /trusted/selection.json --expected-title v1.2.3 \
  --notes /trusted/notes.md --receipt /durable/draft-receipt.json \
  --output /trusted/target.json --approve

This creates an unpublished stable draft or retains an exact matching draft and its assets. Preserve the original receipt for every retry: missing or replaced captured IDs reject, and ambiguous creation requires explicit recovery. The guide covers immutable handoff authentication, least privilege, and the supplying-release adoption gate.

Consumers can declare the following assertions alongside their existing [tool.research-repo-tools.publishing] settings:

expected-title = "tag"
generated-notes = true
require-immutable = true

The draft gate and immediate publication check require the tag title and generated changelog notes. Comparison permits CRLF and one terminal newline, preserving all other whitespace. Drafts remain mutable; published-event and final verification require immutability when declared. Pass the same --target /durable/target.json to just release-publish TAG, the workflow's release gate TAG, and just release-verify TAG to preserve the captured release ID across all stages. These assertions reject drift without editing the release; omitted settings preserve existing title/notes/immutability policy.

After the preparation workflow succeeds, Step 2 can retrieve its original authenticated target with just release-assets retrieve. The command freezes the original run/attempt/artifact ID/digest and revalidates that selection on retry. Configure the exact workflow and required steps as shown in the retrieval guide.

Stage a batch of original files on that captured draft with an asset policy containing schema=1, repository="owner/repository" and expected-title="tag". Run from the observed checkout using Python from a trusted, pinned installation outside it (shown as /trusted/release-tools):

/trusted/release-tools/bin/python -I -m research_repo_tools release assets stage tooling/release-assets.toml \
  --checkout . --commit FULL_COMMIT --tag v1.2.3 \
  --target /durable/target.json --asset /durable/final-policy.json \
  --asset /durable/accepted.json --asset /durable/benchmark.tar.gz \
  --journal /durable/staging.json --output /durable/transfer.json --approve

Keep the journal and original files on interruption, then repeat the same command. It verifies matching assets without uploading them again; replaced IDs, changed inputs and conflicting receipts stop recovery. The complete transfer is retained only after every asset and a fresh dependency pass are verified. Staging never publishes the draft or reacquires measurements. --progress json provides machine-readable status. See the batch contract for freshness, input bounds and environment requirements.

For Python releases, set package-kind = "python" and guarantee = "python-distributions" in the evidence policy. Explicit selection reads the Python project even beside a virtual Cargo workspace; existing automatic selection remains Cargo-first. Declare the exact wheel/sdist filename templates and PyPI destination:

[distributions]
files = ["example_app-{version}-py3-none-any.whl", "example_app-{version}.tar.gz"]
index-url = "https://test.pypi.org"
max-age-seconds = 86400

The consumer builds once and runs its native installed-package, scientific and security checks against those files. Run the following evidence commands from a separate trusted controller project, with its installed recipes and policies; /path/to/source is the observed checkout, not the controller's project environment. In a subsequent evidence job of the same trusted push attempt, capture the manifest before any tag exists:

just release-evidence create tooling/release-evidence.toml \
  --checkout /path/to/source --commit FULL_COMMIT --version 1.2.3 \
  --run-id RUN_ID --attempt ATTEMPT --distributions /path/to/dist \
  --output /trusted/validation.json

Retain the manifest and exact distributions in the attempt-specific artifact declared by the policy. Add a signature bundle only when a signing job is configured. Wait for the exact main-push workflow, then select and approve that evidence. Revalidate the original selection and publication files before credentials:

just release-evidence wait tooling/release-evidence.toml \
  --commit FULL_COMMIT --attempts 241 --interval 30
just release-evidence verify tooling/release-evidence.toml \
  --checkout /path/to/source --commit FULL_COMMIT --version 1.2.3 \
  --distributions /path/to/dist --output /trusted/selection.json
# After approval, immediately before the consumer's publication step:
just release-evidence verify tooling/release-evidence.toml \
  --checkout /path/to/source --commit FULL_COMMIT --version 1.2.3 \
  --distributions /path/to/dist --expected /trusted/selection.json \
  --output /trusted/revalidated.json
# After the consumer uploads those exact files to the configured destination:
just release-evidence published tooling/release-evidence.toml \
  --checkout /path/to/source --commit FULL_COMMIT --version 1.2.3 \
  --expected /trusted/selection.json --output /trusted/published.json

wait only observes the declared workflow and exact commit; it does not install tools, build, download artifacts or approve evidence. Choose its polling budget for the complete producer pipeline and allow additional time in the enclosing job for setup, API requests and verification. The example permits two hours of retry delay; longer pipelines can select up to 721 polls. The verifier remains a fresh, single-pass check after waiting and before publication.

published checks registry inventory, metadata, hashes and downloaded bytes; version presence alone does not prove byte identity. It performs no upload. See the evidence guarantees and complete-run recovery. These Python interfaces require an exact published supplying version containing this contract, verified through ordinary wheel/sdist and locked consumer installs before adoption; a merged source change or editable checkout is insufficient.

To retain Python evidence before choosing a registry, replace index-url with destination = "undecided" in [distributions]. This explicit state is not publishable and published rejects it. Omitting both fields retains the existing PyPI-bound default. Later, approve the original selection and unchanged files using a separate trusted authority policy, for example tooling/registry.toml:

schema = 1
index-url = "https://test.pypi.org"
account = "publishing-account"
project = "example-app"
repository = "owner/repository"
workflow = ".github/workflows/publish.yml"
environment = "registry-approval"
protocol = "pypi-json"
authentication = "none"

authentication declares the registry verification protocol. Authenticated private registry APIs and arbitrary Simple indexes are unsupported and fail without falling back to PyPI. The consumer owns upload credentials and verifies that its approval environment and publisher match the declared authority.

just release-evidence approve-python tooling/release-evidence.toml \
  --authority tooling/registry.toml --commit FULL_COMMIT --version 1.2.3 \
  --distributions /path/to/dist --expected /trusted/selection.json \
  --output /trusted/approval.json --approve
# Immediately before the consumer requests credentials:
just release-evidence verify-python-approval tooling/release-evidence.toml \
  --authority tooling/registry.toml --commit FULL_COMMIT --version 1.2.3 \
  --distributions /path/to/dist --expected /trusted/selection.json \
  --approval /trusted/approval.json --output /trusted/verified-approval.json
# After upload, including an uncertain outcome, inspect before any retry:
just release-evidence published-python tooling/release-evidence.toml \
  --authority tooling/registry.toml --commit FULL_COMMIT --version 1.2.3 \
  --distributions /path/to/dist --expected /trusted/selection.json \
  --approval /trusted/approval.json --output /trusted/published-approval.json

These commands revalidate the original provider run, attempt, gates, artifact and distribution bytes. A different endpoint or publisher requires new approval; registry-bound evidence cannot change its original endpoint. Approval records must cross a trusted handoff, and never authorize rebuilding, selecting newer evidence or automatically retrying uploads.

Contributing

See CONTRIBUTING.md for package development, tests and maintainer commands. Supported interfaces defines the consumer compatibility boundary.

Citation

If you use research-repo-tools in your work, cite the software using CITATION.cff. Include the version used so others can identify the same release. The Zenodo concept DOI covers all versions; use the version-specific DOI from the corresponding Zenodo record when citing an exact release.

License

BSD-3-Clause. See LICENSE.

Metadata

Release files for research-repo-tools 0.3.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 research-repo-tools 0.3.0
File Size Uploaded Provenance Actions
research_repo_tools-0.3.0.tar.gz 1.6 MB With provenance Details for research_repo_tools-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for research-repo-tools 0.3.0
File Interpreter ABI Platform Actions
research_repo_tools-0.3.0-py3-none-any.whl Python 3 none any Details for research_repo_tools-0.3.0-py3-none-any.whl

Total release size: 2.3 MB

Release files / research_repo_tools-0.3.0.tar.gz

Download URL research_repo_tools-0.3.0.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
43c64bc1b3c727914a98f0d86361805502d801bb15f63b9aec31a31c49ca565e
BLAKE2b-256 checksum
How to use checksums
6dfbc94323c20809eec0cd945c07deb19eea0d59fda804de548ac9ee6b677fa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / research_repo_tools-0.3.0-py3-none-any.whl

Download URL research_repo_tools-0.3.0-py3-none-any.whl
Size 680.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef0691e0eb8009da2c0fc23990532ac9c8f16fd7451725011495b4d096663be3
BLAKE2b-256 checksum
How to use checksums
424723198b9d0feed97902fea7fdc51bc19b5dd6e2d12222c0a8c3749c01709c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for research-repo-tools 0.3.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for research_repo_tools-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

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