GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — setup.py: handle missing pkg_resources import by chenrui333 · Pull Request #592 · html5lib/html5lib-python

Conversation

@chenrui333

@chenrui333 chenrui333 commented Feb 9, 2026

Copy link
Copy Markdown

relates to Homebrew/homebrew-core#266589

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@chenrui333
setup.py: handle missing pkg_resources import
1dbc19c
Signed-off-by: Rui Chen <[email protected]>
@chenrui333 chenrui333 mentioned this pull request Feb 9, 2026
flexget 3.18.44 Homebrew/homebrew-core#266589
Merged
hswong3i added a commit to alvistack/html5lib-html5lib-python that referenced this pull request Feb 10, 2026
@hswong3i
alvistack/1.1
31fc198
    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 <[email protected]>
@loqs

loqs commented Feb 12, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loqs
loqs reviewed Feb 13, 2026
View reviewed changes
Comment thread setup.py
from pkg_resources import parse_version
import pkg_resources
except ModuleNotFoundError:
from setuptools._vendor.packaging.version import parse as parse_version

@loqs loqs Feb 13, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@grawlinson grawlinson Feb 13, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@loqs loqs Feb 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I think the issue can be avoided as the check is only for setuptools less than 18.5 and pkg_resources was removed in setuptools 82 so the import failure means there is no need to do the version check and it is enough to set pkg_resources to None:

--- a/setup.py
+++ b/setup.py
@@ -6,9 +6,11 @@ import sys
 
 from os.path import join, dirname
 from setuptools import setup, find_packages, __version__ as setuptools_version
-from pkg_resources import parse_version
 
-import pkg_resources
+try:
+    import pkg_resources
+except ImportError:
+    pkg_resources = None
 
 try:
     import _markerlib.markers

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

grawlinson reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@loqs loqs mentioned this pull request Feb 28, 2026
setuptools > 81 doesn't include pkg_resources #593
Open
@loqs loqs mentioned this pull request Mar 16, 2026
Replace pkg resources use #594
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

2 more reviewers
@grawlinson grawlinson grawlinson left review comments
@loqs loqs loqs left review comments
Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@chenrui333 @loqs @grawlinson
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.