hypothesis
The property-based testing library for Python
Install
hypothesis on PyPI
pip
pip install hypothesisuv
uv add hypothesispoetry
poetry add hypothesisPackage facts
| License | MPL-2.0 (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 2 — exceptiongroup, sortedcontainers |
| Maintenance | actively maintained — 1 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: hypothesis-6.165.5-cp310-abi3-macosx_10_12_x86_64.whl; hypothesis-6.165.5-cp310-abi3-macosx_11_0_arm64.whl; hypothesis-6.165.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; hypothesis-6.165.5-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; hypothesis-6.165.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; hypothesis-6.165.5-cp310-abi3-manylinux_2_31_riscv64.whl; hypothesis-6.165.5-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl; hypothesis-6.165.5-cp310-abi3-musllinux_1_2_aarch64.whl; hypothesis-6.165.5-cp310-abi3-musllinux_1_2_armv7l.whl; hypothesis-6.165.5-cp310-abi3-musllinux_1_2_riscv64.whl; hypothesis-6.165.5-cp310-abi3-musllinux_1_2_x86_64.whl; hypothesis-6.165.5-cp310-abi3-win32.whl; hypothesis-6.165.5-cp310-abi3-win_amd64.whl; hypothesis-6.165.5-cp310-cp310-macosx_10_12_x86_64.whl; hypothesis-6.165.5-cp310-cp310-macosx_11_0_arm64.whl; hypothesis-6.165.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; hypothesis-6.165.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; hypothesis-6.165.5-cp310-cp310-musllinux_1_2_aarch64.whl; hypothesis-6.165.5-cp310-cp310-musllinux_1_2_x86_64.whl; hypothesis-6.165.5-cp310-cp310-win_amd64.whl
Keywords: python, testing, fuzzing, property-based-testing
About hypothesis
from the package's own PyPI description — quoted content, verbatim
<div align="center"> <img src="https://raw.githubusercontent.com/HypothesisWorks/hypothesis/master/brand/dragonfly-rainbow.svg" width="300"> </div>
Hypothesis
Hypothesis is the property-based testing library for Python. With Hypothesis, you write tests which should pass for all inputs in whatever range you describe, and let Hypothesis randomly choose which of those inputs to check - including edge cases you might not have thought about. For example:
from hypothesis import given, strategies as st
@given(st.lists(st.integers()))
def test_matches_builtin(ls):
assert sorted(ls) == my_sort(ls)
This randomized testing can catch bugs and edge cases that you didn't think of and wouldn't have found. In addition, when Hypothesis does find a bug, it doesn't just report any failing test case — it reports the simplest possible one....
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
Hypothesis is a property-based testing library that generates random test inputs across a specified range to find edge cases and bugs, then shrinks failing cases to their simplest form for easier debugging.
Medium install friction with two lightweight runtime dependencies (exceptiongroup, sortedcontainers). Active maintenance with release 1 day old and 8883 GitHub stars; supports Python 3.10–3.14 and PyPy with broad platform coverage via prebuilt wheels.
Licensed under MPL-2.0 (copyleft), requiring derivative works and modifications to be distributed under the same license; suitable for internal testing but review required before redistributing modified versions.
Usage
pip install hypothesis
from hypothesis import given, strategies as st
@given(st.lists(st.integers()))
def test_my_function(data):
assert my_function(data) == expected_result(data)
Requires Python 3.10 or later; intended for use within test suites (pytest or unittest compatible).
Verdict: Hypothesis is a mature, actively maintained property-based testing tool with strong community adoption (top 1000 PyPI). MPL-2.0 copyleft licensing requires attention in proprietary contexts. Zero known vulnerabilities and straightforward installation make it a reliable choice for developers seeking to catch subtle bugs through randomized, shrinkable test cases.
Needs verification
- Whether optional extras (mentioned in description) introduce additional dependencies or friction beyond the two runtime deps listed
- Performance characteristics and memory overhead when testing large input spaces or complex data structures
Similar packages
permissive · top 1,000 on PyPI
yarlpermissive · top 100 on PyPI
azure-datalake-storepermissive · top 1,000 on PyPI
numpypermissive · top 100 on PyPI
cattrspermissive · top 1,000 on PyPI
retryingpermissive · top 1,000 on PyPI
PyNaClpermissive · top 1,000 on PyPI
google-authpermissive · top 100 on PyPI
sortedcontainerspermissive · top 1,000 on PyPI
sphinxcontrib-applehelppermissive · top 1,000 on PyPI