Skip to main content

Package Management & Modern uv

A Package is a published collection of Python modules. The official cloud repository where the global developer community shares open-source libraries is PyPI (Python Package Index).


1. Traditional Workflow with pip​

pip is the standard package manager bundled with Python.

# 1. Install an external package (e.g. requests)
pip install requests

# 2. Export your installed project packages to a manifest file
pip freeze > requirements.txt

# 3. Teammates can install all exact dependencies in 1 command
pip install -r requirements.txt

2. Modern Standard: Astral's uv (Rust-Powered)​

In modern AI engineering setups, developers are rapidly adopting uv (a lightning-fast Python package installer written in Rust).

  • Why use uv? It installs libraries 10x to 100x faster than pip and automatically manages virtual environments and pyproject.toml without manual activation hassles.
# 1. Initialize a modern project:
uv init my-ai-app

# 2. Add a dependency (auto creates venv and locks dependencies):
uv add requests

# 3. Run any script in the environment seamlessly:
uv run python main.py

Quick Summary​

  • PyPI & pip: PyPI is the cloud repository for Python packages; pip install package_name downloads and installs them.
  • requirements.txt: Locks dependency lists (pip freeze > requirements.txt, pip install -r requirements.txt) for team reproducibility.
  • Modern uv: Ultra-fast Rust-based package manager (uv init, uv add, uv run) that simplifies virtual environments and project workflows.

What's Next?​

Now that you can manage packages and environments, let's learn how to track code changes and collaborate like professional software engineers in Module 17: Git & Version Control!