pypa / twine

Utilities for interacting with PyPI
https://twine.readthedocs.io/
Apache License 2.0
1.61k stars 308 forks source link

test_integration: allow PEP 625 sdist name #1096

Closed woodruffw closed 6 months ago

woodruffw commented 6 months ago

This should fix the integration tests.

Explanation: the integration suite uses pypa/sampleproject, which uses setuptools as its build backend. setuptools in turn has recently switched to adhering to PEP 625, which enforces that hyphens in package names be normalized to underscores to eliminate a parsing ambiguity in the sdist file format.

sampleproject's backend dependency on setuptools is unconstrained, which means in principle that the latest version should always be used. However, this patch allows both the PEP 625 and the old variant, just in case pip or other layers of the stack select an older setuptools.

See also: https://github.com/pypa/setuptools/issues/3593

woodruffw commented 6 months ago

I confirmed that this fixes the dist name assert locally, but the integration suite is now flaking on TestPyPI itself returning 503s.

The flake on (macOS, 3.8) appears to be something very deeply broken: I can confirm that lxml itself is installed, but it appears that lxml's 3.8 macOS wheel may actually be broken, causing mypy to ImportError on it. From local testing:

>>> from lxml import etree
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/william/tmp/env/lib/python3.8/site-packages/lxml/etree.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '_exsltDateXpathCtxtRegister'
>>> 

(That approximates how mypy discovers lxml: https://github.com/python/mypy/blob/ba6febc903776491ea445cef2ef5375b95e178cd/mypy/report.py#L27-L32)

woodruffw commented 6 months ago

Integration is still flaky for the reason above, but I've "fixed" the Python 3.8 macOS failure by excluding the current patch version of lxml from the types environment. I've filed a launchpad tracker for the bad wheel here: https://bugs.launchpad.net/lxml/+bug/2064158