Skip to content

Instantly share code, notes, and snippets.

@kfsone
Created January 13, 2026 23:40
Show Gist options
  • Select an option

  • Save kfsone/12d7bf860f7d01adc4199fb15769e60d to your computer and use it in GitHub Desktop.

Select an option

Save kfsone/12d7bf860f7d01adc4199fb15769e60d to your computer and use it in GitHub Desktop.
Up and running with uv...

Install

You can pip install --user uv for an easy first glance, winget install uv or brew install uv. *nix steps vary.

Configure

All based on "pyproject.toml", which is standard python since Python 3.mumble.

You can bootstrap a new project with uv init or uv init <path>

image

That's configuration, to turn it into useable:

Deployment

uv sync will synchronize the local environment (virtual env) with the configuration.

image

Our app is going to use "orjson" and we want to make sure it's present.

image

this modified "pyproject.toml", and did a "uv sync" for us, which is why it also installed the package into our .venv immediately.

Another side effect of uv sync is that it creates a "lock file"; that's just a way of saving the dependency tree.

Specifically: It's going calculate and save ALL the dependency graphs for every python-version + os + arch combos it knows:

image

Day to day use

  1. Like any other venv
. ./.venv/scripts/activate.ps1  # powershell on any os
. ./.venv/bin/activate  # other shells
...

then when you get a new version of code:

git pull
uv sync
  1. uv-run prefix
image

and this will automatically sync if need be.

image

Python variant

UV is not written in Python so it doesn't depend on Python.

In fact, it installs a python into the .venv for you.

Even if you didn't have python yet.

So it also supports trivial python-version switching.

Environment variable:

image

.python_version file

image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment