pypa / flit

Simplified packaging of Python modules
https://flit.pypa.io/
BSD 3-Clause "New" or "Revised" License
2.15k stars 130 forks source link

Update dependency format according to PEP 631 / 621 #373

Open AndydeCleyre opened 3 years ago

AndydeCleyre commented 3 years ago

PEP 631

I may be misunderstanding, but looking at the PEP, I think it means that dependency specification within a pyproject.toml is getting standardized such that we'll want to use the format specified in the PEP for required package entries, rather than (or in addition to) tool.flit.metadata[.requires-extra] entries.

Whereas a flit-flavored pyproject.toml may look like this now:

[build-system]
requires = ["flit_core >=2,<4"]
build-backend = "flit_core.buildapi"

[tool.flit.metadata]
# ...
requires = ["clint>=0.5.1", "coverage>=4.4.1"]

[tool.flit.metadata.requires-extra]
test = ["doublex-expects>=0.7.0rc2", "expects>=0.8.0", "mock>=2.0.0"]
dev = ["doublex-expects>=0.7.0rc2", "expects>=0.8.0", "flit>=3", "mock>=2.0.0", "sphinx-autobuild>=0.7.1", "sphinx>=1.6.5"]

I guess it should in the future look like:

[build-system]
requires = ["flit_core >=2,<4"]
build-backend = "flit_core.buildapi"

[tool.flit.metadata]
# ...

[project]
dependencies = ["clint>=0.5.1", "coverage>=4.4.1"]

[project.optional-dependencies]
test = ["doublex-expects>=0.7.0rc2", "expects>=0.8.0", "mock>=2.0.0"]
dev = ["doublex-expects>=0.7.0rc2", "expects>=0.8.0", "flit>=3", "mock>=2.0.0", "sphinx-autobuild>=0.7.1", "sphinx>=1.6.5"]

I can't swear to all the syntax details, but it seems the transition for flit would basically be:

Is that the proper response to PEP 631, for flit?

takluyver commented 3 years ago

Yes, it does look like Flit just needs to handle the same data from the new names. :slightly_smiling_face:

Of course, we'll need to keep supporting the tool.flit locations as well for some time, to avoid breaking existing packaging. Specifying both fields should probably be an error.