Master CI failures#52
Merged
Merged
Conversation
The pip smoke tests in CI fail with 'ModuleNotFoundError: No module named pkg_resources' because modern virtualenv/pip no longer pre-install setuptools, and setuptools is not reliably pulled in as a wheel dependency. Replace all pkg_resources usage with stdlib/existing deps: - default.py: pkg_resources.iter_entry_points -> importlib.metadata.entry_points (version-aware helper for Python 3.9 vs 3.10+ API difference) - server_ingester.py: pkg_resources.parse_version -> packaging.version.Version (packaging is already a declared dependency) - version_test.py: pkg_resources.parse_version -> packaging.version.Version - Remove setuptools from requirements.txt (no longer needed) Co-authored-by: Samuel <samuel@knutsen.co>
|
Cursor Agent can help with this pull request. Just |
Preview Deployment
Details
|
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.
Motivation for features / changes
All master CI builds (CI, Wheel Prerelease, Nightly Release) were failing at the "Pip package test" step with
ModuleNotFoundError: No module named 'pkg_resources'. This occurred because modernvirtualenvandpipversions no longer pre-installsetuptoolsin new virtual environments, andsetuptoolswas not being pulled in as a dependency for the installed wheel. The PRs passed previously because the CI runner images had an older pip/virtualenv combination that still bundled setuptools.Technical description of changes
This PR migrates away from
pkg_resourcesby:pkg_resources.iter_entry_points()withimportlib.metadata.entry_points()intensorbored/default.py, including a version-aware helper to handle API differences between Python 3.9 and 3.10+.pkg_resources.parse_version()withpackaging.version.Version()intensorbored/data/server_ingester.pyandtensorbored/version_test.py.tensorbored/default_test.pyto reflect the new entry point implementation.setuptoolsfromtensorbored/pip_package/requirements.txt.BUILDfiles to removeexpect_pkg_resources_installedand addexpect_packaging_installedwhere necessary.Screenshots of UI changes (or N/A)
N/A
Detailed steps to verify changes work correctly (as executed by you)
ModuleNotFoundError: No module named 'pkg_resources'in CI logs forbuild (tf, 3.9)andbuild (notf, 3.9)at the "Pip package test" step.setuptoolswas not present in thepip freezeoutput during the failing CI step.pkg_resourcesusages withimportlib.metadataandpackaging.version.importlib.metadata.entry_points()to support Python 3.9 (dict-like return) and 3.10+ (directgroup=kwarg).setuptoolsfromrequirements.txt.blackandflake8to ensure linting compliance.packagingremains a dependency inrequirements.txt.Alternate designs / implementations considered (or N/A)
Considered the different behaviors of
importlib.metadata.entry_points()across Python versions (3.9 vs 3.10+) and implemented a compatibility layer to ensure correct functionality. No other major alternate designs for replacingpkg_resourceswere considered, asimportlib.metadatais the standard library replacement andpackaging.versionwas already an existing dependency.