qmetrics.net

CrossHair

Python symbolic analysis bridging contracts and tests

CrossHair analyzes Python code with symbolic execution and SMT solving to find contract violations and counterexamples. It links runtime checking with type-annotated functions.

Overview

CrossHair is an analysis tool for Python that sits between conventional testing and type-driven checking. Given functions with type annotations and contracts in a supported syntax, it explores execution paths with symbolic inputs and uses an SMT solver to hunt for counterexamples.

The tool can reason about built-in types, user-defined classes, and much of the standard library. Hypothesis can optionally use CrossHair as a backend for property-based testing. You can try it in a browser without installing locally, and extensions exist for VS Code, PyCharm, and other editors.

Beyond contract checking, CrossHair can generate unit tests and compare behavior between two implementations of a function. Documentation covers contracts, coverage-style analysis, behavioral diffs, class hints, IDE setup, limitations, and plugins.

Key features

  • Symbolic execution with SMT solving
  • Contract and type-annotation checking
  • Counterexample search for Python code
  • Unit test generation
  • Behavioral difference detection
  • Browser-based demo environment
  • IDE plugins for major editors
  • Optional Hypothesis backend integration

Use cases

  • Validating Python contracts and annotations
  • Finding edge-case bugs before production
  • Generating tests from specifications
  • Comparing two function implementations
  • Property-based testing with symbolic backends

Tags

Similar software

ShellCheck

Static analysis and linting for Bash shell scripts

ShellCheck scans bash and POSIX shell scripts for syntax, semantic, and portability problems. It is available as a CLI tool, editor integration, web paste interface, and CI hook.

★ 40.4k⟳ todayGPL-3.0

Mypy

Optional static type checker for Python

Mypy checks Python programs against PEP 484 type hints before you run them. It supports gradual typing so you can add annotations over time.

★ 20.7k⟳ todayMIT · open core

typescript-eslint

ESLint tooling for linting TypeScript codebases

typescript-eslint connects ESLint to TypeScript syntax and ships parser services plus lint rules. It enables standard and type-aware linting for JavaScript and TypeScript projects.

★ 16.5k⟳ 2 days agoMIT

React Doctor

CLI static analysis for React code quality

React Doctor scans React projects for correctness, performance, security, accessibility, and maintainability issues. Run it locally, in CI, or as an agent skill.

★ 15.2k⟳ 11 days agoMIT

Ajv

JSON Schema and JSON Type Definition validator for JavaScript

Ajv compiles JSON Schemas into validation functions for Node.js and browsers. It supports multiple JSON Schema drafts and JSON Type Definition (RFC 8927).

★ 14.9k⟳ 7 months agoMIT

Why Did You Render

React and React Native avoidable re-render diagnostics

Welldone Software’s library monkey-patches React in development to log when components render and why. It highlights redundant updates and works with React Native.

★ 12.5k⟳ 1 year agoMIT