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

Dependency v8 is not Python 3 compatible #24512

Closed
cclauss opened this issue Nov 20, 2018 · 64 comments
Closed

Dependency v8 is not Python 3 compatible #24512

cclauss opened this issue Nov 20, 2018 · 64 comments
Labels
inspector Issues and PRs related to the V8 inspector protocol python PRs and issues that require attention from people who are familiar with Python. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency.

Comments

@cclauss
Copy link
Contributor

cclauss commented Nov 20, 2018

The open bug reports on chromium.org:

@bmsdave commit to upstream: #24512 (comment)

@Trott
Copy link
Member

Trott commented Nov 26, 2018

PR has landed so I assume this can be closed. Comment (or re-open if GitHub allows) if I'm wrong about that! Thanks!!!

@Trott Trott closed this as completed Nov 26, 2018
@refack
Copy link
Contributor

refack commented Nov 26, 2018

PR has landed so I assume this can be closed.

The files in deps/v8 and tools/inspector_protocol + jinja2 + markupsafe where excluded from #24486. So this is still an issue.

@refack refack reopened this Nov 26, 2018
@refack refack added v8 engine Issues and PRs related to the V8 dependency. inspector Issues and PRs related to the V8 inspector protocol python PRs and issues that require attention from people who are familiar with Python. tools Issues and PRs related to the tools directory. labels Nov 26, 2018
@refack
Copy link
Contributor

refack commented Nov 26, 2018

/CC @nodejs/v8 @nodejs/v8-inspector

FTR on 1.1.2020 Python 2 hits it's EOL https://pythonclock.org/

@bmsdave
Copy link
Contributor

bmsdave commented Nov 28, 2018

If you do not mind.
I would like to try to take up this task.
I'll try it this weekend. If I have any problems, I'll write.

@hashseed
Copy link
Member

I definitely don't mind any contributions here. Do you have a list of scripts required by Node.js that need to be migrated?

@cclauss
Copy link
Contributor Author

cclauss commented Nov 28, 2018

There are now less that 400 days until the end of life of Python 2 (aka legacy Python). The v8 repo is just 1.4% Python but that is all legacy Python and at least 76 files need to be modified just to fix the print statement which is merely the start of a Python 3 port. v8 is a venerable codebase and I often hear that it has been a godsend to the JavaScript community but its Python code needs to be modernized, removed, or replaced with JavaScript, Go, etc. in the days remain until Python 2 end of life.

I would recommend that someone uses http://python-future.org to do the following:

  • Run v8 tests on Python 2.7 and make sure they pass
  • Drop commitment to support for all Python versions < 2.7 (they are EOL for 5+ years anyway)
  • Run futurize -f libfuturize.fixes.fix_print_with_import -w . at the root of the v8 repo (print() function and new style imports for Python 3 v8/v8#26)
  • Run v8 tests on Python 2.7 and make sure they pass
  • Run futurize --stage1 -w . at the root of the v8 repo
  • Run v8 tests on Python 2.7 and make sure they pass
  • Run v8 tests on Python 3.7 in allow_failures mode and fix as you go...

@bmsdave
Copy link
Contributor

bmsdave commented Nov 28, 2018

Do you have a list of scripts required by Node.js that need to be migrated?

@hashseed I don't have that list. I was planning on finding it through the codebase. But if you provide it, it will be very cool.

@cclauss thank you very much for your clear recommendations. I will try to do it and provide for consideration.

@alexkozy
Copy link
Member

@bmsdave any changes to inspector_protocol should be upstreamed to inspector_protocol repo first. I can help you with it as soon as your are ready.

@cclauss
Copy link
Contributor Author

cclauss commented Dec 12, 2018

@ak239 @bmsdave @hashseed Some low hanging fruit in the upstream inspector_protocol repo.

flake8 testing of https://chromium.googlesource.com/deps/inspector_protocol on Python 3.7.1

./check_protocol_compatibility.py:478:46: E999 SyntaxError: invalid syntax
            print "  Public changes since %s:" % version
                                             ^
./code_generator.py:43:18: F821 undefined name 'xrange'
        for i in xrange(len(keys)):
                 ^
./pdl.py:162:51: E999 SyntaxError: invalid syntax
        print 'Error in %s:%s, illegal token: \t%s' % (file_name, i, line)
                                                  ^
2     E999 SyntaxError: invalid syntax
1     F821 undefined name 'xrange'
3

@cclauss
Copy link
Contributor Author

cclauss commented Dec 14, 2018

The bug reports (and proposed fixes) on chromium.org:

Please star these issues and fixes.

@cclauss
Copy link
Contributor Author

cclauss commented Jan 19, 2019

Any progress on this issues?

@bmsdave
Copy link
Contributor

bmsdave commented Jan 21, 2019

I think we are now waiting for the adoption of changes from Dmitry Gozman:
https://chromium-review.googlesource.com/c/deps/inspector_protocol/+/1358520
https://chromium-review.googlesource.com/c/deps/inspector_protocol/+/1387524

Is there anything else you need to do before Dmitry accepts the changes?

@cclauss
Copy link
Contributor Author

cclauss commented Jan 21, 2019

There is nothing that I need to do. On January 18th, Dmitry Gozman passed the ball on 1358520 to Johannes Henkel who gave a positive review.

@bmsdave
Copy link
Contributor

bmsdave commented Jan 21, 2019

I'm sorry, I misspelled it.
Is there anything else I need to do before Dmitry accepts the changes? :)

As I understand it, I can try to build the entire node.js + v8 + inspector_protocol chain locally and test the functionality of the tools in python2.7 + python3 with specified edits?

@cclauss
Copy link
Contributor Author

cclauss commented Jan 21, 2019

Let's get inspector_protocol to a good state first because v8 is a much bigger problem and given v8/v8#26, I doubt that v8 will be successfully ported to Py3 in the days remaining before Py2 end of life.

@hayd
Copy link

hayd commented Jan 21, 2019

@cclauss what do you mean "given v8/v8#26"? Did you try going through the chromium review instead of GitHub as suggested?

That said... it seems there's little/no buy-in from Google/v8 to push py3 changes through, and they would need to be pushed through...

@cclauss
Copy link
Contributor Author

cclauss commented Jan 21, 2019

I meant the latter (no buy-in), not the former (I did not re-try).

@hayd
Copy link

hayd commented Jan 21, 2019

@cclauss please consider resubmitting/retrying (not on GitHub). It seems like this discussion has the potential of being much more fruitful on the v8 mailing list https://v8.dev/docs/contribute

@cclauss
Copy link
Contributor Author

cclauss commented Jan 28, 2019

Forward progress on upstream inspector_protocol.
https://chromium-review.googlesource.com/c/deps/inspector_protocol/+/1358520 has been merged.

@cclauss
Copy link
Contributor Author

cclauss commented Oct 2, 2019

We are backsliding: v8/v8#29 (comment)

@12101111
Copy link

Will those changes be backported to v10 LTS?

@bmsdave
Copy link
Contributor

bmsdave commented Oct 17, 2019

I apologize for the long absence. I'm ready to continue.
I send PR from @AgentJ08 to https://chromium-review.googlesource.com/c/v8/v8/+/1864942

@bmsdave
Copy link
Contributor

bmsdave commented Oct 18, 2019

It looks like all the requirements are done:
https://travis-ci.com/bmsdave/v8/builds/132539826

@cclauss cclauss closed this as completed Oct 18, 2019
@hayd
Copy link

hayd commented Oct 18, 2019

Passing flake is not passing tests. Is this part of v8's CI? Premature to close IMO.

@cclauss
Copy link
Contributor Author

cclauss commented Oct 18, 2019

@hayd Do you have a set of test cases that fail?

@cclauss
Copy link
Contributor Author

cclauss commented Oct 27, 2019

Reopening. We need to vendor in a new copy of deps/v8

@cclauss cclauss reopened this Oct 27, 2019
@bmsdave
Copy link
Contributor

bmsdave commented Oct 28, 2019

How can we solve this problem?

Will updating v8 to node.js solve it?
Or can I make changes to this part https://github.com/nodejs/node/tree/master/deps/v8?

@cclauss
Copy link
Contributor Author

cclauss commented Oct 28, 2019

I think we need @targos and/or @Trott to weigh in on that.

@targos
Copy link
Member

targos commented Oct 28, 2019

I don't really consider this a problem, because we don't use the scripts that are not compatible with Python 3.
If it is fixed at the V8 level (https://github.com/v8/v8), we will inherit that when we upgrade V8.
The next update will be to version 7.9: #30020

@cclauss
Copy link
Contributor Author

cclauss commented Oct 28, 2019

https://github.com/v8/v8 passes these tests.

@targos
Copy link
Member

targos commented Oct 28, 2019

It's good that V8 itself is now compatible but other V8-related tools are not.

See https://ci.nodejs.org/job/node-test-commit-v8-linux/2590/nodes=benchmark-ubuntu1604-intel-64,v8test=v8test/console

08:09:01 Failed to fetch file gs://chromium-clang-format/942fc8b1789144b8071d3fc03ff0fcbe1cf81ac8 for v8/buildtools/linux64/clang-format. [Err: gsutil requires python 2.6 or 2.7.
08:09:01 ]
08:09:01 0> Failed to fetch file gs://chromium-clang-format/942fc8b1789144b8071d3fc03ff0fcbe1cf81ac8 for v8/buildtools/linux64/clang-format, skipping. [Err: gsutil requires python 2.6 or 2.7.

By looking at https://github.com/GoogleCloudPlatform/gsutil, gsutil seems to support Python 3 so maybe the version used by depot_tools is too old?

@aduh95
Copy link
Contributor

aduh95 commented Apr 28, 2020

Should this issue stay open? I believe this issue is outdated as Node.js build chain is compatible with Python 3.

@jasnell
Copy link
Member

jasnell commented Apr 28, 2020

@nodejs/v8 @nodejs/build ... what do you think? There doesn't seem to be reason to keep this open?

@cclauss
Copy link
Contributor Author

cclauss commented Apr 28, 2020

This test would crash on Python 3 but that seem like a simple fix that is not on the critical path.

./test/debugging/wasm/gdb-server/gdb_rsp.py:35:14: F821 undefined name 'xrange'
    for i in xrange(int(timeout_in_seconds / poll_time_in_seconds)):
             ^
./test/debugging/wasm/gdb-server/gdb_rsp.py:67:8: F821 undefined name 'sys'
    if sys.platform == 'win32':
       ^

@targos
Copy link
Member

targos commented Apr 28, 2020

The issue is still valid. V8 build tools are not yet all compatible with Python 3:

$ gclient sync
Warning: Running gclient on Python 3. 
If you encounter any issues, please file a bug on crbug.com under the Infra>SDK component.
Syncing projects: 100% (28/28), done.                                                

________ running 'vpython v8/third_party/depot_tools/update_depot_tools_toggle.py --disable' in '/home/mzasso/git/chromium/v8'
[E2020-04-28T19:19:27.955163+02:00 229437 0 annotate.go:241] goroutine 1:
[E2020-04-28T19:19:27.955189+02:00 229437 0 annotate.go:241] #0 go.chromium.org/luci/vpython/python/find.go:93 - python.Find()
[E2020-04-28T19:19:27.955199+02:00 229437 0 annotate.go:241]   annotation #0:
[E2020-04-28T19:19:27.955205+02:00 229437 0 annotate.go:241]     reason: no Python found
[E2020-04-28T19:19:27.955210+02:00 229437 0 annotate.go:241]   annotation #1:
[E2020-04-28T19:19:27.955215+02:00 229437 0 annotate.go:241]     reason: could not find appropriate executable for: "python2.7"

I don't know if we should keep this open though, there's nothing we can do about it in Node.js.

@mmarchini
Copy link
Contributor

IMO that should be tracked upstream, unless Node.js folks are actively working with V8 and Chromium to make the tools Python 3-compatible. Otherwise, as @targos mentioned, there's nothing we can do on our side.

It's also not a huge deal since it only affects folks building V8 through make-v8, which is limited to a subset of collaborators working on V8 upgrades on Node.js.

@cclauss
Copy link
Contributor Author

cclauss commented Apr 28, 2020

@targos, What happens when you add the 3??

vpython3 v8/third_party/depot_tools/update_depot_tools_toggle.py --disable' in '/home/mzasso/git/chromium/v8'
       ^

@targos
Copy link
Member

targos commented Apr 28, 2020

@cclauss nothing is printed, exits with code 0

@ryzokuken
Copy link
Contributor

Agreed with @targos and @mmarchini that this issue should be tracked upstream.

@cclauss cclauss closed this as completed Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inspector Issues and PRs related to the V8 inspector protocol python PRs and issues that require attention from people who are familiar with Python. tools Issues and PRs related to the tools directory. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

No branches or pull requests