Python’s Modern Toolchain: uv, ruff, and What’s Replaced pip

Python’s tooling ecosystem has undergone a significant evolution in the past two years. The tools many developers learned — pip, virtualenv, flake8, black — have been superseded by faster, more integrated alternatives. Here is the current state.

uv: The pip Replacement

uv (from Astral) is a Python package installer and resolver written in Rust, designed as a drop-in replacement for pip and pip-tools that is 10–100x faster. Key advantages: dependency resolution that properly handles conflicts (pip’s resolver is notoriously poor), automatic virtual environment creation (uv venv), lockfile support (uv.lock — deterministic, reproducible installs), and a uv tool command for installing global tools without polluting the global Python environment. For new projects: uv init sets up a project with pyproject.toml; uv add package installs dependencies; uv run script.py runs scripts in the managed environment. uv is becoming the standard in production Python projects.

ruff: The Linter and Formatter

ruff (also from Astral) is a Python linter and code formatter written in Rust, replacing flake8, black, isort, and pyupgrade with a single tool that runs 10–100x faster. One command replaces four: ruff check . for linting, ruff format . for formatting. Configuration in pyproject.toml or ruff.toml. For new projects, ruff should be the only linting/formatting dependency — there is no longer a reason to maintain the separate tool stack.

pyproject.toml: The Central Configuration

Modern Python projects use pyproject.toml as the single configuration file for build system, dependencies, tool configuration (ruff, mypy, pytest settings all in one file). This replaces the scattering of setup.py, setup.cfg, requirements.txt, .flake8, .isort.cfg, and other files that made Python project roots messy.

What Still Works Fine

pytest remains the testing standard. mypy or pyright for type checking. FastAPI for web APIs. SQLAlchemy for database ORM. The Python ecosystem’s stability at the library level is high — the tooling layer changed significantly, the libraries themselves are mature and stable.

上一篇 2025年的React:什么真正重要
下一篇 Python现代工具链:uv、ruff和取代pip的工具