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:

  1. Install uv via the official install script:

    user:~$ curl -LsSf https://astral.sh/`uv`/install.sh | sh
    
  2. 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.