Skip to main content

mtchrs

build codecov

mtchrs provides composable matchers that can be nested inside any data structure. Use them in tests where values like database IDs or UUIDs change between runs. Matchers also integrate with unittest.mock assertions such as call_args_list for verifying mock calls.

The persistent matcher mtch.eq() is especially handy for tracking values that must stay identical across nested results or several steps of a workflow.

Installation

pip install mtchrs

Example

from mtchrs import mtch

data = {"id": 1, "items": ["xyz", 1.5]}
matcher = {"id": mtch.type(int), "items": [mtch.regex(r"x.*"), mtch.type(float)]}
assert matcher == data

assert mtch.partial_dict({"id": mtch.type(int)}) == data
assert mtch.unordered(["red", "blue"]) == ["blue", "red"]

Contributing

Pull requests are welcome! Install the dependency groups using uv and run the linters and test suite before submitting a PR:

uv sync --all-groups
uv run pre-commit run --all-files
uv run pytest

License

This project is licensed under the MIT License.

Documentation

See the documentation for more details.

Metadata

Release files for mtchrs 0.2.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 mtchrs 0.2.0
File Size Uploaded Provenance Actions
mtchrs-0.2.0.tar.gz 8.4 kB With provenance Details for mtchrs-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mtchrs 0.2.0
File Interpreter ABI Platform Actions
mtchrs-0.2.0-py3-none-any.whl Python 3 none any Details for mtchrs-0.2.0-py3-none-any.whl

Total release size: 14.9 kB

Release files / mtchrs-0.2.0.tar.gz

Download URL mtchrs-0.2.0.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7362faaa53d45495ac02de9ccb80add3a4d01035a3b2b2809f81ca589807ce55
BLAKE2b-256 checksum
How to use checksums
f6b2415cadf0df7805d749ee03b3ecdbf07a6d31289f974396fc37e9b115f9c7
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 10, 2026.

Transparency log

Release files / mtchrs-0.2.0-py3-none-any.whl

Download URL mtchrs-0.2.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
646c43d2f82dc07170b54ab82db6b148d767d03e3a1ce72964fac71e174fb456
BLAKE2b-256 checksum
How to use checksums
73b69a62b26b375b0e88227d4987cae362a7d52afc14b7d4bd1bbec991ac2762
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 10, 2026.

Transparency log

Security for mtchrs 0.2.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 mtchrs-0.2.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 10, 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