1. Virtual Environments (venv)
A virtual environment is a self-contained directory tree that contains a Python installation for a particular version of Python, plus a number of additional packages.Why Isolate Environments?
By default, standard python installations share global libraries. If Project A needsfastapi 0.95 and Project B needs fastapi 0.110, a global environment will crash. Virtual environments solve this by isolating packages per project directory.
Creating and Activating an Environment
(.venv), indicating that any python or pip commands will run inside the isolated environment.
2. Package Installation with Pip
pip is the default package installer for Python.
3. High-Performance Package Management with uv
uv is an ultra-fast Python package installer and resolver written in Rust by Astral. It serves as a drop-in replacement for standard pip and virtualenv tools, running 10x to 100x faster.
4. Declarative Dependency Management: pyproject.toml
Modern Python projects use a single configuration file named pyproject.toml to define dependencies, project metadata, and tool configuration, replacing legacy files like requirements.txt and setup.py.
Example pyproject.toml
uv, you can install these dependencies instantly: