# PEP 723: Embedding pyproject.toml in single-file scripts

**URL:** <https://discuss.python.org/t/pep-723-embedding-pyproject-toml-in-single-file-scripts/31151>\
**Category:** Packaging\
**Created:** [August 6, 2023, 6:07pm UTC](https://discuss.python.org/t/pep-723-embedding-pyproject-toml-in-single-file-scripts/31151 "2023-08-06T18:07:20Z")\
**Posts on this page:** 1\
**Showing post:** 94

<div class="post-metadata">

**Author:** ![h-vetinari](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/h-vetinari/32/1220_2.png) [@h-vetinari](https://discuss.python.org/u/h-vetinari)\
**Post date:** [August 11, 2023, 1:45am UTC](https://discuss.python.org/t/pep-723-embedding-pyproject-toml-in-single-file-scripts/31151/94 "2023-08-11T01:45:21Z")

</div>

> [@ofek](#):
>
> Okay, I will definitely switch to comments today.

🙁  
If we’re back to considering e.g. “```toml” as a marker, one idea not yet covered in the “Rejected Ideas” section is putting it in the [docstring](https://discuss.python.org/t/pep-722-dependency-specification-for-single-file-scripts/29905/182).

This would avoid having to deal with `#` (or `# `, or `#\s*`…), which is another stumbling block for syntax highlighting and maintaining user formatting. The regex-approach would of course still work with that marker.

Though to be honest, I don’t see the problem with backslashes (and staying with ` __pyproject__ `). When we’re talking about runtime, we’re talking (presumably) about where we’re executing the regex-pattern. Once we have the output of that regex, it’d be trivial to post-process that (by turning `\` into `\\`\[1\]) before actually evaluating the string in `toml.loads`.

Then it would make sense to keep disallowing raw strings (also f-strings, BTW), and it’d be a clear case of saying that ` __pyproject__ ` is always treated 1:1 as toml.

* * *

1. with some exceptions (e.g. linebreaks: `\n`, `\r`)

---

_[View the full topic](https://discuss.python.org/t/pep-723-embedding-pyproject-toml-in-single-file-scripts/31151)._
