How would you like to declare runtime dependencies and Python requirements for PEP 723?

And I do! PR to update the PEP incoming …

1 Like

My acceptance PR is at PEP 723: accept the PEP by brettcannon · Pull Request #3616 · python/peps · GitHub .

@pf_moore is the note about what it will take to reach final meet your general desires for this?

4 Likes

Related to the following note from the PEP:

This PEP will be declared final once it has been specified at packaging.python.org and there have been a couple of implementations of the spec.

I have implemented inline script metadata in viv. See the docs for more info.

I’ve approved the change because I don’t want to be a blocker, but personally I would like the PEP to be implemented in pipx and pip-run, not just “a couple of places”. I’m not particularly happy with causing a split between “old” and “new” style script runners, which is what ignoring pipx and pip-run would do, IMO.

Full disclosure - I’ve done as much as I’m willing to push PEP 723 to completion here, so I don’t intend to raise issues or PRs for pipx and pip-run myself (and I won’t adopt PEP 723 personally until they support it). So whether @ofek pushes that through or someone else steps up, I’m not sure.

1 Like

Looks like it has been updated on pipx: fix: use modern PEP 723 syntax, fix mistake in name by henryiii · Pull Request #1180 · pypa/pipx · GitHub

1 Like

Sigh. I nerd-sniped myself. PR for pip-run: Implement PEP 723 support (script dependencies in a TOML block) by pfmoore · Pull Request #96 · jaraco/pip-run · GitHub.

9 Likes

The next minor release of Hatch will support this.

I’m curious what “this” is, precisely. Do you mean pipx/pip-run functionality, where you can execute something like hatch run foo.py (even in a directory that’s not a project managed by hatch) and it will pick up the dependencies, create a temporary environment, and run the script in that environment? Or do you mean something more specific to hatch’s standard workflow, tied to its environment management mechanisms?

The former hatch run foo.py but under the hood I would reuse the existing tooling. As someone else mentioned in a different thread I’m basically just going to remap some config and pretend the file is a project, transparently of course.

1 Like

For folks who didn’t look at the final PR or PEP, a note about this was added.

I guess the next step is to get Inline script metadata - Python Packaging User Guide updated.

3 Likes
2 Likes

I opened a PR to mark as final: PEP 723: Mark as final by ofek · Pull Request #3772 · python/peps · GitHub

3 Likes

I was not made aware Pex had promised support for this, but I stumbled upon PEP 723 (final) several days ago. Pex now supports this:

4 Likes