UV - Poetry Replacement
UV is an extremely fast dependencies and project manager. It has roughly equivalent in functionality with Poetry, but is much faster.
Installing
$ curl -LsSf https://astral.sh/uv/install.sh | sh
New Project
Uses uv init
to initialize a project with pyproject.toml
configuration file. Use uv add
to add new dependencies.
$ uv init example-project
Initialized project `example-project` at `/Users/vpanusuwan/projects/example-project`
$ cd example-project
$ uv add pandas
Using Python 3.9.6 interpreter at: /usr/local/bin/python3
Creating virtualenv at: .venv
Resolved **7 packages** in 78ms
**Built** example-project @ file:///Users/vpanusuwan/projects/example-project
Prepared **7 packages** in 724ms
Installed **7 packages** in 161ms
+ **example-project**==0.1.0 (from file:///Users/vpanusuwan/projects/example-project)
+ **numpy**==2.0.1
+ **pandas**==2.2.2
+ **python-dateutil**==2.9.0.post0
+ **pytz**==2024.1
+ **six**==1.16.0
+ **tzdata**==2024.1
Run Project
Using uv run
is similar to poetry run
, where the code is executed from within the project
uv run app.py
Visual studio Code Integration
VSCode should automatically picks up the environment in .venv
. If not, uses the environment selector on the bottom right corner to do so.