PEP 722: Dependency specification for single-file scripts

For context, I’m the author of Rust eRFC #3424 for integrating single-file package support (including dependencies) into cargo.

The rust-script syntax that was given is for embedding the manifest / Cargo.toml directly into the file by using a markdown code fence in the module’s doc comment. Using #! would not be equivalent in Python but putting it in the module’s doc comment and using … rST? markdown? syntax for a literal block. However, we are concerned about taking that approach because we are wanting allow people to do this with libraries and then we dirty up people’s documentation with implementation details.

My Pre-RFC contains a lot of details for different trade offs for different ways of embedded manifests or lockfiles (more equivalent of this proposal) within files, particularly the Unresolved Questions section.

Some relevant thoughts

  • Bug reports and educational material are very big use cases in my mind.
  • We’ve also gotten a lot of feedback about process overhead with having smaller packages, so we are looking at supporting this for libs and supporting publishing them. In Python terms, this would be to have pyproject.toml support
    • However, we have a lot more opinionated of a build system which makes it easier to default a bunch of fields to make the syntax overhead is low
  • Most likely, tooling will want to edit and not just read, so consider that workflow as well
12 Likes