pypa / setuptools

Official project repository for the Setuptools build system
https://pypi.org/project/setuptools/
MIT License
2.54k stars 1.2k forks source link

[FR] support pep-621 - storing core project metadata in pyproject.toml #2671

Closed RonnyPfannschmidt closed 2 years ago

RonnyPfannschmidt commented 3 years ago

What's the problem this feature will solve?

this is intended to build on #1688

with PEP-621 python packaging has been extended with a standard to include core metadata in pyproject.toml

Describe the solution you'd like

in order for setuptools to support it i beleive i see the need for the following steps

Alternative Solutions

No response

Additional context

Support incremental complexity and build steps for packages

Code of Conduct

abravalheri commented 3 years ago

Hi @RonnyPfannschmidt, I was just wondering if you could clarify a bit more the requirement:

warnings for usages of tool.setuptools when core package metadata is viable (maybe via jsonschema + its deprecation mechanism)

I have been working on a tool to assist the migration once PEP621 is adopted by setuptools, but since not all information in setup.cfg is covered by the PEP, I kind of assumed a tool.setuptools table is required in the TOML file... (the assumption is only provisional, and subject to change once we have a clearer idea on how to encode those extra fields).

Does the requirement you wrote mean that tool.setuptools should not be used?

RonnyPfannschmidt commented 3 years ago

@abravalheri if people put Metadata that has a location as per the pep into the tool. Setuptools table instead, there should be a warning /error

The table is absolutely needed as setup.cfg is a superset of the Metadata the pep directly in cooperates

abravalheri commented 3 years ago

Thank you very much for the clarification @RonnyPfannschmidt.

con-f-use commented 2 years ago

Just for clarification, because true to my nick, I'm a little bit confused. Can I put core metadata from PEP 621 into my pyproject.toml and expect that work with setuptools? What happens today (version 60.8.2) if I put core metadata into pyproject.toml and delete the duplicates of these metadata keys from setup.cfg?

abravalheri commented 2 years ago

Hi @con-f-use, not yet. This feature is still under active development/review.

abravalheri commented 2 years ago

Hi @RonnyPfannschmidt, the basics of the support have been implemented now. Do you think there is something left in this ticket that is not implemented yet? Or should we just close it?

RonnyPfannschmidt commented 2 years ago

@abravalheri i haven't been on top of this one

Is toml Metadata avaliable to setuptools extensions?

abravalheri commented 2 years ago

Could you describe a bit more what making toml Metadata avaliable to extensions would mean? Is there any existing mechanism for setup.cfg metadata?

RonnyPfannschmidt commented 2 years ago

No, which makes Integration painful

abravalheri commented 2 years ago

Thank you very much Ronny for clarifying that. This looks like a fair request. If we manage to put up the requirements for this feature (or at least have an idea on how it would look like), I can do some investigation and work on that sometime in the near future (no promises though :P).

abravalheri commented 2 years ago

Depending on the hook the plugin implements, the dist object will have its attributes set to the corresponding values in pyproject.toml, the problem is that the majority of the existing hooks run before the parsing of the configuration.

Are the dist attributes enough or would this feature be something different?

bhrutledge commented 2 years ago

@abravalheri @RonnyPfannschmidt If the basics of PEP 621 support have been implemented (per https://github.com/pypa/setuptools/issues/2671#issuecomment-1123673542), can further enhancements be submitted as separate issues? I think that would allow this issue to be closed, making the development status clearer to other folks.

I note that there's a checklist in the original description; what of that has been implemented, and what could be a separate issue?

Also, the setuptools docs still say that support is experimental. I think it'd be helpful for that document to include or link to a list of what's stable, and what's in progress.

Maybe setting up a project for PEP 621 support would be helpful?

abravalheri commented 2 years ago

Thank you very much @bhrutledge, If Ronny is OK with that I think we could split the remaining of the feature request in another issue.

Regarding the experimental part, after these few months that PEP 621 support was implemented in setuptools, I believe that we reached some level of stability, and I don't see this feature being removed.

The experimental part is the [tool.setuptools] table which is not covered by the PEP and contains other levers and knobs specific for setuptools. This other table is not mandatory though, and simple use cases should work perfectly fine without it.

I need to update the docs to make this clear.

bhrutledge commented 2 years ago

Thanks @abravalheri! I believe there's also a warning in the output of python3 -m build that says pyproject.toml support is experimental.

abravalheri commented 2 years ago

Thank you @bhrutledge, I will have a look on that.

abravalheri commented 2 years ago

I have started working on https://github.com/pypa/setuptools/pull/3347 to address the points brought up by @bhrutledge. Hopefully it reflects better the status of the feature.

RonnyPfannschmidt commented 2 years ago

:+1:

abravalheri commented 2 years ago

I am splitting the remaining aspects of the feature request in #3415. Anyone interested please feel free to add comments there.

agronholm commented 2 years ago

Did you just link to this same issue?

abravalheri commented 2 years ago

Woops, thanks @agronholm. The correct issue is https://github.com/pypa/setuptools/issues/3415.

abravalheri commented 2 years ago

My interpretation of the status of the original steps is: