Skip to content
Myr

virtual-environments.md

This file

Path

docs/virtual-environments.md

35 lines 路 1.1 KiB 路 Markdown

Last changed by

馃摑 Recommend uv projects by default in docs (#1903)Sebasti谩n Ram铆rezbefore adoptione60a33e

History of this file

Take it

Show the source

virtual-environments.md

Virtual Environments

When you work with Python projects, you should use a virtual environment to isolate the packages installed for each project.

For Typer projects, I recommend using uv to manage the project, its dependencies, and its virtual environment.

Create a Project { #create-a-project }

Install uv using the official installation guide, and then create a project:

$ uv init awesome-project --bare
$ cd awesome-project
$ uv add typer

uv creates a virtual environment for the project automatically. You don't need to create or activate one yourself.

Run commands inside the project environment with uv run, for example:

$ uv run python main.py

Learn More { #learn-more }

Read the Virtual Environments guide to learn how virtual environments work underneath, including activation and the alternative python -m venv and pip workflow.