Live data from Hacker News

PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org

peps.python.org

1–10 of 30 posts

Re: PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org

#3

Is there a reason, why the __pyproject__ variable is not a dict but a toml string?

Maybe because then you can just inline a pyproject text without any extra effort and the existing tooling for pyproject parsing can work in both cases?

Re: PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org

#4

Is there a reason, why the __pyproject__ variable is not a dict but a toml string?

I think they do kind of answer that under the "Why not use (possibly restricted) Python syntax?".

I understand their reasoning to be that it would require other tools to know how to parse python. Which is much more difficult than parsing toml

Re: PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org

#6

For some additional context: PEP 722[1] proposes a similar technique, but only for the script's requirements (and not the full TOML-formatted package metadata). [1]: https://peps.python.org/pep-0722/

PEP 723 should be preferred over 722. Using a .toml format makes a lot more sense over the arbitrary `Script Dependencies:` line in a comment block.

Re: PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org

#7
post #6

For some additional context: PEP 722[1] proposes a similar technique, but only for the script's requirements (and not the full TOML-formatted package metadata). [1]: https://peps.python.org/pep-0722/

PEP 723 should be preferred over 722. Using a .toml format makes a lot more sense over the arbitrary `Script Dependencies:` line in a comment block.

Both come with upsides and downsides: it's worth reading the discussion threads[1][2] on both!

I think I agree with you, but it's worth noting that embedding TOML into a here-string also raises some problems: it means that a maximally correct parser will need to handle string continuations, for example. It's also incompatible with what existing tools do, which is consume an unspecified form of PEP 722's syntax. These are not insurmountable problems, but they are reasonable considerations.

[1]: https://discuss.python.org/t/pep-722-dependency-specificatio...

[2]: https://discuss.python.org/t/pep-723-embedding-pyproject-tom...

Re: PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org

#8

Is there a reason, why the __pyproject__ variable is not a dict but a toml string?

It's probably because pyproject.toml is the direction in which the python ecosystem is going.

On that note, I will never understand why they chose .toml instead of just json or yaml..

Re: PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org

#10
post #8

Is there a reason, why the __pyproject__ variable is not a dict but a toml string?

It's probably because pyproject.toml is the direction in which the python ecosystem is going. On that note, I will never understand why they chose .toml instead of just json or yaml..

> On that note, I will never understand why they chose .toml instead of just json or yaml..

https://peps.python.org/pep-0518/#other-file-formats

Post reply on HN