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.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 gz-mutation-witness 0.3.0
File Size Uploaded Provenance Actions
gz_mutation_witness-0.3.0.tar.gz 13.1 kB With provenance Details for gz_mutation_witness-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 28.0 kB

Release files / gz_mutation_witness-0.3.0.tar.gz

Download URL gz_mutation_witness-0.3.0.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
836d941731c19cdb4b048f5561fdeae65171417047a2ba290aec90861d1d037f
BLAKE2b-256 checksum
How to use checksums
e922ebe3109923a6e63096c815d9a3e3b10ac49958872622428829a85e8a5c2e
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.0-py3-none-any.whl

Download URL gz_mutation_witness-0.3.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f2a551b9db80474176dbcda30004d2590e0981baf85e5d1e1e824171349b449
BLAKE2b-256 checksum
How to use checksums
a55621d00b5f4cb70288d011c94cf5b62e3b65f949f0a47fbc3b19a22608fb40
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.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 gz_mutation_witness-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 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