What problem does it solve?
This Skill automates configuring a Python test environment in Claude Code for web when flox is unavailable, enabling backend test execution without manual setup.
Core Features & Use Cases
- Detects the required Python version from pyproject.toml and matches it against a python-build-standalone release.
- Downloads and installs a compatible Python interpreter, then prepares a reusable test runtime for pytest-based workflows.
- Use cases include running backend tests for web projects where standard runtimes are unavailable or inconsistent, and validating Python compatibility across environments.
Quick Start
Follow these steps to set up and run tests in Claude Code for web:
REQUIRED_VERSION=$(grep requires-python pyproject.toml | grep -oP '[\d.]+')
echo "Required Python: $REQUIRED_VERSION"
RELEASE_TAG=$(curl -sL "https://api.github.com/repos/astral-sh/python-build-standalone/releases/latest" | grep '"tag_name"' | cut -d'"' -f4)
DOWNLOAD_URL=$(curl -sL "https://api.github.com/repos/astral-sh/python-build-standalone/releases/latest" |
grep "browser_download_url" | grep "$REQUIRED_VERSION" | grep "x86_64-unknown-linux-gnu-install_only.tar.gz" | head -1 | cut -d'"' -f4)
mkdir -p /tmp/python-install && cd /tmp/python-install
curl -L -o python.tar.gz "$DOWNLOAD_URL"
tar -xzf python.tar.gz
Verify
/tmp/python-install/python/bin/python3 --version
Setup and run tests
cd /home/user/posthog
uv sync --python /tmp/python-install/python/bin/python3
source .venv/bin/activate
Run a specific test
pytest path/to/test.py::TestClass::test_method -v
Run all tests in a directory
pytest posthog/hogql/test/ -v