Settings

Theme

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

github.com

4 points by davnn 9 days ago · 4 comments · 1 min read

Reader

I kept running into the same problem: modern Python tooling, but deployments to air-gapped systems are a pain. Even with uv, moving a fully locked environment into a network-isolated machine was no fun.

uv-pack should make this task less frustrating. It bundles a locked uv environment into a single directory that installs fully offline—dependencies, local packages, and optionally a portable Python interpreter. Copy it over, run one script, and you get the exact same environment every time.

Just released, would love some feedback!

zahlman 8 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.)

  • davnnOP 7 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 6 days ago

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

      • davnnOP 5 days ago

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

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection