|
1 | 1 | Projects using Hypothesis |
2 | 2 | ========================= |
3 | 3 |
|
4 | | -The following is a non-exhaustive list of open source projects that use Hypothesis to test their code. You can find `thousands more on GitHub <https://github.com/HypothesisWorks/hypothesis/network/dependents>`__. |
5 | | - |
6 | | -Hypothesis has `over 8 million downloads per week <https://pypistats.org/packages/hypothesis>`__, |
| 4 | +Hypothesis is downloaded `over 4 million times each week <https://pypistats.org/packages/hypothesis>`__, |
7 | 5 | and was used by `more than 5% of Python users surveyed by the PSF in 2023 |
8 | | -<https://lp.jetbrains.com/python-developers-survey-2023/>`__. |
9 | | - |
10 | | -* `argon2_cffi <https://github.com/hynek/argon2-cffi>`_ |
11 | | -* `array-api-tests <https://github.com/data-apis/array-api-tests>`_ |
12 | | -* `attrs <https://github.com/python-attrs/attrs>`_ |
13 | | -* `axelrod <https://github.com/Axelrod-Python/Axelrod>`_ |
14 | | -* `bidict <https://github.com/jab/bidict>`_ |
15 | | -* `chardet <https://github.com/chardet/chardet>`_ |
16 | | -* `cryptography <https://github.com/pyca/cryptography>`_ |
17 | | -* `dry-python/returns <https://github.com/dry-python/returns>`_ |
18 | | -* `flocker <https://github.com/ClusterHQ/flocker>`_ |
19 | | -* `hyper-h2 <https://github.com/python-hyper/h2>`_ |
20 | | -* `ivy <https://github.com/ivy-llc/ivy>`_ |
21 | | -* `MDAnalysis <https://github.com/MDAnalysis/mdanalysis>`_ |
22 | | -* `mercurial <https://www.mercurial-scm.org/>`_ |
23 | | -* `napari <https://github.com/napari/napari>`_ |
24 | | -* `natsort <https://github.com/SethMMorton/natsort>`_ |
25 | | -* `numpy <https://github.com/numpy/numpy>`_ |
26 | | -* `pandas <https://github.com/pandas-dev/pandas>`_ |
27 | | -* `pandera <https://github.com/unionai-oss/pandera>`_ |
28 | | -* `poliastro <https://github.com/poliastro/poliastro>`_ |
29 | | -* `PyPy <https://pypy.org/>`_ |
30 | | -* `pyrsistent <https://github.com/tobgu/pyrsistent>`_ |
31 | | -* `qutebrowser <https://github.com/qutebrowser/qutebrowser>`_ |
32 | | -* `srt <https://github.com/cdown/srt>`_ |
33 | | -* `vdirsyncer <https://github.com/pimutils/vdirsyncer>`_ |
34 | | -* `xarray <https://github.com/pydata/xarray>`_ |
35 | | -* `zenml <https://github.com/zenml-io/zenml>`_ |
36 | | - |
37 | | -Testimonials |
38 | | ------------- |
39 | | - |
40 | | -`Stripe <https://stripe.com>`_ |
41 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
42 | | - |
43 | | -At Stripe we use Hypothesis to test every piece of our machine |
44 | | -learning model training pipeline (powered by scikit). Before we |
45 | | -migrated, our tests were filled with hand-crafted pandas Dataframes |
46 | | -that weren't representative at all of our actual very complex |
47 | | -data. Because we needed to craft examples for each test, we took the |
48 | | -easy way out and lived with extremely low test coverage. |
49 | | - |
50 | | -Hypothesis changed all that. Once we had our strategies for generating |
51 | | -Dataframes of features it became trivial to slightly customize each |
52 | | -strategy for new tests. Our coverage is now close to 90%. |
53 | | - |
54 | | -Full-stop, property-based testing is profoundly more powerful - and |
55 | | -has caught or prevented far more bugs - than our old style of |
56 | | -example-based testing. |
57 | | - |
58 | | -`Seth Morton <https://github.com/SethMMorton>`_ |
59 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
60 | | - |
61 | | -When I first heard about Hypothesis, I knew I had to include it in my two |
62 | | -open-source Python libraries, `natsort <https://github.com/SethMMorton/natsort>`_ |
63 | | -and `fastnumbers <https://github.com/SethMMorton/fastnumbers>`_ . Quite frankly, |
64 | | -I was a little appalled at the number of bugs and "holes" I found in the code. I can |
65 | | -now say with confidence that my libraries are more robust to "the wild." In |
66 | | -addition, Hypothesis gave me the confidence to expand these libraries to fully |
67 | | -support Unicode input, which I never would have had the stomach for without such |
68 | | -thorough testing capabilities. Thanks! |
69 | | - |
70 | | -`Sixty North <https://sixty-north.com/>`_ |
71 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
72 | | - |
73 | | -At Sixty North we use Hypothesis for testing |
74 | | -`Segpy <https://github.com/sixty-north/segpy>`_ an open source Python library for |
75 | | -shifting data between Python data structures and SEG Y files which contain |
76 | | -geophysical data from the seismic reflection surveys used in oil and gas |
77 | | -exploration. |
78 | | - |
79 | | -This is our first experience of property-based testing – as opposed to example-based |
80 | | -testing. Not only are our tests more powerful, they are also much better |
81 | | -explanations of what we expect of the production code. In fact, the tests are much |
82 | | -closer to being specifications. Hypothesis has located real defects in our code |
83 | | -which went undetected by traditional test cases, simply because Hypothesis is more |
84 | | -relentlessly devious about test case generation than us mere humans! We found |
85 | | -Hypothesis particularly beneficial for Segpy because SEG Y is an antiquated format |
86 | | -that uses legacy text encodings (EBCDIC) and even a legacy floating point format |
87 | | -we implemented from scratch in Python. |
88 | | - |
89 | | -Hypothesis is sure to find a place in most of our future Python codebases and many |
90 | | -existing ones too. |
91 | | - |
92 | | -`mulkieran <https://github.com/mulkieran>`_ |
93 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
94 | | - |
95 | | -Just found out about this excellent QuickCheck for Python implementation and |
96 | | -ran up a few tests for my `bytesize <https://github.com/mulkieran/bytesize>`_ |
97 | | -package last night. Refuted a few hypotheses in the process. |
98 | | - |
99 | | -Looking forward to using it with a bunch of other projects as well. |
100 | | - |
101 | | -`Adam Johnson <https://github.com/adamchainz>`_ |
102 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
103 | | - |
104 | | -I have written a small library to serialize ``dict``\s to MariaDB's dynamic |
105 | | -columns binary format, |
106 | | -`mariadb-dyncol <https://github.com/adamchainz/mariadb-dyncol>`_. When I first |
107 | | -developed it, I thought I had tested it really well - there were hundreds of |
108 | | -test cases, some of them even taken from MariaDB's test suite itself. I was |
109 | | -ready to release. |
110 | | - |
111 | | -Lucky for me, I tried Hypothesis with David at the PyCon UK sprints. Wow! It |
112 | | -found bug after bug after bug. Even after a first release, I thought of a way |
113 | | -to make the tests do more validation, which revealed a further round of bugs! |
114 | | -Most impressively, Hypothesis found a complicated off-by-one error in a |
115 | | -condition with 4095 versus 4096 bytes of data - something that I would never |
116 | | -have found. |
117 | | - |
118 | | -Long live Hypothesis! (Or at least, property-based testing). |
119 | | - |
120 | | -`Josh Bronson <https://github.com/jab>`_ |
121 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
122 | | - |
123 | | -Adopting Hypothesis improved `bidict <https://github.com/jab/bidict>`_'s |
124 | | -test coverage and significantly increased our ability to make changes to |
125 | | -the code with confidence that correct behavior would be preserved. |
126 | | -Thank you, David, for the great testing tool. |
127 | | - |
128 | | -`Cory Benfield <https://github.com/Lukasa>`_ |
129 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
130 | | - |
131 | | -Hypothesis is the single most powerful tool in my toolbox for working with |
132 | | -algorithmic code, or any software that produces predictable output from a wide |
133 | | -range of sources. When using it with |
134 | | -`Priority <https://python-hyper.org/projects/priority/en/latest/>`_, Hypothesis consistently found |
135 | | -errors in my assumptions and extremely subtle bugs that would have taken months |
136 | | -of real-world use to locate. In some cases, Hypothesis found subtle deviations |
137 | | -from the correct output of the algorithm that may never have been noticed at |
138 | | -all. |
139 | | - |
140 | | -When it comes to validating the correctness of your tools, nothing comes close |
141 | | -to the thoroughness and power of Hypothesis. |
142 | | - |
143 | | -`Jon Moore <https://github.com/jonmoore>`_ |
144 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
145 | | - |
146 | | -One extremely satisfied user here. Hypothesis is a really solid implementation |
147 | | -of property-based testing, adapted well to Python, and with good features |
148 | | -such as failure-case shrinkers. I first used it on a project where we needed |
149 | | -to verify that a vendor's Python and non-Python implementations of an algorithm |
150 | | -matched, and it found about a dozen cases that previous example-based testing |
151 | | -and code inspections had not. Since then I've been evangelizing for it at our firm. |
152 | | - |
153 | | -`Russel Winder <https://www.russel.org.uk>`_ |
154 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
155 | | - |
156 | | - |
157 | | -I am using Hypothesis as an integral part of my Python workshops. Testing is an integral part of Python |
158 | | -programming and whilst unittest and, better, pytest can handle example-based testing, property-based |
159 | | -testing is increasingly far more important than example-base testing, and Hypothesis fits the bill. |
160 | | - |
161 | | -`Wellfire Interactive <https://wellfire.co>`_ |
162 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
163 | | - |
164 | | -We've been using Hypothesis in a variety of client projects, from testing |
165 | | -Django-related functionality to domain-specific calculations. It both speeds |
166 | | -up and simplifies the testing process since there's so much less tedious and |
167 | | -error-prone work to do in identifying edge cases. Test coverage is nice but |
168 | | -test depth is even nicer, and it's much easier to get meaningful test depth |
169 | | -using Hypothesis. |
170 | | - |
171 | | -`Cody Kochmann <https://github.com/CodyKochmann>`_ |
172 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
173 | | - |
174 | | -Hypothesis is being used as the engine for random object generation with my |
175 | | -open source function fuzzer |
176 | | -`battle_tested <https://github.com/CodyKochmann/battle_tested>`_ |
177 | | -which maps all behaviors of a function allowing you to minimize the chance of |
178 | | -unexpected crashes when running code in production. |
179 | | - |
180 | | -With how efficient Hypothesis is at generating the edge cases that cause |
181 | | -unexpected behavior occur, |
182 | | -`battle_tested <https://github.com/CodyKochmann/battle_tested>`_ |
183 | | -is able to map out the entire behavior of most functions in less than a few |
184 | | -seconds. |
185 | | - |
186 | | -Hypothesis truly is a masterpiece. I can't thank you enough for building it. |
187 | | - |
188 | | - |
189 | | -`Merchise Autrement <https://github.com/merchise>`_ |
190 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
191 | | - |
192 | | -Just minutes after our first use of hypothesis `we uncovered a subtle bug`__ |
193 | | -in one of our most used library. Since then, we have increasingly used |
194 | | -hypothesis to improve the quality of our testing in libraries and applications |
195 | | -as well. |
196 | | - |
197 | | -__ https://github.com/merchise/xotl.tools/commit/0a4a0f529812fed363efb653f3ade2d2bc203945 |
198 | | - |
199 | | -`Florian Kromer <https://github.com/fkromer>`_ |
200 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
201 | | - |
202 | | -At `Roboception GmbH <https://roboception.com/>`_ I use Hypothesis to |
203 | | -implement fully automated stateless and stateful reliability tests for the |
204 | | -`3D sensor rc_visard <https://roboception.com/3d-stereo-vision/rc-visard-3d-stereo-sensor/>`_ and |
205 | | -`robotic software components <https://roboception.com/rc-reason-software-suite/>`_ . |
206 | | - |
207 | | -Thank you very much for creating the (probably) most powerful property-based |
208 | | -testing framework. |
209 | | - |
210 | | -`Reposit Power <https://repositpower.com>`_ |
211 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
212 | | - |
213 | | -With a micro-service architecture, testing between services is made easy using Hypothesis |
214 | | -in integration testing. Ensuring everything is running smoothly is vital to help maintain |
215 | | -a secure network of Virtual Power Plants. |
216 | | - |
217 | | -It allows us to find potential bugs and edge cases with relative ease |
218 | | -and minimal overhead. As our architecture relies on services communicating effectively, Hypothesis |
219 | | -allows us to strictly test for the kind of data which moves around our services, particularly |
220 | | -our backend Python applications. |
| 6 | +<https://lp.jetbrains.com/python-developers-survey-2023/>`__! |
| 7 | + |
| 8 | +The following notable open-source projects use Hypothesis to test their code: `pytorch <https://github.com/pytorch/pytorch>`_, `jax <https://github.com/jax-ml/jax>`_, `PyPy <https://github.com/pypy/pypy>`_, `numpy <https://github.com/numpy/numpy>`_, `pandas <https://github.com/pandas-dev/pandas>`_, `attrs <https://github.com/python-attrs/attrs>`_, `chardet <https://github.com/chardet/chardet>`_, `bidict <https://github.com/jab/bidict>`_, `xarray <https://github.com/pydata/xarray>`_, `array-api-tests <https://github.com/data-apis/array-api-tests>`_, `pandera <https://github.com/unionai-oss/pandera>`_, `ivy <https://github.com/ivy-llc/ivy>`_, `zenml <https://github.com/zenml-io/zenml>`_, `mercurial <https://www.mercurial-scm.org/>`_, `qutebrowser <https://github.com/qutebrowser/qutebrowser>`_, `dry-python/returns <https://github.com/dry-python/returns>`_, `argon2_cffi <https://github.com/hynek/argon2-cffi>`_, `axelrod <https://github.com/Axelrod-Python/Axelrod>`_, `hyper-h2 <https://github.com/python-hyper/h2>`_, `MDAnalysis <https://github.com/MDAnalysis/mdanalysis>`_, `napari <https://github.com/napari/napari>`_, `natsort <https://github.com/SethMMorton/natsort>`_, `vdirsyncer <https://github.com/pimutils/vdirsyncer>`_, and `pyrsistent <https://github.com/tobgu/pyrsistent>`_. You can find `thousands more projects tested by Hypothesis on GitHub <https://github.com/HypothesisWorks/hypothesis/network/dependents>`__. |
| 9 | + |
| 10 | +There are also dozens of :doc:`first-party <extras>` and :doc:`third-party extensions <extensions>` integrating Hypothesis with a wide variety of libraries and data formats. |
| 11 | + |
| 12 | +.. ^ citations that I put effort into looking up but decided not to use. Maybe we'll use them in the future? |
| 13 | +.. https://github.com/pytorch/pytorch/blob/59ad8f1ac6bce11617a5f856df9e88b3bf9266af/pyproject.toml#L41 |
| 14 | +.. https://github.com/jax-ml/jax/blob/48335107f82117ac34c76cac3e22546d2da78eaf/build/test-requirements.txt#L5 |
| 15 | +.. https://github.com/pypy/pypy/blob/338295bd0567cda9a3c603f428b14229da08e750/extra_tests/requirements.txt#L2 |
| 16 | +.. https://github.com/numpy/numpy/blob/c9b2919556789675dca0e202dd5a4b46d7d23ff2/requirements/test_requirements.txt#L5 |
| 17 | +.. https://github.com/pandas-dev/pandas/blob/1863adb252863b718ba29912922bf050ce0eaa3d/pyproject.toml#L60 |
| 18 | +.. https://github.com/python-attrs/attrs/blob/5084de361bf9e722dda6876e6e2b8ce8c63b7272/pyproject.toml#L47 |
| 19 | +.. https://github.com/chardet/chardet/blob/8e8dfcd93c572c2cbe37585e01662a90b16fbab6/pyproject.toml#L59 |
| 20 | +.. https://github.com/jab/bidict/blob/0116e5b772bd2e390267c511187e60931b733153/pyproject.toml#L38 |
| 21 | +.. https://github.com/pydata/xarray/blob/3572f4e70f2b12ef9935c1f8c3c1b74045d2a092/pyproject.toml#L73 |
| 22 | +.. https://foss.heptapod.net/mercurial/mercurial-devel/-/blob/b8ca286fda2eb275ffdfd7417fb539a03748d22c/tests/hypothesishelpers.py |
| 23 | +.. https://github.com/qutebrowser/qutebrowser/blob/642c5fe2fe46082de53219c19e02fef209753aa0/misc/requirements/requirements-tests.txt#L19 |
| 24 | +
|
| 25 | +Research papers about Hypothesis |
| 26 | +-------------------------------- |
| 27 | + |
| 28 | +Looking to read more about Hypothesis and property-based testing? Hypothesis has been the subject of a number of research papers: |
| 29 | + |
| 30 | +1. `Hypothesis: A new approach to property-based testing <https://doi.org/10.21105/joss.01891>`_ (2019)* |
| 31 | +2. `Test-Case Reduction via Test-Case Generation: Insights from the Hypothesis Reducer <https://doi.org/10.4230/LIPIcs.ECOOP.2020.13>`_ (2020)* |
| 32 | +3. `Deriving semantics-aware fuzzers from web API schemas <https://dl.acm.org/doi/10.1145/3510454.3528637>`_ (2022)* |
| 33 | +4. `Tyche: Making Sense of PBT Effectiveness <https://dl.acm.org/doi/10.1145/3654777.3676407>`_ (2024)* |
| 34 | +5. `An Empirical Evaluation of Property-Based Testing in Python <https://dl.acm.org/doi/10.1145/3764068>`_ (2025) |
| 35 | +6. `Agentic Property-Based Testing: Finding Bugs Across the Python Ecosystem <https://doi.org/10.48550/arXiv.2510.09907>`_ (2025)* |
| 36 | + |
| 37 | +\* *Author list includes one or more Hypothesis maintainers* |
0 commit comments