Conversation
pkg_resources was removed in setuptools 82.0.0, so mqtt-io fails to import on
any environment with a current setuptools:
File "mqtt_io/modules/__init__.py", line 12, in <module>
import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
Pinning setuptools below 82 is not a way out either. Every release that still
ships pkg_resources is covered by GHSA-h35f-9h28-mq5c, so the pin trades an
import error for a vulnerability report, and distributions have moved on
regardless. Alpine 3.24 already ships setuptools 82.0.1.
pkg_resources was only used to work out whether a module's REQUIREMENTS are
already installed, which importlib.metadata and packaging do directly. The
behaviour is unchanged: satisfied requirements install nothing, unsatisfied
version specifiers and absent packages are both still detected, and extras
syntax still parses.
This also lifts the setuptools pin in the development dependencies, which the
issue notes was only there to hold pkg_resources in place.
Fixes flyte#441
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #441.
pkg_resourceswas removed in setuptools 82.0.0, so mqtt-io fails to import on any environment with a current setuptools:Pinning setuptools below 82, as the development dependencies currently do, is not a way out. Every release that still ships
pkg_resourcesis covered by GHSA-h35f-9h28-mq5c, so the pin trades an import error for a vulnerability report, and there is no version that is both usable and unaffected:pkg_resources< 8282.x>= 83Distributions have moved on regardless. Alpine 3.24 already ships setuptools 82.0.1, so this is not something downstreams can pin their way around either.
pkg_resourceswas used in exactly one place, to work out whether a module'sREQUIREMENTSare already installed.importlib.metadataandpackagingdo that directly, so this swaps the two out and lifts the setuptools pin along with them.packagingis added as a dependency. It is pure Python, already present in most environments, and itsRequirementparser is the same one pip uses.Behaviour is unchanged. Checked against the installed set:
REQUIREMENTSPkg[extra]>=1.0pylint -d fixmerates the module 10.00/10 andmypy --show-error-codes --strict --no-warn-unused-ignoresreports no issues, matching what CI runs.For context, this came up while updating the Home Assistant community app that packages mqtt-io. It is currently carrying this as a local patch, which I would happily drop.