Skip to main content

MetricProof-NWB

Tests PyPI

Reproducible evidence reports for NWB files.

Release history is tracked in CHANGELOG.md.

MetricProof-NWB complements schema and best-practice validators by preserving the evidence around an audit: the input path, SHA-256 digest, selected NWB metadata, validation findings, warnings, and timestamp. That makes a result easier to attach to a paper, archive submission, or CI run.

Version 0.3 can run PyNWB and NWBInspector as separate, independently versioned validators. Reports preserve NWBInspector's check name, importance, object, location, and message while recording each validator's version and effective configuration. They use MetricProof's shared evidence envelope: producer identity, artifact fingerprints, structured results, execution context, and explicit schema versioning.

It also provides a session evidence ledger. A ledger inventories the files that travel together, records parent/child lineage, and makes review gates explicit. The checks are configuration-driven: sample rates, graph nodes, expected counts, required files, and curation policy come from the session manifest, not from hard-coded HexMaze or laboratory constants.

Install

The base package depends only on MetricProof. Install the PyNWB extra for schema validation, the Inspector extra for PyNWB plus NWBInspector, or all optional validators:

python -m pip install "metricproof-nwb[nwb]"
python -m pip install "metricproof-nwb[inspector]"
python -m pip install "metricproof-nwb[all]"

Usage

metricproof-nwb audit session.nwb
metricproof-nwb audit session.nwb --format json --output evidence.json
metricproof-nwb audit session.nwb \
  --nwbinspector \
  --artifact-uri archive://study/session.nwb \
  --format json \
  --output evidence.json

Create and use a session manifest:

metricproof-nwb manifest path/to/session --output session-manifest.json
metricproof-nwb audit path/to/session/session.nwb \
  --manifest session-manifest.json --format json --output proof.json
metricproof-nwb bundle proof.json --output proof.html
metricproof-nwb verify proof.json

verify rehashes every local artifact and distinguishes a changed file (fail), a missing handoff (incomplete), and a remote or undigested object that still needs a human check (needs_review). The HTML bundle is offline and includes the artifact graph, exact hashes, validator findings, and review reasons so it can be attached to a paper, archive submission, or CI artifact.

For session-specific checks, pass a JSON object to --session-json when creating the manifest. For example:

{
  "session": {
    "session_id": "hexmaze-2026-08-21-01",
    "timebases": [{"name": "lfp", "rate": 1500, "sample_count": 3000, "start": 0, "stop": 2}],
    "curation": {"human_reviewed": true, "recompute_required": true, "recomputed": true}
  },
  "config": {
    "required_artifacts": ["session.nwb"],
    "node_ids": ["start", "goal"],
    "graph_edges": [["start", "goal"]]
  }
}

The checks cover artifact inventory and lineage, placeholder metadata, timebase consistency, recording durations, trial intervals and graph paths, declared NWB/file/unit counts, and curation gates. A report can therefore be technically valid while still being marked needs_review or incomplete when a human handoff is not evidenced.

The JSON document conforms to MetricProof's bundled evidence schema:

metricproof schema evidence

Its top-level report_type is nwb-audit; the audited file appears in artifacts, each validator has a separate entry in results, selected NWB metadata is stored in context.nwb_metadata, and software provenance is stored in context.validators. JSON keys are sorted before writing, so equivalent audits produce stable evidence files that are easier to diff and archive.

NWBInspector is called with skip_validate=True because MetricProof-NWB already runs PyNWB separately. This avoids duplicate schema findings while retaining a clear version and configuration for each validator. Best-practice suggestions and violations are preserved but do not fail the audit; critical findings and validator execution errors do.

The command exits with 0 when all critical checks pass, 1 when a critical validator or session check fails, 2 when the audit cannot run (for example, when PyNWB is not installed or the file cannot be opened), and 3 when a manifest completes with a non-blocking needs_review handoff state.

The Python API accepts injectable validator and metadata functions so projects can add study-specific checks without coupling their tests to one PyNWB release:

from metricproof_nwb import (
    audit_nwb,
    nwbinspector_validator,
    pynwb_validator,
)

report = audit_nwb(
    "session.nwb",
    validators=[pynwb_validator(), nwbinspector_validator()],
)
print(report.sha256)
print(report.validators)
print(report.inspector_findings)
print(report.to_dict())

The compatibility properties (status, sha256, size_bytes, validation_errors, and exit_code) remain available, while report.report provides direct access to the underlying metricproof.EvidenceReport.

The Python API exposes the same ledger primitives:

from metricproof_nwb import build_manifest, run_session_checks, verify_manifest

manifest = build_manifest("path/to/session", session={"session_id": "s-01"})
summary = run_session_checks(manifest)
verification = verify_manifest(manifest, base_dir="path/to/session")
print(summary.status, verification.status)

Reproducible example

examples/academic_workflow contains a bundled, synthetic extracellular-electrophysiology NWB file and the evidence JSON created from that exact artifact. The workflow verifies the report's SHA-256 digest and shows why validator versions matter when findings change over time.

See Validator responsibilities for a precise comparison of PyNWB validation, NWBInspector, dandi validate, and MetricProof-NWB.

Development

$env:PYTHONPATH = (Resolve-Path src).Path
python -m unittest discover -s tests -v

On macOS or Linux, use export PYTHONPATH="$PWD/src" instead.

Scope

MetricProof-NWB does not replace PyNWB validation, NWBInspector, or DANDI validation. It records their result alongside file identity and metadata so a research workflow can show exactly what was checked. It also does not infer scientific correctness from a complete manifest: a clean handoff is evidence of traceability, not a substitute for experimental judgment or domain review.

Metadata

Release files for metricproof-nwb 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 metricproof-nwb 0.3.0
File Size Uploaded Provenance Actions
metricproof_nwb-0.3.0.tar.gz 96.9 kB With provenance Details for metricproof_nwb-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for metricproof-nwb 0.3.0
File Interpreter ABI Platform Actions
metricproof_nwb-0.3.0-py3-none-any.whl Python 3 none any Details for metricproof_nwb-0.3.0-py3-none-any.whl

Total release size: 125.3 kB

Release files / metricproof_nwb-0.3.0.tar.gz

Download URL metricproof_nwb-0.3.0.tar.gz
Size 96.9 kB
Tags Source
SHA-256 checksum
How to use checksums
08936bb3752c1c735ee24d418c3d9e365fea292306337a22d73c009f95686cdd
BLAKE2b-256 checksum
How to use checksums
eac6f1edb35c90387fb85bbcf8374982d624d4927a235c51c1c407f2fab54f7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 26, 2026.

Transparency log

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

Download URL metricproof_nwb-0.3.0-py3-none-any.whl
Size 28.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a57c06e16ae4eb3778a6f02b4aed2ee34af02072218f99d5a3b41e90cf3400b7
BLAKE2b-256 checksum
How to use checksums
2206dfa091273ec033bf26b8c88393bfd091b308cd333ca7ffdbc9f8727cef45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 26, 2026.

Transparency log

Security for metricproof-nwb 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 metricproof_nwb-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 Aug 26, 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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full 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