7 Comments

Not sure I'm quite on board with how UV manages dependencies for single scripts. 'Now, you can use uv add to automatically embed the dependency declarations within the script itself'

I guess this make sense if the script is going to never leave the UV ecosystem. Otherwise it's just comment that is taking up space for other users.

'You can also pull arbitrary dependencies into a uv run invocation via with the --with flag, as in: uv run --with "requests<3" --with rich main.py.'

Better, but clunky, and prone to errors by having to manually type the dependencies each time.

Seems like it would make more sense to have a flag that instructs uv run to pull the dependencies directly from the import statements

Expand full comment
author
Sep 1·edited Sep 1Author

I get your point but:

- It's not limited to the UV ecosystem. Hatch already supports it, and it's an official PEP.

- Even limited to the UV ecosystem, it has a lot of value for your own scripts or an homogeneous org.

- I doubt it will be just limited to running the scripts in the long run. It will probably eventually package it as a stand alone executable.

- Reading imports is unfortunately not reliable enough: package names don't always match import names, and they don't contain version.

Expand full comment

"Because @ is special in PowerShell, the namespace can't use that as a prefix." etc etc

AFAICT none of that is an issue in npm land, so I am not sure what you mean. Can you expatiate a bit?

Expand full comment
author

I agree. In fact, reading the PEP, I tried to break the npm command in various ways without finding even a contrived example where @ would cause trouble in Powershell.

I even tried nesting namespaced packages in an array (defined with @ in PS) and then putting the result in a variable and dynamically execute that in a loop. Worked perfectly.

Still, I report the PEP rational, and I'm sure the point will come during the debate around the PEP. That's what the validation process is about after all.

Expand full comment

Ah, so you were merely echoing the PEP. OK then -:)

I work on a node project, I use the command line quite a lot (indeed I use the IDE mostly for editing), PS is my shell and I never ran into any trouble with package namespaces.

Expand full comment

Minor typo, uv 0.3 not 3.0, and of course now 0.4.1. Blazingly fast, that makes so much difference. I'm expanding my experimentation with it daily.

Expand full comment
author

Thanks

Expand full comment