Package Management#
uv#
Task |
Command |
|---|---|
Create new application project |
|
Create new libary project |
|
Install specific version of python |
|
Add dependency |
|
Remove package |
|
List packages |
|
See package dependency tree |
|
Run a cli tool like Ruff |
|
Update uv version to latest |
|
Run a script |
|
uv supports two templates for projects:
Applications
uv init proj_name: for web servers, scripts, and command-line interfaces.Libraries
uv init --lib proj_name: intended to be built and distributed (e.g., uploaded to PyPI).
Install local pyproject.toml in editable mode with dev dependencies: uv pip install -e .
Activate the virtual environment:
Windows (cmd):
.venv\Scripts\activateWindows (PowerShell):
.\.venv\Scripts\Activate.ps1macOS/Linux:
source .venv/bin/activate
Optional dependencies ([project.optional-dependencies]) are extras that get published and can be installed via pip install package[extra].
Install a single extra:
uv pip install -r pyproject.toml --extra devInstall all extras:
uv pip install -r pyproject.toml --all-extras
Dependency groups ([dependency-groups]) are development-only groups (tests, linters, build tools, etc.) that do not get published to PyPI.
Install a single dependency-group:
uv pip install --group devInstall all dependency-groups:
uv pip install --all-groups
Mamba#
Task |
Command |
|---|---|
Create a new environment |
|
Create a new environment with specific Python |
|
Activate an environment |
|
Deactivate an environment |
|
Install a package |
|
Install a package from a specific channel |
|
Update a package |
|
Remove a package |
|
Remove an environment |
|
List packages |
|
List all environments |
|
Export environment to a file |
|
Create an environment from a file |
|
Update mamba to the latest version |
|