←back to thread

273 points tosh | 1 comments | | HN request time: 0.204s | source
Show context
j4mie ◴[] No.44364740[source]
It's worth noting that uv also supports a workflow that directly replaces pyenv, virtualenv and pip without mandating a change to a lockfile/pyproject.toml approach.

uv python pin <version> will create a .python-version file in the current directory.

uv virtualenv will download the version of Python specified in your .python-version file (like pyenv install) and create a virtualenv in the current directory called .venv using that version of Python (like pyenv exec python -m venv .venv)

uv pip install -r requirements.txt will behave the same as .venv/bin/pip install -r requirements.txt.

uv run <command> will run the command in the virtualenv and will also expose any env vars specified in a .env file (although be careful of precedence issues: https://github.com/astral-sh/uv/issues/9465)

replies(3): >>44365084 #>>44365182 #>>44365328 #
politelemon ◴[] No.44365182[source]
Doesn't it store the python version in the pyproject.toml though, is the python version file needed?
replies(2): >>44365254 #>>44373938 #
1. ◴[] No.44373938[source]