-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Although the hard work is done by the TOML parser itself, we are responsible for extracting a block of TOML. This is a fairly simple line-oriented process. The code that does it seems to parse correct metadata correctly, but is easily confused into silently ignoring the whole thing.
There is an example program in the PyPA spec with a regex, which is marginally better at validation than jython-cli, but being a regex, it also silently ignores the whole when anything is slightly wrong.
This is incorrect (according to PyPA) because it specifies jbang twice.
# /// jbang
# debug = true
# requires-jython = "2.7.2"
# requires-java = "8"
# ///
# /// jbang
# debug = true
# requires-jython = "2.7.3"
#
# [java]
# runtime-options = ""
# ///
This is accepted as a jbang block, but shouldn't be:
# /// jbangbang
# debug = true
# requires-jython = "2.7.2"
# requires-java = "8"
# ///
This is silently ignored (no closing # ///):
# /// jbang
# debug = true
# requires-jython = "2.7.2"
# requires-java = "8"
And if there is a following valid jbang block, then that is ignored too. (The PyPA regex parses the second one.)
How do we feel about extra metadata that jython-cli doesn't understand? TOML has no opinion about what names are valid, and it can be a useful flexibility during innovation. But it is also what a spelling mistake looks like. I'm thinking a warning would be useful if there are items left over that we didn't use.