I’m glad how the decision process turned out (and not just the result!).
W.r.t. the parsing complexity, I think it would be good to keep it as simple as possible. So before we climb down the rabbit hole of fixing all possible corner-cases with ///
, I just wanted to recall that there’s some prior art by rust (also mentioned in the PEP) which uses a special comment (//!
rather than the normal //
).
Translating that to Python and keeping everything else from PEP 723, we’d have:
#! /// pyproject
#! [run]
#! requires-python = ">=3.11"
#! dependencies = [
#! "requests<3",
#! "rich",
#! ]
#! ///
That would make it unambiguous[1] as well as dead-simple[2]. It’d also be trivial to adapt the reference regex.