Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Let’s fix extras in Core Metadata 3.0

Let’s fix extras in Core Metadata 3.0

Slides for a discussion in the PyCon US 2022 Packaging Summit. This probably won’t make much sense unless you read the minute notes. You can also find there other topics discussed during the summit.

https://hackmd.io/Rv_FmGp6TniDWM4EXyZmMw

Tzu-ping Chung

May 01, 2022
Tweet

More Decks by Tzu-ping Chung

Other Decks in Programming

Transcript

  1. Let’s fix extras in Core Metadata 3.0
    1

    View Slide

  2. Extras
    Name normalisation and comparison
    PEP 685
    Make sense of extra comparison in markers
    == “works” but is wrong
    Default extras
    2

    View Slide

  3. Name normalisation
    Covered by Brett’s PEP 685 but has consequences
    Extra name must be normalised in markers
    Incompatibility
    Easy for tools to get wrong
    3

    View Slide

  4. Extra in marker is a mess
    extra == "foo" is wrong
    pip install package[docs,tests]
    any(marker.evaluate({"extra": x}) for x in extras)
    No other operators make sense
    “Negative extra” is impossible
    Exclude a dependency when an extra is specified
    4

    View Slide

  5. extras instead of extra
    pytest>=6.0; 'tests' in extras
    Use not in for negation
    Special semantics for operators
    Normalise operands on comparison
    Should drop extra to avoid confusion
    Incompatibility
    5

    View Slide

  6. Default extra group
    I think Pradyun showed interests
    Probably can use help from interested folks
    A “default extra” specification in metadata
    Requires-Dist: package asks for that extra group
    Semantic incompatibility
    What happens when pip install package[another] ?
    package[] requests to not install the defaul group?
    6

    View Slide

  7. Proposals (1/2)
    Metadata 3.0 or not?
    PEP 685 already (slightly) broke compatibility
    Or we keep extra and stay on 2.x
    But if we bump to 3.0…
    Default extra group
    I should get in touch with Pradyun
    7

    View Slide

  8. Proposal (2/2)
    Drop old fields made problematic by PEP 621
    Home-page
    The Author and Maintainer divide
    I think there are more
    There must be more we can do
    8

    View Slide