petters 3 days ago

I completely agree. Hope something like this is eventually standardized.

Problem is that uv probably does not want to execute anything to find out dependencies, so it would have to be a very restrictive subset of python syntax.

The fact that is is needed at all of course highlights a weakness in the language. The import statements themselves should be able to convey all information about dependencies

3
SAI_Peregrinus 3 days ago

UV just implemented PEP 723[1], which is now PyPA Inline Script Metadata[2]. That's no longer provisional, it is standardized already! It's unfortunate that Python didn't have some non-comment way to provide this functionality.

[1] https://peps.python.org/pep-0723/

[2] https://packaging.python.org/en/latest/specifications/inline...

pedrosorio 3 days ago

> The fact that is is needed at all of course highlights a weakness in the language. The import statements themselves should be able to convey all information about dependencies

What languages convey the version of the dependencies in a script’s import statements?

stared 3 days ago

It can be specified that it is a valid, static structure before imports.

nemetroid 3 days ago

Between future statements and other imports, then?