Hacker News new | past | comments | ask | show | jobs | submit login

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



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


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


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/


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.


It's not a python the language feature, it's for packaging. So no language version is relevant. It's just there for any tool that wants to use it. uv, an IDE, or anything else that manages virtual environments would be the ones who implement it independent of python versions.


This is a specification for Python packaging, which is tooling separate from Python releases (for better or worse, IMHO worse but the BDFL disagrees). There's a box below the Table of Contents of the PEP that points here:

https://packaging.python.org/en/latest/specifications/inline...


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


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


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.


Python was first released in 1991, and PHP was first released in 1995.


Why come types?


That’s when each language reached sexual maturity but one went on to get a girlfriend and the other discovered internet porn.


I don't know which is which in this story.


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


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.


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.



Thank you for the pointer, I had searched for it but couldn't find it. (edit: Glad I spent the downvotes to get educated :-)


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: