Skip to content

setup.py: handle missing pkg_resources import#592

Open
chenrui333 wants to merge 1 commit intohtml5lib:masterfrom
chenrui333:setuptools-81-compat
Open

setup.py: handle missing pkg_resources import#592
chenrui333 wants to merge 1 commit intohtml5lib:masterfrom
chenrui333:setuptools-81-compat

Conversation

@chenrui333
Copy link

Signed-off-by: Rui Chen <rui@chenrui.dev>
hswong3i added a commit to alvistack/html5lib-html5lib-python that referenced this pull request Feb 10, 2026
    git clean -xdf
    tar zcvf ../python-html5lib_1.1.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-html5lib.spec ../python-html5lib_1.1-1.spec
    cp ../python*-html5lib*1.1*.{gz,xz,spec,dsc} /osc/home\:alvistack/html5lib-html5lib-python-1.1/
    rm -rf ../python*-html5lib*1.1*.*

See html5lib#583
See html5lib#587
See html5lib#592

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
@loqs
Copy link

loqs commented Feb 12, 2026

@chenrui333 will you also be doing a pull for pkg_resources use in html5lib/tests/conftest.py?

from pkg_resources import parse_version
import pkg_resources
except ModuleNotFoundError:
from setuptools._vendor.packaging.version import parse as parse_version
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chenrui333 @grawlinson this does not work on Arch linux. The vendor namespace is an internal implementation detail that should not be relied upon. setuptools 82 that removed pkg_resources requires the packaging package so if pkg_resources is not provided by setuptools packing will be available not withstanding a broken installation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like @loqs has said; It is 100% better to just do from packaging import parse as parse_version rather than depending on an internal implementation which will change at some point in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants