Packaging issues with sphinxcontrib packages
Dear fellows, I have some troubles with two sphinxcontrib packages (but others are likely similar). Since a few weeks , the builds, actually the docs, fail with: [ 99s] + pushd docs [ 99s] ~/rpmbuild/BUILD/sphinxcontrib-asyncio-0.3.0/docs ~/rpmbuild/BUILD/sphinxcontrib-asyncio-0.3.0 [ 99s] + PYTHONPATH=.. [ 99s] + make html [ 99s] sphinx-build -b html -d _build/doctrees . _build/html [ 100s] Running Sphinx v4.4.0 [ 100s] [ 100s] Extension error: [ 100s] Could not import extension sphinxcontrib.asyncio (exception: No module named 'sphinxcontrib.asyncio') [ 100s] make: *** [Makefile:56: html] Error 2 [ 100s] error: Bad exit status from /var/tmp/rpm-tmp.TJFdic (%build) While the PYTHONPATH is set correctly, the problem is, that the module sphinxcontrib is loaded from the sitelib. There, no asyncio sub-module exists and the loading of sphinxcontrib.asyncio fails. Maybe this is due to changed Python behavior of finding modules? I haven't seen anything related in the Python changelogs however. Does anyone has an idea how to circumvent this issue, or a best practice? cheers, Sebix
Hi Seb, Am 29.01.22 um 15:12 schrieb Sebix:
Dear fellows,
I have some troubles with two sphinxcontrib packages (but others are likely similar). Since a few weeks , the builds, actually the docs, fail with:
[ 99s] + pushd docs [ 99s] ~/rpmbuild/BUILD/sphinxcontrib-asyncio-0.3.0/docs ~/rpmbuild/BUILD/sphinxcontrib-asyncio-0.3.0 [ 99s] + PYTHONPATH=.. [ 99s] + make html [ 99s] sphinx-build -b html -d _build/doctrees . _build/html [ 100s] Running Sphinx v4.4.0 [ 100s] [ 100s] Extension error: [ 100s] Could not import extension sphinxcontrib.asyncio (exception: No module named 'sphinxcontrib.asyncio') [ 100s] make: *** [Makefile:56: html] Error 2 [ 100s] error: Bad exit status from /var/tmp/rpm-tmp.TJFdic (%build)
While the PYTHONPATH is set correctly, the problem is, that the module sphinxcontrib is loaded from the sitelib. There, no asyncio sub-module exists and the loading of sphinxcontrib.asyncio fails. Maybe this is due to changed Python behavior of finding modules? I haven't seen anything related in the Python changelogs however. Does anyone has an idea how to circumvent this issue, or a best practice?
sphinxcontrib-* are pkg_resources-style namespace packages. https://packaging.python.org/en/latest/guides/packaging-namespace-packages/ The culprit is hinted at by this line in python-sphinxcontrib-asyncio.spec:
# Remove sphinxcontrib namespace package files provided by python-Sphinx
python38-Sphinx does not provide the pkg_resources style __init__.py file from python-Sphinx (anymore?), but all the python-sphinxcontrib-* packages expect it. The PYPI packages all provide it and overwrite each other during install, but we can't allow those file conflicts in a rpm package. So either python-Sphinx needs to reintroduce this file or there needs to be a python-sphinxcontrib package providing it, which all python-sphinxcontrib-* packages depend on. I didn't check. Maybe it exists and is just not in the dependency tree?
cheers, Sebix
- Ben
Dne 29. 01. 22 v 17:26 Ben Greiner napsal(a):
python38-Sphinx does not provide the pkg_resources style __init__.py file from python-Sphinx (anymore?), but all the python-sphinxcontrib-* packages expect it. The PYPI packages all provide it and overwrite each other during install, but we can't allow those file conflicts in a rpm package.
So either python-Sphinx needs to reintroduce this file or there needs to be a python-sphinxcontrib package providing it, which all python-sphinxcontrib-* packages depend on. I didn't check. Maybe it exists and is just not in the dependency tree?
Couldn't we charge ahead and switch everything to PEP-420 native namespace packages? They should be supported natively since Python 3.3, that's on any platform SUSE provides (all the way down to SLE-11 if you ignore Python 2 ;)). Best, Matěj -- https://matej.ceplovi.cz/blog/, Jabber: mcepl@ceplovi.cz GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8 It took me fifteen years to discover I had no talent for writing, but I couldn’t give it up, because by that time I was too famous. -- Robert Benchley
Am 30.01.22 um 00:28 schrieb Matěj Cepl:
Dne 29. 01. 22 v 17:26 Ben Greiner napsal(a):
python38-Sphinx does not provide the pkg_resources style __init__.py file from python-Sphinx (anymore?), but all the python-sphinxcontrib-* packages expect it. The PYPI packages all provide it and overwrite each other during install, but we can't allow those file conflicts in a rpm package.
So either python-Sphinx needs to reintroduce this file or there needs to be a python-sphinxcontrib package providing it, which all python-sphinxcontrib-* packages depend on. I didn't check. Maybe it exists and is just not in the dependency tree?
AFAICT Tumbleweed did have the pkg_resources-style __init__.py file and later outsourced it into a meta python-sphinxcontrib package [1]. SLE/Leap 15 still does have that one. Somehow it was dropped from TW at one point.
Couldn't we charge ahead and switch everything to PEP-420 native namespace packages? They should be supported natively since Python 3.3, that's on any platform SUSE provides (all the way down to SLE-11 if you ignore Python 2 ;)).
I guess it is possible for Tumbleweed. Some cons to consider: * You are deviating from the upstream design. * You have to fix every single sphinxcontrib-* package like [2], in contrast to one easy fix in python-Sphinx.spec * In SLE/Leap, there is still the python-sphinxcontrib package interfering. * If a user mixes system the sitelib with a user-sitelib or virtualenv sitelib and installs PyPI packages the whole design fails in the same way as Seb's examples fail with the custom PYTHONPATH [3]: "*Every*distribution that uses the namespace package must include an identical|__init__.py|. If any distribution does not, it will cause the namespace logic to fail and the other sub-packages will not be importable."
Best,
Matěj
- Ben [1] https://build.opensuse.org/request/show/527167 [2] https://build.opensuse.org/package/rdiff/home:bnavigator:branches:devel:languages:python/python-sphinxcontrib-asyncio?opackage=python-sphinxcontrib-asyncio&oproject=devel%3Alanguages%3Apython&rev=4 [3] https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#...
participants (3)
-
Ben Greiner
-
Matěj Cepl
-
Sebix