Why Python Developers Are Switching to UV

Dave EbbelaarAbout 3 min readAug 7, 2025Watch original
THE SUMMARYAI-generated

Key Concepts

  • UV: A fast Python package manager, a replacement for pip.
  • Package Management: Installing, adding, removing, and managing Python libraries and their dependencies.
  • Virtual Environments: Isolated environments for Python projects to manage dependencies.
  • pyproject.toml: A configuration file that replaces requirements.txt for managing project dependencies.
  • Dependency Groups: Categorizing dependencies for different environments (e.g., development, production).
  • GitHub CLI: Command-line interface for interacting with GitHub repositories.
  • Ruff: A fast Python linter.
  • CI/CD Pipelines: Automated processes for building, testing, and deploying software.

UV: A Super Fast Python Package Manager

The video introduces UV as a significantly faster alternative to pip for Python package management. It highlights that UV can achieve up to a 100x performance increase in package installation. Beyond speed, UV offers comprehensive project management capabilities, including:

  • Creating new Python projects with boilerplate code.
  • Adding .gitignore files.
  • Creating and managing virtual environments.
  • Managing dependencies for both main projects and development environments.

Setting Up and Using UV

The video provides a step-by-step guide to setting up and using UV:

  1. Installation: Instructions are provided for macOS, Linux, and Windows, using curl or brew install uv (on macOS).
  2. Verification: After installation, running uv --help in the terminal confirms successful installation and displays available commands.

New Project Workflow with UV

The video demonstrates a streamlined workflow for creating new Python projects using UV:

  1. Initialization: The command uv init <project_name> creates a new project folder with essential files:
    • .gitignore: Pre-configured with common Python exclusions.
    • python-version: Specifies the Python version for the project.
    • hello.py: A basic Python file for testing.
    • pyproject.toml: For managing dependencies.
    • README.md: A placeholder for project documentation.
  2. Adding Dependencies: The command uv add <library_name1> <library_name2> ... installs the specified libraries and automatically creates a virtual environment if one doesn't exist. Example: uv add openai pydantic fastapi.
  3. Removing Dependencies: The command uv remove <library_name> removes the specified library from the project and updates the pyproject.toml file. Example: uv remove fastapi.
  4. Managing Dependency Groups: The command uv add <library_name> --dev adds a library to the development dependency group. This allows for separating dependencies needed for development from those required for production. Example: uv add ipykernel --dev.
  5. Committing and Pushing to GitHub: The video demonstrates using the GitHub CLI to create a new repository, commit the project files, and push them to the repository.

Additional UV Features and Commands

  • Running Python Files: The command uv run <file_name.py> executes a Python file using UV's managed Python version. Example: uv run hello.py.
  • Managing Python Versions: UV can manage Python versions, allowing users to install and pin specific versions. The command uv python list displays available Python versions.
  • uv sync: This command is used to synchronize a project's dependencies based on the pyproject.toml file. It's particularly useful when cloning a repository and setting up the environment for the first time. It creates the virtual environment and installs all dependencies listed in pyproject.toml.
  • Compatibility with pip: UV is compatible with projects that still use pip and requirements.txt. The command uv pip install -r requirements.txt can be used to install dependencies from a requirements.txt file.

Astral and Ruff

UV is developed by Astral, the same team behind Ruff, a fast Python linter. The video recommends using Ruff for code linting.

Conclusion

UV offers a significant improvement over pip for Python package management, providing faster installation speeds and comprehensive project management features. Its ability to automatically create and manage virtual environments, handle dependency groups, and integrate with tools like the GitHub CLI makes it a valuable tool for Python developers. The video encourages viewers to explore UV's documentation for more advanced features, especially those related to CI/CD pipelines and Docker.

AI summaries can miss context or contain errors. Check important details against the original video.

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.