uv๏
Next, letโs start installing the tools we need to build and run our Python applications. Weโll start with uv, an extremely fast Python package and project manager, written in Rust. uv offers:
๐ A single tool to replace pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv, and more.
๐ An easy way to install and manage Python versions.
๐๏ธ Comprehensive project management, with a universal lockfile.
๐พ Disk-space efficiency, with a global cache for dependency deduplication.
๐ฅ๏ธ Support for Linux, macOS, and Windows.
Install uv๏
To install and enable uv, run the following commands:
Install uv via the official install script:
user:~$ curl -LsSf https://astral.sh/`uv`/install.sh | sh
Add the following line to
.bashrc
to enable it gloabally:user:~$ echo '. "$HOME/.cargo/env"' >> ~/.bashrc
Note
The
.bashrc
file in this repository includes the line above, so you can skip this step if youโre using it.
Usage๏
To create a new virtual environment using uv, run the following command:
user:~$ uv venv
If you want to give a specific name to the virtual environment, you can do so by running:
user:~$ uv venv myenv
To use a specific Python version, you can specify it with the --python
flag:
user:~$ uv venv --python 3.12
To install a package, you can use the uv pip install
command:
user:~$ uv pip install mypackage
For more information on how to use uv and its features, you can check the official documentation.