Skip to main content

temper-python

The Temper adapter for pytest. A test states what it proves; the adapter records how it ended; temper matrix turns those records into a matrix of what is proven and what is not.

Getting started

You need the temper CLI (install) and a project with temper.yml and a temper/ directory of declarations. temper guide explains both.

1. Install the adapter.

pip install temper-python

It is a pytest plugin: nothing to import or enable.

2. Mark each test with what it proves.

import pytest

@pytest.mark.covers("store.reserve.never_negative", subject="store.file")
def test_reserve_never_goes_negative(): ...

@pytest.mark.exempts("store.persists_across_restart", subject="store.memory")
def test_memory_store_forgets_on_restart(): ...

3. Run the tests through temper run, then build the matrix.

temper clean
temper run --level unit -- pytest
temper matrix --all-levels

That is the whole integration. Plain pytest behaves exactly as before: without the variables temper run sets, the plugin records nothing.

What a test can say

Mark Meaning
@pytest.mark.covers(ref) The test proves a feature or lattice member (lattice/key).
@pytest.mark.covers(ref, subject=id) The test proves an invariant or lattice member for that subject.
@pytest.mark.exempts(ref, subject=id) The test proves the subject is excused. Use it only in the test a declaration names in proven_by.
scenario=id (on either) The claim came from that declared scenario.

Marks on a class or a module apply to every test inside. A test may carry many marks; each is one record with the same outcome.

A scenario runner that parametrizes one test over many scenarios claims from inside the test, where the scenario is known:

import temper

@pytest.mark.parametrize("sid", SCENARIOS)
def test_scenario(request, sid):
    temper.covers(request, "alerts.low_stock", scenario=sid)
    temper.covers(request, sid, scenario=sid)
    ...

temper.exempts(request, ref, subject=...) is the same for exemptions.

There is no way to set a level. The runner does (temper run --level), and a test that changes TEMPER_LEVEL in its own environment changes nothing: the environment is read once, when pytest starts.

A malformed mark (no reference, a stray keyword such as level=, a non-string) stops the run with a message naming the test, when the runner is active.

How outcomes are recorded

A record is written once the test is final, after fixtures have torn down.

Outcome When
pass The test, its setup and its teardown all passed. The only outcome that counts.
fail An assertion failed, pytest.fail was called, or the test was xfail (whether it failed or passed).
skip The test was skipped, in any phase.
error An exception other than a failed assertion, or any failure in setup or teardown.

A test that fails and then skips records fail. Evidence goes to one new file per process, <level>-<pid>-<8 hex>.jsonl, opened for append, one write per line. Existing evidence is never truncated, so pytest-xdist works without configuration. The contract every adapter follows is docs/adapters.md.

Not verified: retry plugins such as pytest-rerunfailures.

Development

python -m venv .venv && .venv/bin/pip install -e '.[dev]'
make matrix        # clean, run the tests through temper, rebuild MATRIX.md
make check-matrix  # fail if the committed matrix is stale

This project is declared with Temper in temper/, and its own tests prove the adapter claims with the adapter: see MATRIX.md.

Releasing

Set version in pyproject.toml, merge, then push the matching tag:

git tag v0.1.0 && git push origin v0.1.0

The release workflow checks the tag matches the version, runs the tests, builds, and publishes to PyPI through trusted publishing.

Metadata

Release files for temper-python 0.1.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 temper-python 0.1.0
File Size Uploaded Provenance Actions
temper_python-0.1.0.tar.gz 12.9 kB With provenance Details for temper_python-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for temper-python 0.1.0
File Interpreter ABI Platform Actions
temper_python-0.1.0-py3-none-any.whl Python 3 none any Details for temper_python-0.1.0-py3-none-any.whl

Total release size: 20.4 kB

Release files / temper_python-0.1.0.tar.gz

Download URL temper_python-0.1.0.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f89b84443360c11dbc808841e680b5e6291e41f117c64b81e2521a9ae485cb82
BLAKE2b-256 checksum
How to use checksums
d867e6f21aa4de44fc957bf740d85968fe967f206a994b21c37cd5a2ec0e5ad2
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 15, 2026.

Transparency log

Release files / temper_python-0.1.0-py3-none-any.whl

Download URL temper_python-0.1.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af5be125eb12a6d3bb073ba8fe21f4e4c8bead39c89efd6b91e4b6b183f88671
BLAKE2b-256 checksum
How to use checksums
473afaa435ea7457c34b45990e4afd605e354b910fbf1ebc34d50943d0342a13
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 15, 2026.

Transparency log

Security for temper-python 0.1.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 temper_python-0.1.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 15, 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.1.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