flit icon indicating copy to clipboard operation
flit copied to clipboard

Update dependency format according to PEP 631 / 621

Open AndydeCleyre opened this issue 5 years ago • 1 comments

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:

  • rename tool.flit.metadata.requires-extra -> project.optional-dependencies
  • rename/relocate tool.flit.metadata.requires -> project.dependencies

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

AndydeCleyre avatar Oct 21 '20 19:10 AndydeCleyre

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.

takluyver avatar Oct 22 '20 19:10 takluyver