PEP 621 normalization of fields

According to PEP 621 – Storing project metadata in pyproject.toml | peps.python.org :

Data specified using this PEP is considered canonical. Tools CANNOT remove, add or change data that has been statically specified.

However, for name it says:

Tools SHOULD normalize this name, as specified by PEP 503, as soon as it is read for internal consistency.

And now PEP 685 also instructs the same thing for the names of optional dependency groups.

So, when PEP 621 says “change” can we assume it’s referring to semantics? I introduced a change to Hatchling that I haven’t yet released because I came across ^ line.

Basically, if a user defines:

[project]
...
dependencies = [
  "Foo.Bar;  python_version<   '3.8'",
]

I want to write:

Requires-Dist: foo-bar; python_version < '3.8'

Is this allowed?

I think so. That line about not changing things is more about preventing tools from trying to circumvent the intent of dynamic.

2 Likes

That makes sense, thanks!

This also intersects some specific items in PEP 639 as well. At least in the intent of PEP 621, it seemed sensible to require that any normalization/processing be formally specified in a PEP (and corresponding canonical interoperability spec), straightforward, and fully deterministic, so any tool following the specs that reads that static field will obtain an identical set of canonical output metadata, and it seems that is indeed the case.