BUG: fix Python 3.12+ compatibility via importlib.metadata#8
Open
jotelha wants to merge 3 commits into
Open
Conversation
added 3 commits
March 26, 2026 12:17
… compat pkg_resources is no longer bundled by default with Python 3.12+ (it requires setuptools to be installed explicitly). Use importlib.metadata.entry_points as the primary implementation and fall back to pkg_resources for older Python versions where importlib.metadata may not be available.
…staller pretty_version_text() is called as a default argument at module import time. It invokes iter_entry_points() and __import__() on storage broker packages, which fails in PyInstaller's isolated analysis subprocess where no entry points are registered. This causes PyInstaller to silently exclude dtool_cli.cli from the bundle. Defer the call using sys._MEIPASS check so it only runs when the CLI is actually invoked, not during bundled-app import.
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.
Summary
from pkg_resources import iter_entry_pointswith animportlib.metadatashim —pkg_resourcesis no longer bundled with Python 3.12+ by default, breaking every downstream package that importsdtool-clipyproject.tomlfor modern pip build system compatibilitypretty_version_text()evaluation to avoid import-time failure in PyInstaller environments