-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
build: ongoing list of actions for Python 3 compatibility #25789
Comments
@cclauss This is one neatly compiled list. Thanks for doing that 👍 I am just wondering if we can start dealing with GYP's Python 3 compatibility. |
GYP got a few patches for Python 3 compatibility upstream: https://chromium.googlesource.com/external/gyp/+log |
Oh, that's great. @refack and @cclauss have been working on @refack's fork of GYP at https://github.com/refack/GYP in this regard. Perhaps we can consolidate our efforts. |
I will like to talk ci involved this. I know we are current introduce docker in node ci system. We can introduce a docker image only with python3 to test our code. |
One more thing, not sure this is the right place. We may need to pre-install some python3 package. Line 43 in 86a49ce
|
node/tools/utils.py the file in question. Perhaps we need to start adding from __future__ import absolute_import. |
Maybe need to install python3 in this file too https://github.com/nodejs/node/blob/26cfaf4c1803d3d95c875865a1c671b914a16f4b/tools/bootstrap/windows_boxstarter. |
PR-URL: nodejs#26424 Refs: nodejs#25789 (comment) Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
PR-URL: nodejs#26424 Refs: nodejs#25789 (comment) Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
PR-URL: #26424 Refs: #25789 (comment) Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
@cclauss I'm not sure how to automate a check for this. There are a huge number of machines. One approach is this: https://gist.github.com/a2a2896f10c9f3e0814af1f60fc32d38 Its pretty ugly! Is it useful? Isn't there a pip version command I should run, too? Also, its not clear what hosts we even care about. It might be easier to try this:
FTR: Generated using |
On each machine, I would just do: Do we really need to hardcode paths to the executable? My sense is that you can just $ PYTHON=python3 make lint # or other Makefile command. |
Are you wondering why I ran My goal on the machines I updated was that python2 and python3 be in the path. Its not clear to me what will happen when ci does |
I can't ssh into most of the machines, but of the ones I can, here are the python and pip versions: https://gist.github.com/sam-github/d9b8c40fc6001e3e75288da12e041737 |
@rvagg You can do
The config.mk records the python found by configure:
The Makefile does an
So I think |
Yeah, you're right @sam-github, our CI setup is artificial in the ordering it uses, but it's also intended to give us more control here over how it's run rather than embedding all of that into Jenkins. I'm working on introducing more flexibility here for this, see https://github.com/nodejs/node/pull/30057/files#diff-da22d1a6aad00d641b775f4d963249b7R79 for this particular instance where I'm forcing |
This
|
I think your container is realistic: it has Maybe the Makefile can be made to default to |
Good find on the py3 problems above, it really speaks to the usefulness of being able to have more containers with specific setups. |
@sam-github @cclauss The switch to preferring Python 3 seems to have broken our V8 CI on See https://ci.nodejs.org/job/node-test-commit-v8-linux/2590/nodes=centos7-ppcle,v8test=v8test/console
|
This one related: nodejs/node-gyp#1947 # ./configure --debug -C
Node configure: Found Python 3.7.5...
INFO: Using floating patch "tools/icu/patches/64/source/common/putil.cpp" from "tools/icu"
INFO: Using floating patch "tools/icu/patches/64/source/i18n/dtptngen.cpp" from "tools/icu"
Traceback (most recent call last):
File "./configure", line 25, in <module>
import configure
File "/root/node/configure.py", line 1755, in <module>
run_gyp(gyp_args)
File "tools/gyp_node.py", line 54, in run_gyp
rc = gyp.main(args)
File "tools/gyp/pylib/gyp/__init__.py", line 547, in main
return gyp_main(args)
File "tools/gyp/pylib/gyp/__init__.py", line 532, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File "tools/gyp/pylib/gyp/generator/compile_commands_json.py", line 95, in GenerateOutput
for qualified_target, target in target_dicts.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems' |
@cclauss I haven't heard of anyone having troubles with Python 3, have you, or anyone else? Are there next steps we can take now? |
I've been building node with Python 3 for a while however the following workaround is needed for Python >= 3.8. It's a simple "hack" but it enables node to build on Python 3.8. It seems to be limited to Python < 3.5(?). Not sure if this is true for Master or not. sed -i 's/(3, 5)/(3, 8)/' configure |
@dylanaraps with what node.js version do you do that? master: Line 24 in 20fd123
|
Apologies, I see that this is fixed in the latest version. Disregard my prior comment. That being said, Python 3 support works flawlessly here. 👍 |
Talked to @cclauss, we came up with a plan. We'll open new issues for this, but for the moment, here's the notes. Reminder:
1. Update npm to node-gyp@6.x on the next npm major, npm@7This needs coordination with the npm team, @nodejs/npm node-gyp@6 "prefers" py3 over py2 (node-gyp@5, what npm@6 uses, uses py3 only if py2 is not found). Changing the default is considered ATM, note that node 10.x and greater all have npm@6, which means that right now py3-only systems should build node.js addons with py3 on all currently supported node.js release lines. 2. node.js 12.x must support being built with py3node@12.x will outlive py2 EOL by a long time, it must get non-experimental support for building with py3 We will identify the commits/PRs that need backporting. 3. node.js 10.x should support being built with py3nodejs@10 outlives py2 EOL, so should be buildable with py3. Whether we can achieve that will take some analysis, maybe its easy, maybe its drifted too far from 12.x. If its way too hard/destabilizing, we might need to make an exception for it to our "unsupported platform" policy. Note that lack of support for py3 means that https://github.com/felixrieseberg/windows-build-tools cannot yet install py3 instead of py2 - if it did that, users wouldn't be able to build node.js 10.x on Windows with using it. I mention, because its one example of the kind of downstream pain caused by not having py3 support. It might become a problem on non-Windows platforms, too, as py2 becomes less commonly packaged, or perhaps not packaged at all. /cc @nodejs/tsc @nodejs/python @nodejs/node-gyp |
#31562 after this patch.
Traceback (most recent call last):
File "configure.py", line 1770, in <module>
run_gyp(gyp_args)
File "tools/gyp_node.py", line 54, in run_gyp
rc = gyp.main(args)
File "tools/gyp/pylib/gyp/__init__.py", line 547, in main
return gyp_main(args)
File "tools/gyp/pylib/gyp/__init__.py", line 532, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File "tools/gyp/pylib/gyp/generator/ninja.py", line 2426, in GenerateOutput
config_name)
File "tools/gyp/pylib/gyp/generator/ninja.py", line 2317, in GenerateOutputForConfig
hash_for_rules = hashlib.md5(qualified_target_for_hash).hexdigest()
TypeError: Unicode-objects must be encoded before hashing |
On Please see: https://github.com/nodejs/node/search?q=qualified_target_for_hash |
Closing — Thanks to everyone who helped to make Node.js on Python 3 happen! |
PR-URL: nodejs#36691 Fixes: nodejs#25789 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
We have several threads in issues and pull requests related to Python 3 compatibility. We need a task list to keep in sync and to show our progress
Release 6.13.0 npm/cli#276??QA:: Our CI machines are mix of machines that have Python 2, have Python 3, have both, have a
python
symlink, have it not, etc. By preferring Python 3 in configure/make/test some set of our current machines will start to test against Python 3, but many will continue to test against Python 2. The more modern machines will use 3, as will our users running more up-to-date operating systems in the next year.Upstream V8 issues:
Neither Chromium or depot_tools are Python 3 compatible yet. This doesn't effect the main Node.js builds, but does affect our V8 integration builds, where v8 is built and tested.
Miscellaneous non-blocking cleanups
Travis CI does not test ./configure --ninja test test: adding test for configure ninja #30033revertedPlease use the "python" label!
Issues with a Python label
Pull requests with a Python label
node-gyp pull requests with a Python label
The text was updated successfully, but these errors were encountered: