top | item 42677455

(no title)

aeurielesn | 1 year ago

I don't understand how things like this get approved into PEPs.

discuss

order

Karupan|1 year ago

Seems like a great way to write self documenting code which can be optionally used by your python runtime.

zanie|1 year ago

As in, you think this shouldn't be possible or you think it should be written differently?

epistasis|1 year ago

The PEP page is really good at explaining the status of the proposal, a summary of the discussion to date, and then links to the actual detailed discussion (in Discourse) about it:

https://peps.python.org/pep-0723/

noitpmeder|1 year ago

I see this was accepted (I think?); is the implementation available in a released python version? I don't see an "as of" version on the pep page, nor do lite google searches reveal any official python docs of the feature.

rtpg|1 year ago

It's helpful as a way to publish minimal reproductions of bugs and issues in bug reports (compared to "please clone my repo" which has so many layers of friction involved).

I would want distributed projects to do things properly, but as a way to shorthand a lot of futzing about? It's excellent

misiek08|1 year ago

And people were laughing at PHP comments configuring framework, right?

throwup238|1 year ago

Python was always the late born twin brother of PHP with better hair and teeth, but the same eyes that peered straight into the depths of the abyss.

blibble|1 year ago

with that expected use case of uv script run command it effectively makes those comments executable

python's wheels are falling off at an ever faster and faster rate

Spivak|1 year ago

Because of a feature that solves the problem of one off scripts being difficult the moment you need a 3rd party library?

A more Pythonic way of doing this might be __pyproject__ bit that has the tiiiiny snag of needing to execute the file to figure out its deps. I would have loved if __name__ == "pyproject" but while neat and tidy it is admittedly super confusing for beginners, has a "react hooks" style gotcha where to can't use any deps in that block, and you can't use top level imports. The comment was really the easiest way.

linsomniac|1 year ago

I don't think this IS a PEP, I believe it is simply something the uv tool supports and as far as Python is concerned it is just a comment.

zanie|1 year ago

No, this is a language standard now (see PEP 723)