pypa / pyproject-metadata

PEP 621 metadata parsing
https://pep621.readthedocs.io
MIT License
31 stars 17 forks source link

Project name is not validated #106

Closed dnicolodi closed 4 months ago

dnicolodi commented 5 months ago

The project name specified in pyproject.toml is not validate. Accordingly to https://packaging.python.org/en/latest/specifications/core-metadata/#name it should

henryiii commented 5 months ago

I've set this as a 0.9 feature. Don't want to ship this right in the 0.8 rc cycle, and there are questions like where to validate (all other validation is done on the pyproject.toml read), whether to combine the validation errors (would need ExceptionGroups to do properly). I'd be okay with #109 as is though if it gets to sit in main for a bit while these things are worked on.

dnicolodi commented 5 months ago

I was also unsure about where the best place for validation is. Ideally, an invalid project name would be the first thing reported. However, with the validation as in #109 it gets reported last. I think I added it to the class initialization because it was the easiest thing to do when I implemented it in a subclass downstream in meson-python. Most likely, moving the validation to the from_pyproject() constructor is the way to go.