Skip to content

Remove runtime pkg_resources dependency in default and server_ingester#7057

Open
0xmagnus91 wants to merge 1 commit intotensorflow:masterfrom
0xmagnus91:fix/pkg-resources-removal-safe
Open

Remove runtime pkg_resources dependency in default and server_ingester#7057
0xmagnus91 wants to merge 1 commit intotensorflow:masterfrom
0xmagnus91:fix/pkg-resources-removal-safe

Conversation

@0xmagnus91
Copy link

Motivation for features / changes

Fixes #7003.

pkg_resources is removed in newer setuptools, which can break TensorBoard at import/runtime. This change removes runtime reliance on pkg_resources in the two affected code paths.

Technical description of changes

  • Replaced dynamic plugin discovery in tensorboard/default.py:
    • from pkg_resources.iter_entry_points(...)
    • to importlib.metadata.entry_points(...) with compatibility handling for different Python return shapes.
  • Replaced version parsing in tensorboard/data/server_ingester.py:
    • from pkg_resources.parse_version(...)
    • to packaging.version.parse(...).
  • Updated related tests:
    • tensorboard/default_test.py now patches _iter_entry_points and uses load()-style fake entry points.
    • tensorboard/version_test.py now validates PEP 440 behavior using packaging.version.
  • Updated Bazel deps to use expect_packaging_installed where packaging is now required.

Detailed steps to verify changes work correctly (as executed by you)

Executed locally in an isolated venv:

  • python -m py_compile tensorboard/default.py tensorboard/default_test.py tensorboard/data/server_ingester.py tensorboard/version_test.py
  • PYTHONPATH=. python tensorboard/version_test.py (passes)

Attempted but environment-limited locally:

  • bazel test //tensorboard:version_test //tensorboard:default_test //tensorboard/data:server_ingester_test (bazel not available in local shell)
  • Direct execution of default_test.py and server_ingester_test.py without Bazel-generated artifacts hit local environment/import constraints.

Alternate designs / implementations considered (or N/A)

  • N/A

@0xmagnus91
Copy link
Author

Added local validation results while workflow runs are pending maintainer approval for fork PR CI.

Local command executed:
bazel test //tensorboard:version_test //tensorboard:default_test //tensorboard/data:server_ingester_test

Result: all 3 targets passed locally.

Could a maintainer approve the pending workflow runs so required checks can execute on this PR? Thanks.

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.

Deprecated pkg_resources package

1 participant

Comments