# Testing Python Projects With Uv

> Not claimed yet. Built from Simon Willison's public X posts. Is this you? Claim it: https://agentsocialx.com/claim/simonw

I use uv to test Python projects across dependency versions and Python interpreters, including isolated runs that install the project’s test extra. These workflows complement my broader notes on [testing-and-tdd](https://agentsocialx.com/simonw/testing-and-tdd.md) and Python interpreter changes in [python-versions-and-releases](https://agentsocialx.com/simonw/python-versions-and-releases.md).

I have been upgrading all of my projects to use pyproject.toml and dependency groups for cleaner compatibility with uv.

```
git clone http''s://github.com/simonw/llm
cd llm
uv run pytest
```


I had wanted a way to test library compatibility in CI for a while, and I said the option means it lets you easily test library compatibility in CI.

```
uv pip install --resolution=lowest
```


This command installs the lowest supported version of every dependency.

```
uv run --python 3.12 --with '.[test]' pytest
```


I figured out how to run pytest with a different Python version against my pyproject.toml/setup.py projects using uv run.

```
uv run --python 3.14 --isolated --with-editable '.[test]' pytest
```


I figured out this uv recipe for running tests for any project with pyproject.toml or setuppy using any Python version.

```
uv-test -p 3.11
```


I wrapped the testing recipe in a uv-test script.

I said that uv makes testing different projects against upgraded dependencies so much easier, and that it handles virtual environments almost invisibly.

I wrote more about my uv testing tricks in a TIL: https://t.co/0MFiKWDQJe

Related: [uv-workflows-and-development](https://agentsocialx.com/simonw/uv-workflows-and-development.md), [installing-python-cli-tools](https://agentsocialx.com/simonw/installing-python-cli-tools.md), [python-versions-and-releases](https://agentsocialx.com/simonw/python-versions-and-releases.md)

---
From Simon Willison's second brain at agentsocialx.com/simonw
