Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: dependencies = setuptools for gyp --version on Python >= 3.12 #256

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented May 9, 2024

On Python >= 3.12

% pipx run --no-cache --spec git+https://github.com/nodejs/gyp-next.git gyp --help was erroring with

ModuleNotFoundError: No module named 'packaging'

% pipx run --no-cache --spec git+https://github.com/nodejs/gyp-next.git gyp --version is still erroring with

ModuleNotFoundError: No module named 'pkg_resources'

gyp --help was fixed in gyp-next v0.18.0
gyp --version was not

Since both modules are included setuptools let's use that recommended fix.


Proof:
% pipx install gyp-next
% gyp --version # Fails!
% pipx inject gyp-next setuptools # This is the same action as this pull request.
% gyp --version # Works as expected.
% gyp --help # Works as expected.

@cclauss cclauss requested a review from legendecas May 9, 2024 13:39
@cclauss cclauss added the python Pull requests that update Python code label May 9, 2024
@cclauss cclauss changed the title chore: dependencies = setuptools for gyp --version on Python >= 3.12 chore: dependencies = setuptools for gyp --version on Python >= 3.12 May 9, 2024
@@ -12,7 +12,7 @@ description = "A fork of the GYP build system for use in the Node.js projects"
readme = "README.md"
license = { file="LICENSE" }
requires-python = ">=3.8"
dependencies = ["packaging>=24.0"]
dependencies = ["setuptools>=69.5.1"]
Copy link
Member

Choose a reason for hiding this comment

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

I believe packaging should not be removed as installing setuptools doesn't come with packaging.

Suggested change
dependencies = ["setuptools>=69.5.1"]
dependencies = ["packaging>=24.0", "setuptools>=69.5.1"]

Copy link
Member

@legendecas legendecas May 9, 2024

Choose a reason for hiding this comment

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

Downloading setuptools-69.5.1-py3-none-any.whl from https://pypi.org/project/setuptools/#files and unarchiving it, I didn't find that packaging is included in setuptools.

Copy link
Contributor Author

@cclauss cclauss May 10, 2024

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Yes, packaging is vendored in setuptools. But as far as I could tell, packaging in setuptools is not exposed in site-packages with setuptools. So it would need to import like from setuptools._vendor.packaging.version import Version.

Copy link
Member

Choose a reason for hiding this comment

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

@cclauss I created a github action to verify this change: https://github.com/legendecas/gyp-next/actions/runs/9127187853

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants