TIL: Testing different Python versions with uv with-editable and uv-test

AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.

Why it matters

Python developers get a one-line uv command to run pytest against any Python version, which matters right now for Python 3.14 upgrades.

Read this as

Simon Willison shares a command-line recipe for testing a Python project against different versions of Python, such as 3.14 or 3.11. It uses uv, a tool for managing Python environments, to run pytest (a testing program) in an isolated copy of the project. This helps developers confirm their code works across Python versions, which he did while upgrading projects for Python 3.14.

Teams preparing for Python 3.14 releases get a practical shortcut: a single uv command runs a project's test suite against any Python version from one directory. Willison packaged it into a shell script, uv-test, accepting a version flag like -p 3.11 and pytest options. The cost is adoption of uv and a pyproject.toml defining a 'test' extra; setups relying only on setup.py are also supported.

Willison's recipe is 'uv run --python 3.14 --isolated --with-editable .[test] pytest'. The --with-editable flag installs the project itself in editable mode so local changes are picked up by subsequent runs; --isolated prevents other environments from influencing the run. It works in any directory with a pyproject.toml or setup.py that defines a 'test' extra using pytest. He wrapped it in a uv-test script supporting version flags and pytest options like -k permissions.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

uv pytest Python 3.14 Python 3.11 pyproject.toml

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading