Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The more tricks I learn with uv the more I like it.

The other day I got to share a demo by pasting this command in a Discord channel:

    uvx --with 'llm==0.17a0' --with 'llm-claude-3==0.6a0' \          
    llm -m claude-3.5-sonnet 'describe image' \
    -a https://static.simonwillison.net/static/2024/pelicans.jpg
That single command creates a throwaway virtual environment, installs an alpha release of my LLM tool, adds an alpha release of my llm-claude-3 plugin, runs that command with options, returns the results and then throws everything away again.

And because of the way uv uses symlinks and caching, running the commands a second time is almost instant.

(That stuff is no longer alpha, see https://simonwillison.net/2024/Oct/29/llm-multi-modal/)



If it "uses symlinks and caching" in the way you describe, then it isn't really "throwing everything away again", surely?

Also, how is that different from `pipx run`?


You don't need to think about the virtual environment that might have been created to run the tool, that thing is entirely ephemeral. The caching is shared with all other virtual environments on your machine, so if some other project uses the same version of a dependency that cached dependency will be shared.

Contrast that with other Python virtual environment tools where you can end up with the same exact dependency copied dozens of times across your system.

"pipx run" for example can result in identical copies of dependencies that are used by multiple tools.


Ah, so by "everything" you just meant some configuration explaining what's in that environment. (In a broad sense, including e.g. the use of hard links to the cache.)

Yes, it's a quite clever system. I have plans to follow a similar strategy, implemented in Python (self-installing into its own isolated environment, similar to the one that Pipx makes for its Pip copy).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: