crosshair-tool0.0.77
Published
Analyze Python code for correctness using symbolic execution.
pip install crosshair-tool
Package Downloads
Authors
Project URLs
Requires Python
>=3.8
Dependencies
- packaging
- typing-inspect
>=0.7.1
- typing-extensions
>=3.10.0
- z3-solver
==4.13.0.0
- importlib-metadata
>=4.0.0
- pygls
>=1.0.0
- typeshed-client
>=2.0.5
- autodocsumm
<1,>=0.2.2; extra == "dev"
- black
==22.3.0; extra == "dev"
- deal
>=4.13.0; extra == "dev"
- hypothesis
>=6.0.0; extra == "dev"
- icontract
>=2.4.0; extra == "dev"
- isort
==5.11.5; extra == "dev"
- mypy
==0.990; extra == "dev"
- pre-commit
~=2.20; extra == "dev"
- pytest
; extra == "dev"
- pytest-xdist
; extra == "dev"
- sphinx
>=3.4.3; extra == "dev"
- sphinx-rtd-theme
>=0.5.1; extra == "dev"
- wheel
; extra == "dev"
- numpy
==1.23.4; python_version < "3.12" and extra == "dev"
- numpy
==1.26.0; (python_version >= "3.12" and python_version < "3.13") and extra == "dev"
- numpy
==2.0.1; python_version >= "3.13" and extra == "dev"
CrossHair
An analysis tool for Python that blurs the line between testing and type systems.
THE LATEST NEWS: Python's most popular property-based testing tool, Hypothesis, now supports running CrossHair as an optional backend! This integration is much more effective at bug-finding than running crosshair with the
--analysis_kind=hypothesis
option.
If you have a function with type annotations and add a contract in a supported syntax, CrossHair will attempt to find counterexamples for you:
CrossHair works by repeatedly calling your functions with symbolic inputs. It uses an SMT solver (a kind of theorem prover) to explore viable execution paths and find counterexamples for you. This is not a new idea; a Python approach was first described in this paper. However, to my knowledge, CrossHair is the most complete implementation: it can use symbolic reasoning for the built-in types, user-defined classes, and much of the standard library.
Try CrossHair right now, in your browser, at crosshair-web.org!
CrossHair has IDE integrations for VS Code, PyCharm, and more.
Finally, CrossHair can do more than check contracts. It can also generate unit tests and find behavioral differences between functions.
Want to help? Sign up for email or RSS updates. Star ⭐️ the repository. There are other ways to help too.