Technically build tools don’t need to read pyproject.toml
. My understanding is that PEP 621 is not intended to be mandatory. That said, even assuming universal adoption, build tools already need to be able to write METADATA
files (to generate the metadata in wheels), but they don’t need to be able to write pyproject.toml
files, just read them. Files processing metadata already need the capability to read METADATA
files, but not pyproject.toml
, so I think this argument actually cuts against pyproject.toml
.
We must add a second file (or, I suppose, mutate the first one?), and it will undoubtedly say something different, because many packages will generate metadata at build time rather than having it statically specified in the input.
Even if we mutate the file, it doesn’t alleviate the question of precedence, it just answers it as “the new file takes precedence”. In any case, it shouldn’t matter much, because we should definitely say that a tool is not compliant with the spec if running the tool again with the same pyproject.toml
has different values in any “reliable” fields.
Yes, this is the case, but it’s not exactly something I would generally recommend, let alone mandate. To the extent that sdists
contain different stuff than a repo checkout, it’s usually that the source distribution leaves out stuff specific to the repo (.gitignore
, CI configuration, etc), and sometimes includes generated files (like setuptools_scm
generating a _version.py
file, or the controversial (anti-?)pattern of including generated C code in an sdist). I think it’s exceedingly rare to mutate existing files. If we were to mutate the pyproject.toml
file as part of the inclusion, users looking at the source distribution wouldn’t be able to see the actual source that is used to generate the package!
I think an sdist is both a binary artifact for building from and a source for reading from. As a source for humans to read and because it’s a required configuration file for building the package, the pyproject.toml
file will be included anyway — I think that we should include it in its unmodified form, which is something that humans should be able to read easily anyway — and humans don’t necessarily need strict metadata about whether things are reliable or not anyway (if we’ve done our job right designing PEP 621, humans should be able to reasonably easily discern which values are provided by the tool anyway).
I also think that the METADATA
files are not terribly difficult for humans to read; they a newline-delimited set of key: value pairs with minimal syntax. If you need to pop into the METADATA
file to see what the tool-provided values resolved to, I don’t think you’d have much trouble doing so.