News for hackers. Stuff that matters.
Re:Self-contained Python scripts with uv by benhurmarcel on Sunday March 30, 2025 @09:47AM (#43524168)
> I can't find any assertion in the uv docs that these temporary virtual environments are ever automatically cleaned up.

That’s a good point. I wonder if at least they are reused when you run the script several times.

Re:Self-contained Python scripts with uv by maxed on Sunday March 30, 2025 @11:46AM (#43525050)
I took a closer look; uv installs the inline required packages in it's cache directory `~/.cache/uv` (if they are not already there). So the packages will probably exist until the cache is cleared with for example `uv clear`.

It's not that the inline requirements make a new `.venv` directory or something, uv seems to link the packages to a central location and reuse them if already there.

Re:Self-contained Python scripts with uv by dagw on Sunday March 30, 2025 @09:52AM (#43524210)
My understanding is that uv creates a hash of the script name, python version and dependencies when creating the venv. So if none of those change, it will reuse the venv.