Skip to main content

Analyze Python code for correctness using symbolic execution.

Project description

CrossHair

Join the chat at https://gitter.im/Cross_Hair/Lobby Check status Downloads

An analysis tool for Python that blurs the line between testing and type systems.

THE LATEST NEWS: The new CrossHair VSCode extension can work in the background and provide in-line errors when it finds a counterexample, just like a linter or type-checker. Try it out and tell me what you think!

If you have a function with type annotations and add a contract in a supported syntax, CrossHair will attempt to find counterexamples for you:

Animated GIF demonstrating the verification of a python function

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.

Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crosshair-tool-0.0.54.tar.gz (387.5 kB view hashes)

Uploaded Source

Built Distributions

crosshair_tool-0.0.54-cp311-cp311-win_amd64.whl (438.1 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

crosshair_tool-0.0.54-cp311-cp311-win32.whl (437.0 kB view hashes)

Uploaded CPython 3.11 Windows x86

crosshair_tool-0.0.54-cp311-cp311-musllinux_1_1_x86_64.whl (463.3 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

crosshair_tool-0.0.54-cp311-cp311-musllinux_1_1_i686.whl (461.4 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

crosshair_tool-0.0.54-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (459.9 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

crosshair_tool-0.0.54-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (457.8 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

crosshair_tool-0.0.54-cp311-cp311-macosx_10_9_x86_64.whl (433.7 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

crosshair_tool-0.0.54-cp310-cp310-win_amd64.whl (438.1 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

crosshair_tool-0.0.54-cp310-cp310-win32.whl (437.0 kB view hashes)

Uploaded CPython 3.10 Windows x86

crosshair_tool-0.0.54-cp310-cp310-musllinux_1_1_x86_64.whl (462.7 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

crosshair_tool-0.0.54-cp310-cp310-musllinux_1_1_i686.whl (460.7 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

crosshair_tool-0.0.54-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (459.2 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

crosshair_tool-0.0.54-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (457.1 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

crosshair_tool-0.0.54-cp310-cp310-macosx_10_9_x86_64.whl (433.6 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

crosshair_tool-0.0.54-cp39-cp39-win_amd64.whl (438.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

crosshair_tool-0.0.54-cp39-cp39-win32.whl (437.0 kB view hashes)

Uploaded CPython 3.9 Windows x86

crosshair_tool-0.0.54-cp39-cp39-musllinux_1_1_x86_64.whl (462.1 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

crosshair_tool-0.0.54-cp39-cp39-musllinux_1_1_i686.whl (460.2 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

crosshair_tool-0.0.54-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (458.7 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

crosshair_tool-0.0.54-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (456.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

crosshair_tool-0.0.54-cp39-cp39-macosx_10_9_x86_64.whl (433.6 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

crosshair_tool-0.0.54-cp38-cp38-win_amd64.whl (438.1 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

crosshair_tool-0.0.54-cp38-cp38-win32.whl (437.0 kB view hashes)

Uploaded CPython 3.8 Windows x86

crosshair_tool-0.0.54-cp38-cp38-musllinux_1_1_x86_64.whl (462.9 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

crosshair_tool-0.0.54-cp38-cp38-musllinux_1_1_i686.whl (461.0 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

crosshair_tool-0.0.54-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (459.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

crosshair_tool-0.0.54-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (457.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

crosshair_tool-0.0.54-cp38-cp38-macosx_10_9_x86_64.whl (433.7 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page