Skip to content

Conversation

@rekhajoshm
Copy link
Contributor

@rekhajoshm rekhajoshm commented Jan 21, 2018

What changes were proposed in this pull request?

Referencing latest python code style checking from PyPi/pycodestyle
Removed pending TODO
For now, in tox.ini excluded the additional style error discovered on existing python due to latest style checker (will fallback on review comment to finalize exclusion or fix py)
Any further code styling requirement needs to be part of pycodestyle, not in SPARK.

How was this patch tested?

./dev/run-tests

rekhajoshm added 11 commits May 5, 2015 16:10
Pulling functionality from apache spark
pull latest from apache spark
Pulling functionality from apache spark
Pulling functionality from apache spark
pull request from apache/master
pull latest from apache spark
pull latest from apache spark
pull latest apache spark
Apache spark pull latest
@SparkQA
Copy link

SparkQA commented Jan 21, 2018

Test build #86423 has finished for PR 20338 at commit 8873441.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

This doesn't actually run the Python lint in Jenkins build though because there's no change on the files with .py. Mind double checking and fixing:

diff --git a/dev/run-tests.py b/dev/run-tests.py
index 7e6f7ff0603..6fac324972e 100755
--- a/dev/run-tests.py
+++ b/dev/run-tests.py
@@ -576,7 +576,10 @@ def main():
                                 for f in changed_files):
         # run_java_style_checks()
         pass
-    if not changed_files or any(f.endswith(".py") for f in changed_files):
+    if not changed_files or any(f.endswith("lint-python")
+                                or f.endswith("tox.ini")
+                                or f.endswith(".py")
+                                for f in changed_files):
         run_python_style_checks()
     if not changed_files or any(f.endswith(".R") for f in changed_files):
         run_sparkr_style_checks()

too?

[pep8]
ignore=E402,E731,E241,W503,E226
[pycodestyle]
ignore=E402,E731,E241,W503,E226,E722,E741,E305
Copy link
Member

Choose a reason for hiding this comment

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

So, do those E722,E741,E305 include rules to validate the blank line before starting doctests, which is described in the JIRA?

Seems:
E722: "do not use bare except'"
E741: "ambiguous variable name 'l'",
E305: "expected 2 blank lines after class or function definition"

Copy link
Contributor Author

@rekhajoshm rekhajoshm Jan 22, 2018

Choose a reason for hiding this comment

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

These(E722, E741, E305) are new code style standards added that Spark seems to be violating.For now, added them in ignored.I have raised the doctest blank line as an issue under pep8, as it does not belong within Spark.

Copy link
Member

@HyukjinKwon HyukjinKwon Jan 22, 2018

Choose a reason for hiding this comment

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

Ah, I asked this to double check if this PR fixes the issue linked JIRA. I think we could make another JIRA if this PR doesn't target to fix the linked JIRA.

For the best, it'd be nicer if you'd leave a issue link you raised under pep8 in SPARK-11222, and open another JIRA about what this PR changes and then link it by fixing the PR title, if I understood you correctly.

Copy link
Contributor Author

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.

should we fix the code that violates

E722: "do not use bare except'"
E741: "ambiguous variable name 'l'",
E305: "expected 2 blank lines after class or function definition"
?

Or that's another PR/JIRA?

Copy link
Member

Choose a reason for hiding this comment

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

Yea .. there look actually many instances about it. I manually ran it against this PR. Will maybe take this one and open a PR separately after double checking each rule. Didn't take a look carefully yet.

dev/lint-python Outdated
PEP8_VERSION="2.3.1"
PEP8_SCRIPT_PATH="$SPARK_ROOT_DIR/dev/pep8-$PEP8_VERSION.py"
PEP8_SCRIPT_REMOTE_PATH="https://raw.githubusercontent.com/jcrocholl/pep8/$PEP8_VERSION/pep8.py"
PEP8_SCRIPT_REMOTE_PATH="https://raw.githubusercontent.com/PyCQA/pycodestyle/$PEP8_VERSION/pycodestyle.py"
Copy link
Member

Choose a reason for hiding this comment

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

Shall we leave a note that pep8 is formally renamed to pycodestyle to reduce confusion, and in the PR description too?

@rekhajoshm
Copy link
Contributor Author

Thanks @HyukjinKwon for your review.updated, please verify.

Copy link
Member

@HyukjinKwon HyukjinKwon left a comment

Choose a reason for hiding this comment

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

LGTM otherwise.

sys.exit(int(os.environ.get("CURRENT_BLOCK", 255)))
else:
run_cmd([jekyll_bin, "build"])

Copy link
Member

Choose a reason for hiding this comment

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

I know I am insane but let's revert back unrelated changes.

@rekhajoshm rekhajoshm changed the title [SPARK-11222][BUILD][PYTHON] python code style checker update [SPARK-23174][BUILD][PYTHON] python code style checker update Jan 22, 2018
@SparkQA
Copy link

SparkQA commented Jan 22, 2018

Test build #86451 has finished for PR 20338 at commit 8718891.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@ueshin ueshin left a comment

Choose a reason for hiding this comment

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

LGTM except one question.

dev/lint-python Outdated
#+ - Download pep8 from PyPI. It's more "official".
PEP8_VERSION="1.7.0"
# Updated to latest official version for pep8.pep8 is formally renamed to pycodestyle.
PEP8_VERSION="2.3.1"
Copy link
Member

Choose a reason for hiding this comment

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

Should we also use pycodestyle instead of pep8 for variable names or script names?

@SparkQA
Copy link

SparkQA commented Jan 22, 2018

Test build #86454 has finished for PR 20338 at commit c386a9a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

dev/lint-python Outdated
#+ TODOs:
#+ - Download pep8 from PyPI. It's more "official".
PEP8_VERSION="1.7.0"
# Updated to latest official version for pep8.pep8 is formally renamed to pycodestyle.
Copy link
Member

Choose a reason for hiding this comment

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

nit .. : pep8.pep8 -> pep8. pep8

@srowen
Copy link
Member

srowen commented Jan 23, 2018

(If this also resolves SPARK-11222 you can also include that in the title.)

@HyukjinKwon
Copy link
Member

Ah, seems this one doesn't resolve SPARK-11222 too. I think that JIRA describes to add pydocstyle check in our project too given my reading of @rekhajoshm's issue link. Will double check and take an action for SPARK-11222 soon.

This JIRA, SPARK-23174, seems describing simply upgrading the pep8 (formally renamed to pycodestyle).

@HyukjinKwon
Copy link
Member

@rekhajoshm, mind updating variable names and one nit above? Will merge this one as soon as they are fixed.

@rekhajoshm
Copy link
Contributor Author

rekhajoshm commented Jan 24, 2018

@HyukjinKwon @ueshin was bit hesitant to change variable/references as pep8 is very clear within python circles as python style checker.however after pondering, have done the needful. please check.thanks

@srowen for SPARK-11222, I had raised a issue under pycodestyle. Created PR #20378

@SparkQA
Copy link

SparkQA commented Jan 24, 2018

Test build #86559 has finished for PR 20338 at commit d10fbb4.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 24, 2018

Test build #86560 has finished for PR 20338 at commit 34a8590.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Jan 24, 2018

Test build #86569 has finished for PR 20338 at commit 34a8590.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

retest this please

@SparkQA
Copy link

SparkQA commented Jan 24, 2018

Test build #86578 has finished for PR 20338 at commit 34a8590.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member

Merged to master.

@asfgit asfgit closed this in 7af1a32 Jan 24, 2018
HyukjinKwon pushed a commit to HyukjinKwon/spark that referenced this pull request Jan 30, 2018
…ore file.

## What changes were proposed in this pull request?

This is a follow-up pr of apache#20338 which changed the downloaded file name of the python code style checker but it's not contained in .gitignore file so the file remains as an untracked file for git after running the checker.
This pr adds the file name to .gitignore file.

## How was this patch tested?

Tested manually.

Author: Takuya UESHIN <[email protected]>

Closes apache#20432 from ueshin/issues/SPARK-23174/fup1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants