Uv: Running a script with dependencies
41–50 of 174 posts
Re: Uv: Running a script with dependencies
#42Oh nice, I was already a happy user of the uv-specific shebang with in-script dependencies, but the `uv lock --script example.py` command to create a lock file that is specific to one script takes it to another level! Amazing how this feels so natural and yet only appeared after 20+ years of Python packaging.
One things that’s useful to my organization is that we can then proceed to scan the lockfile’s declared dependencies with, e.g., `trivy fs uv.lock` to make sure we’re not running code with known CVEs.
Re: Uv: Running a script with dependencies
#43I just looked this up yesterday by sheer coincidence and was happy it actually worked. What brought it to your attention today?
Re: Uv: Running a script with dependencies
#44Earlier quoted context omitted.
Well... maybe the people who have stopped working on it due to the mysterious disappearance of 30,000 fundraised dollars, selling paid support but "delegat[ing] the actual work to unpaid volunteers", and a pattern of other issues from other community members who have not spoken up about them. https://vorpus.org/blog/why-im-not-collaborating-with-kennet... https://news.ycombinator.com/item?id=19826680
> he said his original goal was just to raise $5k to buy a computer. Privately, I was skeptical that the $5k computer had anything to do with Requests. Requests is a small pure-Python library; if you want to work on it, then any cheap laptop is more than sufficient. $5k is the price of a beefy server or top-end gaming rig. Kenneth Reitz has probably done more to enrich my life than most anyone else who builds things.…
I liked Requests way back when but prefer httpx or aiohttp. I liked piping for about a month when it first came out, but jumped ship pretty quickly. I'm not familiar with his other works.
I also wouldn't begrudge the guy a laptop, but I do get what the author was saying. His original fundraiser felt off, like, if you want a nice laptop, just say so, but don't create specious justifications for it.
Re: Uv: Running a script with dependencies
#45Earlier quoted context omitted.
I thought that was a heart emoticon next to requests, for a second.
I mean, who doesn't love requests?
It was good when it was new but it’s dangerously unmaintained today and nobody should be using it any more. Use niquests, httpx, or aiohttp. Niquests has a compatible API if you need a drop-in replacement.
Re: Uv: Running a script with dependencies
#46Oh this looks amazing! I had pretty much stopped using Python for my one-off scripts because of the hassle of dependencies. I can't wait to try this out.
From my perspective, people seem to make it difficult to use python, more from not understanding the difference between interactive shell and non-interactive shell configurations (if you think the above breaks system tools that use python, then you don't understand the difference, nor that system tools use /bin/python rather than /usr/env python), with a bit of cargo-cult mixed in, more than anything.
Re: Uv: Running a script with dependencies
#47Quick plug here for a simple Jupyter kernel I created: https://github.com/tobinjones/uvkernel It’s a pretty minimal wrapper around “uv” and “iPython” to provide the functionality from the article, but for Jupyter notebooks. It’s similar to other projects, but I think my implementation is the least intrusive and a good “citizen” of the Jupyter ecosystem. There’s also this work-in-progress: https://github.com/tobinjone…
Marimo notebooks are easy to diff when committing to git. Plus you get AI coding assistants in the notebook, a reactive UI framework, the ability to run in the browser with Pyodide on WASM, and more. It will also translate your old Jupyter notebooks for you.
For me, what uv is to package managers, marimo is to notebooks.
Re: Uv: Running a script with dependencies
#48 uv run --with jupyter jupyter notebook
Everything is put into a temporary virtual environment that's cleaned up afterwards. Best thing is that if you run it from a project it will pick up those dependencies as well.Re: Uv: Running a script with dependencies
#49Earlier quoted context omitted.
I mean, who doesn't love requests?
I've noticed that Claude Code prefers httpx because it's typed.
Re: Uv: Running a script with dependencies
#50How many package managers can one language have? Its a simple language but setting it up is just incredibly bad. Maybe this is the one or should I wait for the next?
imo all I usually need is pip-tools and venv, but uv kind of bundles the two together in a very natural way (and is very fast)