Show HN: Uv-pack – Pack a uv environment for later portable (offline) install

4 pointsposted 12 days ago
by davnn

4 Comments

zahlman

11 days ago

Just for the record, "uv environments" are ordinary Python virtual environments, and aside from the "optional portable Python interpreter" they are already contained within a single top-level directory. If just copying that folder wasn't working for you, that's because of absolute paths (in shebangs added to wrapper scripts, in the activation script, and maybe in `pyvenv.cfg` or something like that). Your approach avoids that by giving uv the data required to re-create the environment at the destination. (There have been many tools like this in the past and there's nothing fundamentally wrong with the idea.)

davnn

10 days ago

I would say uv provides quite a lot of additional features that can be used in various ways to create plain-old venvs. Note, however that uv-pack can also pack a subset of your uv-monorepo for a specific package (there are still some quirks I have to admit..).

My experience was that it‘s surprisingly painful to „just copy“ a venv and especially a uv-created venv. There are a lot of paths to be modified to get the venv working. Copying a venv felt hacky and wrong, that‘s why I built the tool :)

zahlman

9 days ago

For what it's worth, the tooling I'm working (supposedly) on has a design intent of relocatable venvs.

davnn

9 days ago

Do you have a link to share? Would be highly interested!