January 8, 2026
#2 - Setting Up a Python API Testing Project with uv
Part 2 of 5 · API Testing | Pytest & requests
- 1. #1 - GoRest CRUD APIs with curl
- 2. #2 - Setting Up a Python API Testing Project with uv
- 3. #3 - API Testing with requests
- 4. #4 - Pytest Concept
- 5. #5 - Pytest API Automation Framework - Setup
Understanding uv and its key advantages
What is uv?
uv is an extremely fast, modern Python package and project manager written in Rust, designed as an all-in-one replacement for existing tools like pip, virtualenv, pipx, and pyenv. uv promises dramatic performance gains and a simplified workflow for Python developers.
It consolidates multiple tools into a single, cohesive command-line interface — pip + venv + pip-tools + pipx, replaced by one fast tool.
It fully supports pyproject.toml for defining project metadata and dependencies, aligning with modern Python packaging standards.
Advantages
pyproject.tomlas the source of truth- A lockfile (
uv.lock) for deterministic installs - No need to "activate" a venv
- Better dev vs. prod dependency separation
Essential uv commands for project setup
Setup uv and python

Install uv and update path:
curl -Ls https://astral.sh/uv/install.sh | bashVerify uv is installed:
uv --version
uv 0.9.21Install a Python version:
uv python install 3.14List Python versions: uv python list
- Lists all Python interpreters uv can see (includes system-installed and uv-installed Python).
- uv separates system Python from project Python, so OS updates can't silently break your code or CI pipelines.
uv python listalways shows system-installed Python if no Python is installed via uv, because uv discovers and reuses what the OS already provides.- Once you install Python via
uv python install, uv prefers that version, but system Python remains visible as a fallback — not replaced.

Pin the project's Python version:
echo "3.13" > .python-version
cat .python-versionInitialize the project: uv init

Optionally update the project description in pyproject.toml:

Creating an API testing project using uv
Set up the virtual environment:
uv venv --python 3.13Install packages:
uv add requests faker
uv add --group test pytest
uv add --dev black ruff mypyAfter running the commands above, pyproject.toml is updated with the dependencies and uv.lock is created:


List dependencies: uv pip list

Reference
Originally published on Hashnode.