Skip to content

Drop deprecated Python module pkg_resources#333

Merged
legendecas merged 1 commit intonodejs:mainfrom
cclauss:drop-pkg_resources
Mar 2, 2026
Merged

Drop deprecated Python module pkg_resources#333
legendecas merged 1 commit intonodejs:mainfrom
cclauss:drop-pkg_resources

Conversation

@cclauss
Copy link
Contributor

@cclauss cclauss commented Mar 2, 2026

https://setuptools.pypa.io/en/latest/deprecated/pkg_resources.html

Also fixes the ruff rule PLW0108 issue:
pylib/gyp/mac_tool.py:548:61: PLW0108 Lambda may be unnecessary; consider inlining inner function

A subset of:

@cclauss cclauss requested a review from legendecas March 2, 2026 10:56
@cclauss cclauss changed the title Drop deprecated Python module pkg_resources Drop deprecated Python module pkg_resources Mar 2, 2026
@cclauss cclauss requested a review from Copilot March 2, 2026 10:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates gyp-next to remove use of the deprecated pkg_resources API and addresses a Ruff lint finding, keeping the CLI behavior intact while aligning with modern Python packaging APIs.

Changes:

  • Replace pkg_resources.get_distribution(...).version with importlib.metadata.version(...) for --version.
  • Inline an unnecessary lambda (key=lambda v: len(v)) to key=len to satisfy Ruff PLW0108.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pylib/gyp/__init__.py Switches version lookup from deprecated pkg_resources to importlib.metadata.version.
pylib/gyp/mac_tool.py Simplifies max(..., key=...) by inlining len instead of a lambda.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@legendecas legendecas merged commit 5b180d5 into nodejs:main Mar 2, 2026
50 checks passed
@cclauss cclauss deleted the drop-pkg_resources branch March 2, 2026 14:44
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.

3 participants