Skip to content

Consider accepting - and _ in extras nameΒ #4921

Open
@jamesliu4c

Description

@jamesliu4c

Here is the changelog message for 78.0.2:

Postponed removals of deprecated dash-separated and uppercase fields in setup.cfg. All packages with deprecated configurations are advised to move before 2026.

I advocate that the better option is to accept - and _, and remove the deprecation warning. Anything else would risk major breaking changes throughout the ecosystem again.

I traced down the issue where making the deprecation into a breaking change was discussed. #4864 (comment).

Quoting rather liberally,

Now we have a couple of options:

  1. Transform the deprecation warning in a proper error, to force the end-users to implement the necessary changes in their code-base.
  2. Postpone it if we feel that the community is not ready for the change yet.
  3. Give-up entirely on the deprecation on the basis that there might be unmaintained packages out there only published to PyPI as sdists important to the environment.
    a. We can just settle for forever warning the deprecation without removing backwards compatibility.
    b. Change the parsing of setup.cfg accept both - or _ without warnings.

And @jaraco said in response:

That said, I'm leaning toward option 1, get some signal out there to non-compliant projects, and then if the disruption is large, rollback and fallback to option 2 (now with the affected projects having visibility to the issue).

The ticket was closed when the tests were marked as xfail here.

@zanieb warned that the disruption would be quite large here:

That said, I'm leaning toward option 1, get some signal out there to non-compliant projects,

I think rolling out changes like this is quite disruptive to the ecosystem and is to aggressive for a foundational package like this. I would appreciate more effort determining if changes like this would be disruptive ahead of time.
...

Change the parsing of setup.cfg accept both - or _ without warnings.

Is there a downside to this approach? It looks like this was originally deprecated because the extra names were not installed correctly by pip (#1608) but that doesn't seem like a strong motivation? (I tried pip install '.[foo-b]' with the extra name foo_b and it seems to work fine now)

And now, after all this, we are at option 2, punt. Sometime in 2026, we will do this all over again. Don't let's kid ourselves that the long tail of PyPI packages will release patches to comply with this change within a year.

So why not choose option 3, remove the deprecation, and roll forward accepting - and _?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions