Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There’s a shebang now. as of PEP 722 you can declare dependencies in a comment at the top of a single file script that a package manager can choose to read and resolve.

uv has support for it: https://docs.astral.sh/uv/guides/scripts/#running-a-script-w... (which only helps if your team is all in on uv, but maybe they are)



PEP 722 was rejected. You are thinking of PEP 723, which was very similar to 722 in goals.

https://discuss.python.org/t/pep-722-723-decision/36763 contains the reasoning for accepting 723 and rejecting 722.


How does that work with the shebang?



  #!uv run
  # /// script
  # requires-python = ">=3.10"
  # dependencies = [
  #     "click>8",
  #     "rich",
  # ]
  # ///
and that's it


Cool. I wasn't sure it would skip the first comment line.


Do other package managers support this yet?


Pipx isn't in any meaningful sense a package manager (although it can manage environments to a limited extent), but the `pipx run` command supports this PEP as of version 1.4.2.




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

Search: