Skip to content

Commit 43b511f

Browse files
committed
Add UV package manager section to enhance Python setup documentation
1 parent 73cd4e9 commit 43b511f

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

docs/cheatsheet/setup-py.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Python setup.py
1212
A 'controversial' opinion
1313
</base-warning-title>
1414
<base-warning-content>
15-
Using `setup.py` to pack and distribute your python packages can be quite challenging every so often. Tools like <a target="_blank" href="https://python-poetry.org/">Poetry</a> make not only the packaging a <b>lot easier</b>, but also help you to manage your dependencies in a very convenient way.
15+
Using `setup.py` to pack and distribute your python packages can be quite challenging every so often. Modern tools like <a target="_blank" href="https://python-poetry.org/">Poetry</a> and <a target="_blank" href="https://docs.astral.sh/uv/">UV</a> make not only the packaging a <b>lot easier</b>, but also help you to manage your dependencies in a very convenient way. UV is particularly notable for being 10-100x faster than traditional tools.
1616
</base-warning-content>
1717
</base-warning>
1818

@@ -22,6 +22,8 @@ If you want more information about Poetry you can read the following articles:
2222
- <router-link to="/blog/python-projects-with-poetry-and-vscode-part-2">Python projects with Poetry and VSCode. Part 2</router-link>
2323
- <router-link to="/blog/python-projects-with-poetry-and-vscode-part-3">Python projects with Poetry and VSCode. Part 3</router-link>
2424

25+
For a comprehensive guide to UV, the lightning-fast Python package manager, read: <router-link to="/blog/python-uv-package-manager">UV: The Lightning-Fast Python Package Manager</router-link>.
26+
2527
## Introduction
2628

2729
The setup script is the center of all activity in building, distributing, and installing modules using the Distutils. The main purpose of the setup script is to describe your module distribution to the Distutils, so that the various commands that operate on your modules do the right thing.

docs/cheatsheet/virtual-environments.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,44 @@ Usage:
178178
3. Exit the Virtual Environment
179179

180180
conda deactivate
181+
182+
## UV
183+
184+
<base-disclaimer>
185+
<base-disclaimer-title>
186+
From <a target="_blank" href="https://docs.astral.sh/uv/">UV Documentation</a>
187+
</base-disclaimer-title>
188+
<base-disclaimer-content>
189+
UV is an extremely fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools workflows. UV is 10-100x faster than pip and provides unified package management, virtual environment creation, and Python version management.
190+
</base-disclaimer-content>
191+
</base-disclaimer>
192+
193+
1. Install UV
194+
195+
# Using curl (Linux/macOS)
196+
curl -LsSf https://astral.sh/uv/install.sh | sh
197+
198+
# Using pip or pipx
199+
pip install uv
200+
201+
2. Create a new project with virtual environment
202+
203+
uv init my-project
204+
cd my-project
205+
206+
3. Add dependencies
207+
208+
uv add requests
209+
210+
4. Run commands in project environment
211+
212+
uv run python script.py
213+
214+
5. Activate the virtual environment manually (optional)
215+
216+
source .venv/bin/activate # Linux/macOS
217+
.venv\Scripts\activate # Windows
218+
219+
UV automatically manages virtual environments, Python versions, and dependencies with exceptional speed and convenience.
220+
221+
For comprehensive information about UV's features and performance benefits, read our detailed guide: <router-link to="/blog/python-uv-package-manager">UV: The Lightning-Fast Python Package Manager</router-link>.

0 commit comments

Comments
 (0)