Note: The Listed platform will permanently shut down December 31, 2026. Your data published on Listed will still be available in your personal Standard Notes account. Learn more

til abt uv

something I've always hated is installing python because of package management and versions -- and I remember that xkcd where he's like just import blah blah blah and it's like magic except for when it isn't.

anyways

I was watching "Some tricks with UV and a new Python project: uvtrick!" https://www.youtube.com/watch?v=jXWIxk2brfk

--so I wanted to remember how to start a new project with uv:

Mostly going through this "uv for EVERYTHING: How to use uv for Python, venv, and project management" https://www.youtube.com/watch?v=zgSQr0d5EVg

First, you can start with cmd with wherever the project should live and init with the project/folder name:

uv init starter-uv-template
cd starter-uv-template

Then we when we add a package it will create a virutal environment:

  • which is used in place of pip install because it will add the pyproject.toml
  • and if we edit the .toml file itself we can use use uv sync instead

so then say, uv add flask in the project folder: it's a lot faster for some reason.

also, it is possible to use run uv pip install flask instead, but I don't know the difference.

so now the project looks like this:

📁 starter-uv-template
├── 📁 .venv
├── 📄 .gitignore
├── 📄 .python-version
├── 📄 hello.py
├── 📄 pyproject.toml
├── 📄 README.md
├── 📄 uv.lock

and then we can do whatever.

For me, uv.exe lives in C:\Users\me\.local\bin

  • I downloaded here: https://docs.astral.sh/uv/getting-started/installation
  • and ran this powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

More from @alexi | today I learned
All posts