-
Notifications
You must be signed in to change notification settings - Fork 166
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
Can 'make lint-py PYTHON=python3' be a manditory Jenkins test? #1631
Comments
/cc @nodejs/build |
I guess the big change this would require would be Python 3 to be installed on all our CI hosts? Or is it possible to lint for Python 3 issues using Python 2? We do already run |
I think it would be enough to test only on one host, with a custom job. And when the build supports Python 3, switch the job to use Python 3 fully. |
I believe it would be best to move this issue to the build repo. Could someone do that (I do not have the necessary rights)? :) |
Issue moved to |
This has to be run on Python 3 because flake8 uses CPython to build an Abstract Syntax Tree and it then lints the AST. This is described in the Very Important Note on the top of http://flake8.pycqa.org That being said, Python 3 was introduced 8+ years ago so today it is quite easy on all OSes to install both legacy Python and Python side-by-side on the same box and then do python2 -m flake8 [...] and python3 -m flake8 [...]. |
Oh, yeah, maybe we can just install Python 3 on the linter host(s) only and have it run there via a Jenkins config. |
This effort can proceed when consensus is reached because nodejs/node#24954 has landed and make lint-py PYTHON=python2 and make lint-py PYTHON=python3 both pass. |
Adding to the Build WG meeting agenda. |
If it's just for linting then it should be straight forward I think since it's limited to a few hosts. But ...
Yikes .. I didn't know this but it has huge ramifications across the board for us. Some things off the top of my head:
Python 2 is still everywhere. If 2 is EOL so soon, why do we still have this kind of thing:
Have distros thrown up their hands too? I believe it's possible to install Python 3 on older hosts we maintain, like CentOS 6. Some of them are a bit awkward because a lot of internal tooling on Linux distros use Python so conflicts are really easy. This feels to me like a big enough problem that it needs needs something at a higher level, a strategic initiative or short-lived working group to sort out all of the issues. Not that I really want to be thinking more than I have to about this mess but the pain is only going to increase. No, I'm not volunteering to lead such an initiative, our strategy of 🙈 🙉 🙊 isn't sustainable though. |
https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
Being syntax compatible != fully supporting. |
Note that this is only as of ~1 week ago and it is still largely untested. |
Installing Python 3 on FreeBSD: pkg install python3 |
https://ci.nodejs.org/job/node-test-linter/24474/console failing with python3
...
on master, but even if we fix on master we need a strategy for older branches - do we backport? or do we hack CI to switch python version for older branches? |
added py36-pip to the install list which cleaned up the first one, second one remains:
|
Running an outa date version of cpplint.py |
so we need to fix that on master then? |
Why are we bothering with C++? We merely want the flake8 jobs to run on Py2 and Py3. This issue is about lint-py, not about all lint jobs in Makefile. |
because they're all tangled together: which gmake &>/dev/null && MAKE=gmake || MAKE=make
PYTHON=python2
$MAKE lint-md-build PYTHON=$PYTHON || true
$MAKE lint-py-build PYTHON=$PYTHON || true
# If lint-ci fails, print all the interesting lines to the console.
# FreeBSD sed can't handle \s, so use gsed if it exists.
which gsed &>/dev/null && SED=gsed || SED=sed
$MAKE lint-ci PYTHON=$PYTHON || {
cat test-eslint.tap | grep -v '^ok\|^TAP version 13\|^1\.\.' | $SED '/^\s*$/d' &&
exit 1; } We run
So this doesn't sound like it's a nodejs/build problem until nodejs/node has Makefile, or cpplint.py, or whatever else sorted out. Then that's going to need to be backported to the supported release lines or we're going to need to add complex version switching logic in our linting job in CI. |
|
cpplint @ https://github.com/google/styleguide and https://github.com/cpplint/cpplint are both compatible with Py2 and Py3 |
For now, can we merely add the command make lint-py PYTHON=python3 ? |
I'm removing from agenda since the specific issue has a clear path to resolution. |
@refack Now that we do not lint python scripts in test/fixtures (ref: nodejs/node#25639), can we push the job to live? |
@refack do you already have the job ready to go and we just need to add it to the regressions runs or is there more to do beyond that assuming that we are ready to go given nodejs/node#25639 |
Ready to go. I just wanted the patched code in |
Ok so you are planning to turn it on in a few days or a week at most? |
At most. I'll send a PSA now. |
Activated for Testing job for |
Thanks massively... This will help us avoid any backsliding. |
Closable now? Or is there still more to be done? |
The pipeline variant hasn't gone live yet... |
Can we please get this resolves and closed? 303 daze left... |
(Adding |
IMO fixing the pipeline job has low ROI. It's mostly a convenience. The main job (https://ci.nodejs.org/job/node-test-linter/) runs python linting with Python3, so we have regression testing. If someone wants to follow up with porting https://github.com/nodejs/build/blob/master/jenkins/pipelines/node-linter.jenkinsfile, that will be very helpful. |
@rvagg @thefourtheye How do we progress this? |
Is your feature request related to a problem? Please describe.
Python 2 end-of-life is one year from now. We have been working for a while and this repo's code now contains no Python 3 syntax errors or undefined names. make lint-py shows that we no longer have any syntax errors on either Python 2 or Python 3. It also shows that we have fixed all undefined names like basestring, cmp(), file, reduce(), raw_input(), unicode, xrange() that were removed in Python 3.
The port to Python 3 is not yet complete but the codebase is "syntax compatible" which is a state that we should now preserve and guard against any backsliding.
Describe the solution you'd like
After #24954 lands,it would be helpful if every Jenkins run required that make lint-py PYTHON=python2 and make lint-py PYTHON=python3 both pass. This will ensure that pull requests do not introduce syntax errors (like print without the parens) or undefined names (like raw_input()). This will help as we complete the port.Describe alternatives you've considered
Please describe alternative solutions or features you have considered.
Going snowboarding.
/cc @nodejs/python
The text was updated successfully, but these errors were encountered: