anys
Matchers for pytest
Decision gist · record as of 2026-08-14
Yes. This is a lightweight, well-maintained testing utility with no dependencies, permissive licensing, and active development. It solves a real problem in unit testing—validating dynamic or partially-known values—and integrates seamlessly with pytest assertions. The API is straightforward, and the matcher composition model is flexible. Install it if you write tests with pytest and encounter fields you can't assert exactly.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or higher.
- Low friction installation with no runtime dependencies.
- Actively maintained with recent commits; last release was 2024-12-01, and the repository shows ongoing activity.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, making it safe for both open-source and commercial projects.
last release 2024-12-01 (621 days) · last repo commit 2026-07-20 · 26 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 953,611 downloads/mo, #4,650 on PyPI
Alternatives
Verify before relying
from anys import ANY_DATETIME_STR, AnyGT
assert response == {
"status": "ok",
"timestamp": ANY_DATETIME_STR,
"count": AnyGT(0)
}- Whether matchers work correctly when nested in custom class instances with non-standard __eq__ implementations.
- Performance characteristics when combining many matchers with & and | operators on large data structures.
What it is and what it does
anys is a testing utility that provides matcher objects for writing more flexible assertions in unit tests. Instead of comparing exact values, matchers let you assert that a value meets a criterion—such as being a valid ISO 8601 datetime string, falling within a numeric range, matching a regex pattern, or having specific attributes. This is especially useful when testing code that produces values you can't predict in advance (like timestamps or generated IDs) but still need to validate.
The package exports pre-built matchers for common types (ANY_INT, ANY_STR, ANY_DATETIME_STR, etc.) and composable matcher classes (AnyGT, AnyMatch, AnyWithAttrs, etc.) that you combine with standard Python equality comparisons. Matchers can be nested in dictionaries, lists, and other structures, and combined using & (both must match) and | (either may match) operators. It has no runtime dependencies and supports Python 3.8 through 3.13 on both CPython and PyPy.
Use it for
- Assert that API responses contain valid timestamps or UUIDs without hardcoding exact values.
- Validate nested data structures where some fields are dynamic but must meet type or pattern constraints.
- Check that function return values fall within expected numeric ranges without manual boundary comparisons.
- Test objects with attributes that vary between runs (e.g., creation times) while verifying other fields exactly.
- Combine multiple criteria to match complex values—e.g., strings matching a regex AND containing a substring.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a lightweight, well-maintained testing utility with no dependencies, permissive licensing, and active development. It solves a real problem in unit testing—validating dynamic or partially-known values—and integrates seamlessly with pytest assertions. The API is straightforward, and the matcher composition model is flexible. Install it if you write tests with pytest and encounter fields you can't assert exactly.
Install
anys on PyPI
Before you install
Low friction installation with no runtime dependencies. Actively maintained with recent commits; last release was 2024-12-01, and the repository shows ongoing activity.
Requires Python 3.8 or higher.
License in practice
MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, making it safe for both open-source and commercial projects.
Quickstart
from anys import ANY_DATETIME_STR, AnyGT
assert response == {
"status": "ok",
"timestamp": ANY_DATETIME_STR,
"count": AnyGT(0)
}
Verify before relying
- Whether matchers work correctly when nested in custom class instances with non-standard __eq__ implementations.
- Performance characteristics when combining many matchers with & and | operators on large data structures.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 621 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 953,611 / month, #4,650 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: TestingTopic :: Software Development :: Testing :: UnitTyping :: Typed |
Evidence: anys-0.3.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytest assertion matchers”
- anysProvides matcher objects that compare equal to values meeting…
- expectsExpects is an assertion library for TDD/BDD that lets you write test…
- pytest-mypy-pluginsA pytest plugin that runs type-checking tests against mypy by…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also PyHamcrest · callee · re-assert · pytest-unordered · libsast · pampy · dirty-equals · robotframework-assertion-engine · pytest-clarity · expects