You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Semet (JIRA)" <ji...@apache.org> on 2016/08/10 11:16:20 UTC

[jira] [Comment Edited] (SPARK-16992) Pep8 code style

    [ https://issues.apache.org/jira/browse/SPARK-16992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15415127#comment-15415127 ] 

Semet edited comment on SPARK-16992 at 8/10/16 11:15 AM:
---------------------------------------------------------

For the import statement ordering, this helped us a lot to set up a automatic merge tool between the prod and main branches (so patch done in prod get integrated into main automatically). At least enforcing the sort of the import.

I am pretty much integrist with code style, and Python provides so much tools to check and automate the formatting of the code style. autopep8 does a pretty good job.

If you agree, I can also put it in post commit hook that automatically fixes the code.


was (Author: gaetan@xeberon.net):
For the import statement ordering, this helped us a lot to set up a automatic merge tool between the prod and main branches (so patch done in prod get integrated into main automatically). At least enforcing the sort of the import.

I am pretty much integrist with code style, and Python provides so much tools to check and automate the formatting of the code style. autopep8 does a pretty good job.

> Pep8 code style
> ---------------
>
>                 Key: SPARK-16992
>                 URL: https://issues.apache.org/jira/browse/SPARK-16992
>             Project: Spark
>          Issue Type: Improvement
>            Reporter: Semet
>
> Add code style checks and auto formating into the Python code.
> Features:
> - add a {{.editconfig}} file (Spark's Scala files use 2-spaces indentation, while Python files uses 4) for compatible editors (almost every editors has a plugin to support {{.editconfig}} file)
> - use autopep8 to fix basic pep8 mistakes
> - use isort to automatically sort and organise {{import}} statements and organise them into logically linked order (see doc here. The most important thing is that it splits import statements that loads more than one object into several lines. It send keep the imports sorted. Said otherwise, for a given module import, the line where it should be added will be fixed. This will increase the number of line of the file, but this facilitates a lot file maintainance and file merges if needed.
> add a 'validate.sh' script in order to automatise the correction (need isort and autopep8 installed)
> You can see similar script in prod in the [Buildbot|https://github.com/buildbot/buildbot/blob/master/common/validate.sh] project.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org