Build and run any commit of CPython
Project description
every-python
Build and run any commit of CPython, inspired by every-ts.
Why does this exist?
Building CPython from source is time-consuming. every-python makes it easy to:
- Test your code against different Python versions
- Reproduce bugs in specific commits
- Test experimental features like the JIT compiler
- Bisect to find which commit introduced a regression
Features
- Build any CPython commit - main, release tags, or specific commits
- Build with experimental JIT support - Build with
--enable-experimental-jit(includes LLVM version detection) - Smart caching - Builds cached in
~/.every-python/builds/for instant reuse - Git bisect integration - Automatically find which commit introduced a bug
How it works
every-python makes a blobless clone of the CPython repository (~200MB), checks out the version you want, and builds it locally with --with-pydebug. Built versions are cached in ~/.every-python/builds/ for reuse.
Installation
uv tool install every-python
# or
pipx install every-python
# or
pip install every-python
# Development install from source
git clone https://github.com/yourusername/every-python.git
cd every-python
uv sync
Requirements
- Git
- CPython build dependencies
- LLVM, for JIT builds
Usage
Build and install a Python version
# Build from main branch
every-python install main
# Build from a release tag
every-python install v3.13.0
# Build from a specific commit
every-python install abc123d
# Show build output (useful for debugging build failures)
every-python install main --verbose
Run Python with a specific version
# Run Python REPL
every-python run main -- python
# Run a script
every-python run v3.13.0 -- python your_script.py
# Run with arguments
every-python run main -- python -c "print('Hello!')"
If the version isn't built yet, it will build it automatically.
Build with JIT compiler (experimental)
Build Python with the experimental JIT compiler:
# Build with JIT enabled
every-python install main --jit
# Run with JIT-enabled build
every-python run main --jit -- python -c "print('Hello from JIT!')"
# Bisect with JIT to find JIT-specific bugs
every-python bisect --good v3.13.0 --bad main --jit --run "python test.py"
JIT Requirements:
every-python will attempt to detect the correct version of LLVM for the commit being built from LLVM_VERSION specified in Tools/jit/_llvm.py at the time of the commit. If you are missing the required LLVM version, you will see an error during the build. For more information on installing LLVM, see CPython JIT documentation.
Note: LLVM is only needed at build time, not at runtime. JIT and non-JIT builds are stored separately.
List built versions
every-python list-builds
Clean up builds
# Remove a specific build
every-python clean v3.13.0
# Remove all builds
every-python clean --all
Bisect to find bugs
Use git bisect to automatically find which commit introduced a bug:
# Find when a test started failing
# Exit with code 0 = good commit, 1 = bad commit
every-python bisect \
--good v3.13.0 \
--bad main \
--run "python test_my_feature.py"
# Bisect with JIT-enabled builds
every-python bisect \
--good v3.12.0 \
--bad main \
--jit \
--run "python test_jit_api.py"
This will:
- Resolve the good and bad commits
- Start a git bisect
- Build each commit that git bisect tests
- Run your test command
- Automatically mark commits as good/bad based on exit code:
- Exit 0 = good commit
- Exit 1-127 (except 125) = bad commit
- Exit 125 = skip this commit (can't test it)
- Find the exact commit that introduced the change
Note on bisecting across branches: Bisecting between release tags and main can be tricky due to backporting. For best results, bisect within a single branch (e.g., use commit hashes on main instead of crossing from v3.12.0 to main).
Writing test scripts for bisect: Your test script should exit with code 0 for "good" (old/expected behavior) and 1 for "bad" (new/broken behavior). For example, if I wanted to find when _jit was added to the sys module, I could use this script:
import sys
# Exit 0 (good) = feature doesn't exist yet
# Exit 1 (bad) = feature exists
if hasattr(sys, "_jit"):
sys.exit(1) # Feature exists - mark as "bad"
sys.exit(0) # Feature doesn't exist - mark as "good"
Project Structure
~/.every-python/
├── cpython/ # Blobless clone of CPython repository
└── builds/ # Cached builds
├── abc123d/ # Build for commit abc123d
├── abc123d-jit/ # JIT build for commit abc123d
└── def456e/ # Build for commit def456e
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file every_python-0.5.0.tar.gz.
File metadata
- Download URL: every_python-0.5.0.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15ae582305fb82af1fa613fb2769f147d79f315473aab39dceb6814b66dcb0d4
|
|
| MD5 |
c5abde66f9e68cd761a9eb00f5e24f31
|
|
| BLAKE2b-256 |
d8c46e676e0b5cf9d6bb67377487d15e1bbcab93a58d5a44344bc586058d6653
|
File details
Details for the file every_python-0.5.0-py3-none-any.whl.
File metadata
- Download URL: every_python-0.5.0-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9b89b96c3251fd5af1c87f6cdc4458cfefffc87b7bf4af520a39c14b2304bab
|
|
| MD5 |
55b84a7246e2e09fecdb810f438ef8a0
|
|
| BLAKE2b-256 |
448fcd2556ec50e58ce2665e8cc5bf4376841d86de5e937246f58b625b03be45
|