GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Accept Python 3 by default by joaocgreis · Pull Request #1844 · nodejs/node-gyp

Conversation

@joaocgreis

@joaocgreis joaocgreis commented Jul 23, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
Checklist
  • npm install && npm test passes
  • commit message follows commit guidelines
Description of change

This depends on #1843, I will rebase when that PR lands. Only a971947 needs to be reviewed here.

This makes node-gyp accept Python 3 as compatible without needing EXPERIMENTAL_NODE_GYP_PYTHON3 in the environment. It also looks for python, python3, then python2 (in that order). Note that python is usually Python 2.

@nodejs/node-gyp please not that we cover little more than a basic hello world in our tests, there are probably parts of Gyp that are not covered and are not compatible with Python 3. We will have to be extra careful shipping the node-gyp version that includes this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@joaocgreis joaocgreis added the semver-major label Jul 23, 2019
@joaocgreis

joaocgreis commented Jul 23, 2019

Copy link
Copy Markdown
Member Author

CI: https://ci.nodejs.org/view/All/job/nodegyp-test-pull-request/152/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

richardlau
richardlau reviewed Jul 23, 2019
View reviewed changes
Comment thread lib/find-python.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

cclauss
cclauss approved these changes Jul 23, 2019
View reviewed changes

@cclauss cclauss left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Awesome work here!

Can you please add a Python 3 on macOS on Travis CI test like #1846 just to make sure that is passing?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@joaocgreis

joaocgreis commented Jul 24, 2019

Copy link
Copy Markdown
Member Author

@cclauss I think #1846 is the proper place to do it, this PR might take a while to land. I'll rebase on top of that PR and adjust accordingly when it lands!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joaocgreis

joaocgreis commented Jul 24, 2019

Copy link
Copy Markdown
Member Author

This is blocked by #1846, we can't land this with OSX failing.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cclauss cclauss mentioned this pull request Jul 24, 2019
build: add test run Node.js 12 & Python 3.7 on macOS #1846
Closed
1 of 4 tasks
@rvagg

rvagg commented Jul 26, 2019

Copy link
Copy Markdown
Member

seems good to me but I'm confused on whether the macos problems block this and #1843 or if they can land independently of that?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cclauss

cclauss commented Jul 26, 2019

Copy link
Copy Markdown
Contributor

We can land this with the macOS tests still running in allow_failures mode. Our README clearly states that Python 3 is not supported which aligns with Travis CI's intent for allow_failures

[allow_failures] lets you add in experimental and preparatory builds to test against versions or configurations that you are not ready to officially support.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joaocgreis

joaocgreis commented Jul 26, 2019

Copy link
Copy Markdown
Member Author

#1843 has landed. In there, node-gyp only uses Python 3 if EXPERIMENTAL_NODE_GYP_PYTHON3 is defined, so it should not break anything we currently have.

This PR removes that flag, making node-gyp accept Python 3. So, if a release is shipped with this PR, node-gyp will start using Python 3 in the users computers, and any issue we have will manifest there.

Currently, we know Python 3 is failing on osx, so shipping a release with this would break node-gyp on every osx machine that has Python 3 installed.

We know that our tests pass with Python 3 on Windows and Linux, but our tests don't have a good coverage of gyp. It's likely that there are modules out there that use parts of gyp that we don't test here, and those would be broken as well. GYP3 could help a lot with this.

So, we can't land this PR until all failures that we know of are fixed.

cclauss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

joaocgreis added a commit to JaneaSystems/node-gyp that referenced this pull request Jul 26, 2019
@joaocgreis
lib: accept Python 3 by default
9be02bc
PR-URL: nodejs#1844
@joaocgreis
joaocgreis force-pushed the joaocgreis-J7N-python3-3 branch 2 times, most recently from 9be02bc to 9318e21 Compare July 26, 2019 15:19
joaocgreis added a commit to joaocgreis/node-gyp that referenced this pull request Jul 26, 2019
@joaocgreis
lib: accept Python 3 by default
9318e21
PR-URL: nodejs#1844
joaocgreis added a commit to JaneaSystems/node-gyp that referenced this pull request Jul 26, 2019
@joaocgreis
lib: accept Python 3 by default
b154b07
PR-URL: nodejs#1844
@joaocgreis
joaocgreis force-pushed the joaocgreis-J7N-python3-3 branch from 9318e21 to b154b07 Compare July 26, 2019 15:27
@sam-github sam-github mentioned this pull request Sep 6, 2019
tools/test.py is not yet Python 3 compatible nodejs/node#29246
Closed
@sam-github

sam-github commented Sep 6, 2019

Copy link
Copy Markdown
Contributor

nodejs/node#29246 bumped into this.

I'm not sure what the plan is. If I'm missing the conversation elsewhere, pls point me there! I don't want to fragment an existing conversation.

node's tests can't pass on a py3-only machine until npm has a copy of node-gyp that supports py3.

Does npm even get node-gyp from this repo? :-( Sorry, you can see how late to this "party" I'm arriving.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented Sep 6, 2019

Copy link
Copy Markdown
Member

Does npm even get node-gyp from this repo?

Yes. :-)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joaocgreis

joaocgreis commented Sep 10, 2019

Copy link
Copy Markdown
Member Author

@sam-github my comment above is still a valid summary of the current situation. Going forward, I believe the options on the table are either to use GYP3 (#1845) or fix the osx issues (@cclauss might be working on that).

This PR is ready to be rebased and land landed when we believe Python 3 support to be ready. However, this PR does not change any Python code, it only removes the block to run on Python 3.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cclauss cclauss added the Python label Sep 11, 2019
@cclauss cclauss mentioned this pull request Sep 11, 2019
Node.js Foundation Technical Steering Committee (TSC) Meeting 2019-09-11 nodejs/TSC#753
Closed
@madacol madacol mentioned this pull request Sep 12, 2019
Python 2 will be deprecated in a little more than 3 months kelektiv/node.bcrypt.js#754
Closed
This was referenced Sep 23, 2019
build: ongoing list of actions for Python 3 compatibility nodejs/node#25789
Closed
doc: Declare that node-gyp is Python 3 compatible #1811
Closed
Node.js Foundation Technical Steering Committee (TSC) Meeting 2019-09-25 nodejs/TSC#758
Closed
joaocgreis added a commit to joaocgreis/node-gyp that referenced this pull request Sep 25, 2019
@joaocgreis
lib: accept Python 3 by default
f7a28c3
PR-URL: nodejs#1844
@joaocgreis
joaocgreis force-pushed the joaocgreis-J7N-python3-3 branch from b154b07 to f7a28c3 Compare September 25, 2019 13:39
@joaocgreis

joaocgreis commented Sep 25, 2019

Copy link
Copy Markdown
Member Author

Rebased to make Travis run again, but it's still red. Current status: #1844 (comment) and #1844 (comment)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cclauss

cclauss commented Sep 25, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

The macOS error looks related to #1854 so I will attack it...

Fixed in Decode stdout on Python 3 #1890

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cclauss added a commit to cclauss/node-gyp that referenced this pull request Sep 25, 2019
@cclauss
Test nodejs#1844 and nodejs#1854
9f89138
This was referenced Sep 25, 2019
Decode stdout on Python 3 #1890
Closed
Release proposal: v6.0.0 #1892
Closed
@cclauss

cclauss commented Sep 26, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Please rebase again to resolve conflict and ensure macOS now passes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cclauss

cclauss commented Sep 26, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Once this PR lands, does NODE_GYP_FORCE_PYTHON=python3 still have to be set to use Py3?

  • On a machine that has both Python 2 and Python 3 installed?
  • On a machine that only has Python 3 installed?
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

joaocgreis added a commit to JaneaSystems/node-gyp that referenced this pull request Sep 26, 2019
@joaocgreis
lib: accept Python 3 by default
a490ca5
PR-URL: nodejs#1844
@joaocgreis
joaocgreis force-pushed the joaocgreis-J7N-python3-3 branch from f7a28c3 to a490ca5 Compare September 26, 2019 13:09
joaocgreis added a commit to joaocgreis/node-gyp that referenced this pull request Sep 30, 2019
@joaocgreis
lib: accept Python 3 by default
1276037
PR-URL: nodejs#1844
@joaocgreis
joaocgreis force-pushed the joaocgreis-J7N-python3-3 branch from a490ca5 to 1276037 Compare September 30, 2019 05:28
joaocgreis added a commit to joaocgreis/node-gyp that referenced this pull request Sep 30, 2019
@joaocgreis
lib: accept Python 3 by default
3066b03
PR-URL: nodejs#1844
@joaocgreis
joaocgreis force-pushed the joaocgreis-J7N-python3-3 branch from 1276037 to 3066b03 Compare September 30, 2019 05:47
joaocgreis added a commit to joaocgreis/node-gyp that referenced this pull request Sep 30, 2019
@joaocgreis
lib: accept Python 3 by default
167b563
PR-URL: nodejs#1844
@joaocgreis
joaocgreis force-pushed the joaocgreis-J7N-python3-3 branch 2 times, most recently from 0ffb1aa to 167b563 Compare September 30, 2019 06:43
@joaocgreis
lib: accept Python 3 by default
05138c8
PR-URL: nodejs#1844
@joaocgreis
joaocgreis force-pushed the joaocgreis-J7N-python3-3 branch from 167b563 to 05138c8 Compare September 30, 2019 06:47
@joaocgreis

joaocgreis commented Sep 30, 2019

Copy link
Copy Markdown
Member Author

Once this PR lands, does NODE_GYP_FORCE_PYTHON=python3 still have to be set to use Py3?

Doesn't "have" to, but I'd rather keep it in most (if not all) of the entries in Travis, since not having it was the reason we didn't know what Python was actually being run before. This is a good way to avoid surprises.

On a machine that has both Python 2 and Python 3 installed?
On a machine that only has Python 3 installed?

Without NODE_GYP_FORCE_PYTHON the code looks for python, then python3, then python2. Whatever exists first is what's used.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

joaocgreis added a commit that referenced this pull request Sep 30, 2019
@joaocgreis
lib: accept Python 3 by default
3d1c60a
PR-URL: #1844
Reviewed-By: Christian Clauss <[email protected]>
@joaocgreis

joaocgreis commented Sep 30, 2019

Copy link
Copy Markdown
Member Author

Hit an issue because of isaacs/minizlib#9 - Travis kept 1.3.1 in cache. Should be fixed now, forced update in one run and Travis updated the cache.

CI: https://ci.nodejs.org/view/All/job/nodegyp-test-pull-request/155/ ✔️

Landed in 3d1c60a

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joaocgreis joaocgreis closed this Sep 30, 2019
@sam-github

sam-github commented Oct 2, 2019

Copy link
Copy Markdown
Contributor

Does this change which version of python is chosen? I can't tell from the diff.

I.e

  • with python2, python3, and python (2.7) in /usr/bin, which will get chosen?
  • with python2, python3, and python (3.6) in /usr/bin, which will get chosen?

I don't have any concerns either way, but I think we should call out in the docs/changelog if the order of choice changed, right now it just says Python 3 is accepted, not under which conditions is preferred, if ever.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cclauss

cclauss commented Oct 2, 2019

Copy link
Copy Markdown
Contributor

Without NODE_GYP_FORCE_PYTHON the code looks for python, then python3, then python2.
Whatever exists first is what's used.

I take that to mean python will be used.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sam-github

sam-github commented Oct 3, 2019

Copy link
Copy Markdown
Contributor

This makes node-gyp accept Python 3 and look for it before looking for Python 2, making Python 3 the default.

@joaocgreis Can I edit this description? I think that isn't quite accurate, it should be

This makes node-gyp accept Python 3 as compatible without needing EXPERIMENTAL_NODE_GYP_PYTHON3 in the environment. It also looks for python, python3, then python2 (in that order). Note that python is usually Python 2.

Personally, I suggest that this PR can and should land on 5.x, with the minor tweek of moving python3 to after python2, so that users will Python 2 if they have it.

cf #1892 (comment) and previous discussion

joaocgreis reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sam-github sam-github mentioned this pull request Oct 3, 2019
lib: accept Python 3 after Python 2 #1910
Closed
4 tasks
rvagg pushed a commit that referenced this pull request Oct 4, 2019
@sam-github @rvagg
lib: accept Python 3 after Python 2
4215054
Python 3 is allowed as a compatible Python, but its looked for after
Python 2.

rvagg: removed additional EXPERIMENTAL_NODE_GYP_PYTHON3 in
.travis.yml from a previous commit while landing.

Backport-of: #1844
PR-URL: #1910
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
Reviewed-By: João Reis <[email protected]>
rvagg pushed a commit that referenced this pull request Oct 4, 2019
@sam-github @rvagg
lib: accept Python 3 after Python 2
07f81f1
Python 3 is allowed as a compatible Python, but its looked for after
Python 2.

rvagg: removed additional EXPERIMENTAL_NODE_GYP_PYTHON3 in
.travis.yml from a previous commit while landing.

Backport-of: #1844
PR-URL: #1910
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
Reviewed-By: João Reis <[email protected]>
@neilsh neilsh mentioned this pull request Oct 28, 2019
node-gyp 6.0.0 upgrade (resolves python2 dependency) nfroidure/ttf2woff2#55
Merged
@rvagg rvagg mentioned this pull request Nov 18, 2019
Release proposal: [email protected] #1972
Closed
@rvagg rvagg mentioned this pull request Feb 3, 2020
[email protected] Release Proposal #2012
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@richardlau richardlau richardlau left review comments
@cclauss cclauss cclauss approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Python semver-major

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@joaocgreis @rvagg @cclauss @sam-github @bnoordhuis @richardlau
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.