Live data from Hacker News

Uv: Running a script with dependencies

docs.astral.sh

111–120 of 174 posts

Re: Uv: Running a script with dependencies

#111
post #93

Earlier quoted context omitted.

Semantic whitespace was bad enough, now we have semantic comment blocks? I'm mostly joking, but normally when people say language syntax they mean something outside a comment block.

I am - while awesomely valuing uv - also with the part of the audience wondering/wishing this capability were a language feature .-

The PEP explains why it isn't part of the regular python syntax.

uv and other tools would be forced to implement a full Python parser. And since the language changes they would need to update their parser when the language changes.

This approach doesn't have that problem.

Making it a "language feature" has no upside and lots of downside. As the PEP explains.

Re: Uv: Running a script with dependencies

#112
post #110

Earlier quoted context omitted.

Should be portable as long as there are no quotes. It’s basically a nop on macOS since in macOS the shebang args are already split by spaces (even when quoted). Edit: further reading https://unix.stackexchange.com/a/605761/472781 > and https://unix.stackexchange.com/a/774145/472781 > and also note that on older BSDs it also used to be like that

Not under OpenBSD.

Thanks for pointing it out.

Indeed, OpenBSD’s and NetBSD’s `env` does not support `-S`. DragonflyBSD does (as expected).

Solaris as pointed out by the first link doesn’t even support more than one argument in the shebang so no surprise that its `env` does not support it either. Neither does IllumOS (but not sure about the shebang handling)

Re: Uv: Running a script with dependencies

#114

Earlier quoted context omitted.

I am - while awesomely valuing uv - also with the part of the audience wondering/wishing this capability were a language feature .-

The PEP explains why it isn't part of the regular python syntax. uv and other tools would be forced to implement a full Python parser. And since the language changes they would need to update their parser when the language changes. This approach doesn't have that problem. Making it a "language feature" has no upside and lots of downside. As the PEP explains.

Perfect sense.-

Re: Uv: Running a script with dependencies

#115
post #86
post #36

Earlier quoted context omitted.

Kenneth Reitz has been good and bad at times. And while things of his are genius level, he also has done asshole level things. But on the other hand, we get that with a lot of geniuses for some reason or another. Really smart people can be really dumb too. It would be like saying, "Don't use Laplace transforms because he did some unsavory thing at some point in time."

Looking at this drama for a bit, I haven't seen anybody advocate for 'canceling' requests itself. Maybe it's more like: Laplace created awesome things, but let's be fair and also put in his wikipedia page a bit about his political shenanigans. A lot of of so-called geniuses, especially the self-styled ones with some narcissistic traits, get away with being an asshole. Their admirers have different norms for regular,…

Back when the drama was fresh, there was a lot of talk about “canceling” Requests, but as often happens, everyone moved o to something else and it kinda got forgotten about with time.

Re: Uv: Running a script with dependencies

#116
post #33

Earlier quoted context omitted.

I mean, who doesn't love requests?

I've noticed that Claude Code prefers httpx because it's typed.

Weird! I have the opposite: I want it to prefer httpx but it always gives me Requests when I forget to specify it.

LLMs are funny.

Re: Uv: Running a script with dependencies

#117
If you’re at all interested in this topic, I strongly recommend you read Simon Willison’s blog at https://simonwillison.net/

He does all the legwork and boils it down into an easily-understandable manner.

He’s also a user her in this thread at simonw. Just an immensely useful guy.

Re: Uv: Running a script with dependencies

#118

As a tangent, one issue I face is how to force cursor to use uv over pip. I have placed it in rules and also explicitly add a rules.yml file in every agent conversation. It still tries to push through pip 4 out of 10 times. Any recommendations on best practice to force cursor to use uv will make a significant dent in productivity

more of a bandaid than anything else, but maybe something like this might help: alias pip='echo "do not use pip, use uv instead" && false' You can put that in your bashrc or zshrc. There's a way to detect if it's a cursor shell to only apply the alias in this case, but I can't remember how off the top of my head!

> alias pip='echo "do not use pip, use uv instead" && false'

Interesting times, eh?

Who (who!) would have told us all we'd be aliasing terminal commands to *natural language* instructions - for machine consumption, I means. Not for the dumb intern ...

(I am assuming that must have happened at some point - ie. having a verboten command echo "here be dragons" to the PFY ...)

Re: Uv: Running a script with dependencies

#119
post #23

How 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?

> Its a simple language

No, it isn’t. This misconception is common and I don’t know where it comes from.

Python is a very complex language hiding behind friendly syntax.

Re: Uv: Running a script with dependencies

#120

I wish there was a straightforward way to let VS Code pick up the venv that uv transparently creates. Out of the box, the Python extension redlines all the third-party imports. As a workaround, I have to plunge into the guts of uv's Cache directory to tell VS Code the cached venv path manually, and cross fingers that it won't recreate that venv too often.

Could you tell me how you do this in code ? Started using uv in a very old school team and they don’t like uv simply because it’s new. Something like this is what they base it on.
Post reply on HN