1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
[build-system]
# require a recent setuptools for `license = ` support
requires = ["setuptools >= 78.1.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "hypothesis"
# see [tool.setuptools.dynamic]
dynamic = ["version"]
authors = [
{ name = "David R. MacIver and Zac Hatfield-Dodds", email = "david@drmaciver.com" }
]
description = "A library for property-based testing"
# Avoid changing this by hand. This is automatically updated by update_changelog_and_version
readme = {"text" = """<div align="center">
<img src="https://raw.githubusercontent.com/HypothesisWorks/hypothesis/master/brand/dragonfly-rainbow.svg" width="300">
</div>
# Hypothesis
* [Website](https://hypothesis.works/)
* [Documentation](https://hypothesis.readthedocs.io/en/latest/)
* [Source code](https://github.com/hypothesisWorks/hypothesis/)
* [Contributing](https://github.com/HypothesisWorks/hypothesis/blob/master/CONTRIBUTING.rst)
* [Community](https://hypothesis.readthedocs.io/en/latest/community.html)
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:
```python
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 example — it reports the simplest possible one. This makes property-based tests a powerful tool for debugging, as well as testing.
For instance,
```python
def my_sort(ls):
return sorted(set(ls))
```
fails with the simplest possible failing example:
```
Falsifying example: test_matches_builtin(ls=[0, 0])
```
### Installation
To install Hypothesis:
```
pip install hypothesis
```
There are also [optional extras available](https://hypothesis.readthedocs.io/en/latest/extras.html).
""", "content-type" = "text/markdown"}
license = "MPL-2.0"
requires-python = ">= 3.10"
keywords = ["python", "testing", "fuzzing", "property-based-testing"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Hypothesis",
"Framework :: Pytest",
"Intended Audience :: Developers",
"Operating System :: Unix",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Education :: Testing",
"Topic :: Software Development :: Testing",
"Typing :: Typed",
]
dependencies = [
"exceptiongroup>=1.0.0; python_version<'3.11'",
"sortedcontainers>=2.1.0,<3.0.0",
]
[project.urls]
homepage = "https://hypothesis.works"
source = "https://github.com/HypothesisWorks/hypothesis"
changelog = "https://hypothesis.readthedocs.io/en/latest/changelog.html"
documentation = "https://hypothesis.readthedocs.io"
issues = "https://github.com/HypothesisWorks/hypothesis/issues"
[project.optional-dependencies]
cli = ["click>=7.0", "black>=20.8b0", "rich>=9.0.0"]
codemods = ["libcst>=0.3.16"]
ghostwriter = ["black>=20.8b0"]
pytz = ["pytz>=2014.1"]
dateutil = ["python-dateutil>=1.4"]
lark = ["lark>=0.10.1"] # probably still works with old `lark-parser` too
numpy = ["numpy>=1.21.6"] # oldest with wheels for non-EOL Python (for now)
pandas = ["pandas>=1.1"]
pytest = ["pytest>=4.6"]
dpcontracts = ["dpcontracts>=0.4"]
redis = ["redis>=3.0.0"]
crosshair = ["hypothesis-crosshair>=0.0.25", "crosshair-tool>=0.0.97"]
# zoneinfo is an odd one: every dependency is platform-conditional.
zoneinfo = ["tzdata>=2025.2; sys_platform == 'win32' or sys_platform == 'emscripten'"]
# We only support Django versions with upstream support - see
# https://www.djangoproject.com/download/#supported-versions
# We also leave the choice of timezone library to the user, since it
# might be zoneinfo or pytz depending on version and configuration.
django = ["django>=4.2"]
watchdog = ["watchdog>=4.0.0"]
# Avoid changing this by hand. This is automatically updated by update_changelog_and_version
all = ["black>=20.8b0", "click>=7.0", "crosshair-tool>=0.0.97", "django>=4.2", "dpcontracts>=0.4", "hypothesis-crosshair>=0.0.25", "lark>=0.10.1", "libcst>=0.3.16", "numpy>=1.21.6", "pandas>=1.1", "pytest>=4.6", "python-dateutil>=1.4", "pytz>=2014.1", "redis>=3.0.0", "rich>=9.0.0", "tzdata>=2025.2; sys_platform == 'win32' or sys_platform == 'emscripten'", "watchdog>=4.0.0"]
[tool.setuptools.dynamic]
version = {attr = "hypothesis.version.__version__"}
[tool.setuptools.package-data]
hypothesis = ["vendor/tlds-alpha-by-domain.txt"]
[project.scripts]
hypothesis = "hypothesis.extra.cli:main"
[project.entry-points.pytest11]
hypothesispytest = "_hypothesis_pytestplugin"
[tool.coverage.run]
parallel = true
branch = true
source = ["hypothesis"]
omit = [
"**/_hypothesis_ftz_detector.py",
"**/_hypothesis_pytestplugin.py",
"**/_hypothesis_globals.py",
"**/extra/array_api.py",
"**/extra/cli.py",
"**/extra/django/*.py",
"**/extra/ghostwriter.py",
"**/extra/pytestplugin.py",
"**/internal/scrutineer.py",
"**/utils/terminal.py",
"**/internal/conjecture/provider_conformance.py",
# covered by our attrs tests in check-niche
"**/strategies/_internal/attrs.py"
]
[tool.coverage.report]
fail_under = 100
show_missing = true
skip_covered = true
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError",
"def __repr__",
"def _repr_pretty_",
"def __ne__",
"def __copy__",
"def __deepcopy__",
"except ImportError:",
"except ModuleNotFoundError:",
"if PYPY:",
"if TYPE_CHECKING:",
"if sys\\.version_info",
"if \"[\\w\\.]+\" in sys\\.modules:",
"if .+ := sys\\.modules\\.get\\(\"[\\w\\.]+\"\\)",
"@overload",
"if .*\\bnot .*provider.avoid_realization",
]
|