PEP 621: how to specify dependencies?

It feels like a really disingenuous way of representing each PEP (one being still in discussion). The TOML representation purposefully mixes notations, where there is no need to, which makes it less readable.

I have yet to mention it of the TOML PEP discussion but we could have a shorthand syntax for version-only cases to avoid clutter. At this point the TOML representation would be (still provisional though):

[project.dependencies]
cached-property = ">= 1.2.0, < 2"
distro = ">= 1.2.0, < 2"
docker = { version = ">= 4.2.2, < 5", extras = ["ssh"] }
docopt = ">= 0.6.1, < 1"
jsonschema = ">= 2.5.1, < 4"
PyYAML = ">= 3.10, < 6"
python-dotenv = ">= 0.13.0, < 1"
requests = ">= 2.20.0, < 3"
texttable = ">= 0.9.0, < 2"
websocket-client = ">= 0.32.0, < 1"

# Conditional
"backports.shutil_get_terminal_size" = { version = "== 1.0.0", markers = "python_version < '3.3'" }
"backports.ssl_match_hostname" = { version = ">= 3.5, < 4", markers = "python_version < '3.5'"}
colorama = { version = ">= 0.4, < 1", markers = "sys_platform == 'win32'" }
enum34 = { version = ">= 1.0.4, < 2", markers = "python_version < '3.4'" }
ipaddress = { version = ">= 1.0.16, < 2", markers = "python_version < '3.3'" }
subprocess32 = { version = ">= 3.5.4, < 4", markers = "python_version < '3.2'" }

I simply copy/pasted the section from each PEPā€¦

2 Likes

Oh, my bad then :sweat_smile:

It seems there is still work to do to iron out the TOML PEP. Like I said I still need to catch up on it and give feedback to improve it.

Again I am sorry for that comment but I think we should hold off on making comparisons just yet while itā€™s still a work in progress.

1 Like

Youā€™re right, I deliberately mixed notations to showcase the flexibility of TOML, when perhaps I should have presented the most readable option. Should have followed the KISS paradigm.

A quick example of something that nearly achieves this is dotted-key notation

cached-property.version = ">= 1.2.0, < 2"

Thereā€™s immediately a likely point of confusion for users there, however, for projects with dots in the name (which is really an issue in all situations in the exploded table form)

"backports.shutil_get_terminal_size".version = "== 1.0.0"

The only project I had come across other than backports which had dots was ruamel.yaml, so perhaps itā€™s not common enough to be an issue, and can be solved via documentation in the projectā€™s installation instructions

Probably should have put this post in the PEPā€™s discussion topic

Ultimately, the PEP needs to present the agreed-upon option. If thereā€™s no agreed-upon option yet, then framing it as a PEP was probably misleading (certainly to people who are not actively pushing for a TOML format, who are basically waiting for the people who are to come up with a consensus). If itā€™s still just a starter for discussion, then yes, it probably is too early to be comparing the two options.

Brettā€™s proposal was that there should be ā€œa draft proposal being actively discussed as a topic hereā€. I take that as meaning that the people in favour of the expanded approach should have reached at least rough consensus on what they want to be considered as their proposal. It sounds like thereā€™s still some work to be done to get that rough consensus. Iā€™d consider the best time to post a draft PEP to be once you have that consensus on what you want to say, personallyā€¦

At some point we really do need to limit the decision to just two proposals - PEP 508 and some well-defined ā€œexpandedā€ syntax. If we canā€™t get to that point, weā€™ll need to decide what to do - drop the whole thing, go with PEP 508 syntax because itā€™s the only concrete proposal we have, or let things drift on for even longer. I personally think the debating has gone on long enough, and we need to make a decision and be done with it.

2 Likes

Yes, and the point of the deadline was to make sure there were people dedicated enough to see each idea through to a conclusion.

Yes, if those interested in an idea canā€™t come to a conclusion on what to include in a PEP proposal then I would say it lacks enough support to be considered. I think it looks like both camps are on there way, though. My assumption is weā€™re are going to be done debating this by the end of the month:

  1. Reach consensus on design by each camp by Tuesday, Sep 8
  2. Have PEPs submitted by Tuesday, Sep 15 (since a design would have been agreed upon this is just writing it down succinctly)
  3. Debate until Thursday, Oct 1
  4. Make a decision sometime shortly after that
2 Likes

I believe the most popular project (likely by a large margin) using a dot in its canonical name is coverage.py.

Iā€™ve listed some open-issues in the draft. In addition Iā€™d like comment about the switch to the PEP 610 direct property. Those invested in the exploded table can head to the discussion topic

There are also zope.interface and flufl.enum. Namespacing using dots isnā€™t massively common, but itā€™s not unheard of eitherā€¦

That may be its Ā«marketingĀ» name (it appears in its readme and documentation, sometimes even capitalized), but the metadata name is coverage.

2 Likes

The PEP-draft for the exploded-table dependencies format can be found at: https://github.com/EpicWink/peps/blob/5531d87a5507233ad32131c41eeb3ee04f602c05/pep-9999.rst

1 Like

Here is the PEP 508-based version: https://github.com/python/peps/blob/master/pep-0631.rst

edit: note there is no support for syntax highlighting in the main repo, see https://github.com/python/peps/pull/1577

1 Like

If the PEP is at a stable enough place to go into the PEPs repo then please submit a PR and I can get it assigned a number and checked in. It can obviously keep getting tweaks if you are mostly happy with where things stand.

Thanks to @ofek, @EpicWink and everyone who has/is/will participate in this!

And just as a more visible clarification here from the exploded table topic: the whole optional-dependencies table bit currently in PEP 621 can be changed with good reasoning behind it if that proposed split is too rigid or non-ergonomic for people.

As far as Iā€™m concerned, any of the PEPs can be modified right up to the point where things get submitted for approval. When Iā€™m asked to make a decision, Iā€™ll simply review the PEPs as they are at that point.

One thing I feel I should mention - these PEPs are mandating a particular input format for build backends. So far, the focus has been on refining the two dependency proposals, which is exactly as it needed to be. But once thatā€™s done, Iā€™d hope we can move back to consensus building and co-operation, and not simply leave it as ā€œwe donā€™t agree, pick oneā€. We may not get full consensus, but everyone should at least understand both dependency PEPs, as they will be expected to implement whichever one is approved. If weā€™re going to end up in a situation where it looks like projects might ignore the standard because a decision didnā€™t go their way, thereā€™s no point in having a standard at all :frowning:

1 Like

I canā€™t speak for other backend maintainers, but Hatch will only support the PEP that is chosen. I donā€™t have a strong enough preference to reject a standard :slightly_smiling_face:

I likely wonā€™t adopt any of this entire PEP until a library (hopefully packaging) can do all the work for me. One of the pymsbuild ā€œfeaturesā€ is minimal processing/validation of metadata, so Iā€™m certainly not going to inject my own interpretation of converting to a METADATA file in there.

2 Likes

Iā€™m very much assuming there will be some library that will take the dict from reading the TOML and provide a function to spit out the appropriate METADATA and such.

Iā€™m not certain how the debate is supposed to go, but I guess Iā€™ll start it off by saying currently I prefer the PEP 508-based approach (link: https://github.com/python/peps/blob/master/pep-0631.rst)

2 Likes

@ofek Iā€™m going to ping the relevant PEP threads to make sure they feel ready to have a focused discussion and then I will start a new thread (this one is way too long to build off of).

I have created How to specify dependencies: PEP 508 strings or a table in TOML? to discuss the two PEPs. Iā€™m going to lock this topic now to make sure future discussions happen over there.

2 Likes