Skip to content

Commit 07639cb

Browse files
committed
Update 'Setting up a Python Environment' guide to use uv
1 parent 44059c6 commit 07639cb

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

python/the-basics/initial-setup.html.md

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,48 +17,35 @@ We recommend the latest [supported versions](https://devguide.python.org/version
1717

1818
## Dependency Management
1919

20-
For project and dependency management we use [Poetry](https://python-poetry.org/). Like most package managers, Poetry combines multiple tools in one.
20+
For project and dependency management we use [uv](https://docs.astral.sh/uv/). Like most package managers, uv combines multiple tools in one.
2121

2222
You have other options:
2323
- [venv](https://docs.python.org/3/library/venv.html) and [pip](https://pip.pypa.io/)
24+
- [Poetry](https://python-poetry.org/)
2425
- [Pipenv](https://github.com/pypa/pipenv)
2526
- [pyenv](https://github.com/pyenv/pyenv)
2627
- [pip-tools](https://pypi.org/project/pip-tools/)
2728

28-
If you are just starting out, it is easiest to follow along using `poetry`.
29-
After installing it, you will have to set 2 flags for virtual environment management.
30-
31-
```cmd
32-
poetry config virtualenvs.create true
33-
poetry config virtualenvs.in-project true
34-
```
29+
If you are just starting out, it is easiest to follow along using `uv`.
3530

3631
This will make your development environment resemble what ends up happening inside the docker image.
3732

3833
You can create a new project using this command:
3934

4035
```cmd
41-
poetry new <app-name>
36+
uv init <app-name>
4237
```
4338

4439
Once inside the project, you can add packages with the add command:
4540

4641
```cmd
47-
poetry add <dep>
42+
uv add <dep>
4843
```
4944

5045
This will automatically create a virtual environment for you.
5146

52-
To interact with your virtual environment, you can prefix your commands with `poetry run`:
53-
54-
```cmd
55-
poetry run python main.py
56-
```
57-
58-
Alternatively, you can activate the environment:
47+
To interact with your virtual environment, you can prefix your commands with `uv run`:
5948

6049
```cmd
61-
poetry shell
62-
python main.py
50+
uv run python main.py
6351
```
64-

0 commit comments

Comments
 (0)