Skip to main content

Pytifex

Python 3.12+ License: MIT

Automated mutation based differential testing for Python type checkers. Pytifex discovers disagreements between type checkers by mining historical bug reports, generating targeted test cases with an LLM, and establishing ground truth through runtime validation testing.

For more information, see the Pytifex documentation.

Note: Pytifex implements a bug-seeded mutation methodology for proactively finding type checker bugs before users encounter them.

Type Checkers

Pytifex tests the following type checkers:

Checker Version Repository
mypy 1.19.0 python/mypy
pyrefly 0.44.2 facebook/pyrefly
zuban 0.3.0 zubanls/zuban
ty 0.0.1-alpha.32 astral-sh/ty

Divergence Patterns

Pattern Description PEPs
protocol-defaults Protocol methods with different default argument values 544
typed-dict-total TypedDict with mixed total/Required/NotRequired inheritance 589, 655
typeguard-narrowing TypeGuard/TypeIs with generic type parameters 647, 742
param-spec-decorator ParamSpec decorators on classmethods/staticmethods 612
self-generic Self type in generic classes with abstract methods 673
newtype-containers NewType in containers (covariance/contravariance) 484
overload-literals Overloaded functions with Literal type discrimination 484, 586
final-override Final attributes overridden by properties 591
keyword-vs-positional Protocol callables with keyword-only parameters 544, 570
bounded-typevars TypeVar bounds with nested generics 484

Installation

Prerequisites: Python 3.12+, uv

To download and run Pytifex, please follow the following commands:

pip install pytifex

*or*

pip3 install pytifex

NOTE: Type checkers are automatically installed by uv when you run the tool.

Usage

# You have to set your Google Gemini API key in your terminal window
export GEMINI_API_KEY="your-api-key-here"

# Run the full pipeline: mine → generate → filter → evaluate
uv run pytifex

# Generate until N disagreements are found
uv run pytifex --num-examples 10

# Use a different model
uv run pytifex --model gemini-2.5-pro

# Skip GitHub seed fetching
uv run pytifex --no-github

As a new feature (released in v1.6.0) you can also use your COHERE API with Pytifex!

export COHERE_API_KEY="your-key"   # or CO_API_KEY
uv run pytifex --model command-a-03-2025

# COHERE Models
- command-a-03-2025
- command-r-plus-08-2024
- command-r-08-2024
- command-r7b-12-2024

Commands

Command Description
uv run pytifex Full pipeline (generate + evaluate)
uv run pytifex generate Generate disagreements only
uv run pytifex check Run type checkers on existing examples
uv run pytifex eval Evaluate existing results

Options

Option Default Description
--num-examples N 5 Target disagreement count
--batch-size N 15 Examples per LLM batch
--max-attempts N 5 Max generation attempts
--max-refinements N 2 Refinement attempts per example
--model MODEL gemini-2.5-flash Gemini model
--eval-method METHOD comprehensive Evaluation method
--no-github — Skip GitHub seed fetching
-v, --verbose — Show all examples

Evaluation

Pytifex uses a multi-phase evaluation oracle to determine which checker is correct:

Phase Method Confidence
0 AST-based PEP specification oracle 0.85–0.95
1 Runtime crash detection 0.95–1.0
2 Hypothesis property-based testing 0.85
3 PEP specification compliance matching 0.80
4 Static flow analysis 0.80

Key insight: Runtime behavior is the ultimate ground truth. If code raises TypeError at runtime, any checker that reported "OK" is definitively wrong.

Metadata

Release files for pytifex 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytifex 0.1.7
File Size Uploaded Provenance Actions
pytifex-0.1.7.tar.gz 1.1 MB Without provenance Details for pytifex-0.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytifex 0.1.7
File Interpreter ABI Platform Actions
pytifex-0.1.7-py3-none-any.whl Python 3 none any Details for pytifex-0.1.7-py3-none-any.whl

Total release size: 1.2 MB

Release files / pytifex-0.1.7.tar.gz

Download URL pytifex-0.1.7.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
516aaf410ac87c8a29bb55b0e9656a2aeec1f93078d23cb8f34766bb497334e7
BLAKE2b-256 checksum
How to use checksums
35725f30d6ced01a4801c17f6d23b6a3f78d0f6e5ddc6c8da8fb3f9d362d9cb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release files / pytifex-0.1.7-py3-none-any.whl

Download URL pytifex-0.1.7-py3-none-any.whl
Size 115.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c20fa03e745adf277b9337a950282300a8df0ba9c6532eb2f4a66655d75ecda7
BLAKE2b-256 checksum
How to use checksums
d2c222059f49d95d6efc3fe9ae043b71a99419599aa22b0808b74fdfbbc3c7e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Security for pytifex 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page