Skip to main content

gz-mutation-witness

A mutation-sweep witness for unittest suites. It applies text mutations to one source file, runs a test command per mutant in an isolated subprocess with its own bytecode cache, and reports four outcomes, keeping claims about the guard apart from claims about the run:

  • killed: a nominated test failed on an assertion in its own body (errors in other tests do not disqualify it);
  • survived: the mutant activated and no test caught it;
  • invalid: the run graded nothing (absent target, no-op edit, mutant does not compile);
  • inconclusive: the failure cannot be attributed to the guard (errors, fixtures, unrelated tests, red baseline, hang).
from gz_mutation_witness import Mutation, run_mutation_sweep

Reuse a baseline across sweeps

Create one cache for a batch of sequential sweeps over stable test inputs.

from gz_mutation_witness import BaselineCache, run_mutation_sweep

cache = BaselineCache()
run_mutation_sweep(root, source, first_mutations, command, baseline_cache=cache)
run_mutation_sweep(root, source, follow_up_mutations, command, baseline_cache=cache)

A baseline is reused when the project, target path, target bytes, and command match an observation in that cache. Create a fresh cache if other test inputs change, including other source files, tests, configuration, dependencies, the environment, executable resolution, or external fixtures. A red baseline keeps the affected mutants inconclusive. A timed-out baseline is retried on the next sweep. Omitting the cache runs a fresh baseline each time.

Provenance

Extracted as-is from gzkit at commit a06a4f36a8e3fc538d8f20b61df91b9bf42d1ee7: src/gzkit/mutation_witness.py, src/gzkit/executables.py, classify_failure from src/gzkit/red_witness.py and read_test_observations from src/gzkit/unit_run_provenance.py, with their tests. Only import paths changed.

Development

uv sync --locked
uv run --locked pre-commit run --all-files

Run the project verifier and its unittest suite directly with uv run --locked gz-starter verify --project .. For on-demand class cohesion, run uv run --locked --group hygiene cohesion -d src.

Metadata

Release files for gz-mutation-witness 0.3.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 gz-mutation-witness 0.3.1
File Size Uploaded Provenance Actions
gz_mutation_witness-0.3.1.tar.gz 17.5 kB With provenance Details for gz_mutation_witness-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gz-mutation-witness 0.3.1
File Interpreter ABI Platform Actions
gz_mutation_witness-0.3.1-py3-none-any.whl Python 3 none any Details for gz_mutation_witness-0.3.1-py3-none-any.whl

Total release size: 38.2 kB

Release files / gz_mutation_witness-0.3.1.tar.gz

Download URL gz_mutation_witness-0.3.1.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ea3dbe558e2a46ee6bab1c94ec8be3db36fb70c4cb771d0ea88ec98992518a47
BLAKE2b-256 checksum
How to use checksums
d78ce5539cab39713773d37455c0f814beec6bca06a70315b425f930d3ae5f23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 22, 2026.

Transparency log

Release files / gz_mutation_witness-0.3.1-py3-none-any.whl

Download URL gz_mutation_witness-0.3.1-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bd8b6b113e503029c1d41da6cd1dee409325c7ad7581216db260327d90a859b
BLAKE2b-256 checksum
How to use checksums
05fad05db21a40acc6dac6c0977c8e90507266f6c2c0868d24cded76e877d5a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 22, 2026.

Transparency log

Security for gz-mutation-witness 0.3.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.

Full provenance

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

Select from 2 files

Attestation for gz_mutation_witness-0.3.1.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 22, 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