PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org
1–10 of 30 posts
Re: PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org
#2Re: PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org
#3Is there a reason, why the __pyproject__ variable is not a dict but a toml string?
Re: PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org
#4Is there a reason, why the __pyproject__ variable is not a dict but a toml string?
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
#5Re: PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org
#6For 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/
Re: PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org
#7For 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.
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
#8Is there a reason, why the __pyproject__ variable is not a dict but a toml string?
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
#9Re: PEP 723 – Embedding pyproject.toml in single-file scripts – peps.python.org
#10Is 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..