databricks / spark-deep-learning

Deep Learning Pipelines for Apache Spark
https://databricks.github.io/spark-deep-learning
Apache License 2.0
1.99k stars 494 forks source link

add style checks to travis ci #124

Closed yogeshg closed 6 years ago

yogeshg commented 6 years ago

In this PR, we

Motivation

Developers need to run several tasks and setting these up could be a hassle. These tasks include but are not limited to setting up the environment, running style checks, refactoring code based on best practices and running tests.

Tools like pylint, prospector etc. do a great job of giving users flexibility, but they are mostly run with a certain set of default values. They also do not give options like allowing to run on only currently touched files and similar heursitics. Documentation is needed for default values, environment required and so on for every tool per project. But we rarely read documentations, so an interactive script with default values and options to run these tools in a limited scope might be useful.

python/run.py allows us to do most of the things we need for development cycle and also guide us through the process using "--help" and autocomplete options. It should also be easy for us to maintain such a script and to read it to see what goes on under the hood. Luckily for us python argh package uses parseargs and argscomplete to expose python functions to shell with great help and autocompletion.

Current Tools

Future scope

Notes

positional arguments: {pylint,prospector,yapf,envsetup} pylint ...(truncated for brevity)... prospector Wraps prospector and provides defaults. Run prospector --help for more details. Trailing arguments are a list of files, packages or modules. if nothing is specified, default value is ./python/sparkdl yapf Wraps yapf and provides some defaults. Run yapf --help for more details. envsetup ...(truncated for brevity)...

optional arguments: -h, --help show this help message and exit

$ python/run.py envsetup -h usage: run.py envsetup [-h] [-d] [-i] [-m] [-c] [-v]

Prints out shell commands that can be used in terminal to setup the environment.

This tool inspects the current environment, and/or adds default values, and/or interactively
asks user for values and prints all or the missing variables that need to be set. It can also
provide completion for this script. You can source the setup as follows:

```
python/run.py envsetup -d -c > ./python/.setup.sh && source ./python/.setup.sh
```

:param default: if default values should be set in this script or not
:param interactive: if user should be prompted for values or not
:param missing_only: if only missing variable should be printed
:param completion: if auto complete code should be printed
:param verbose: if user should be guided or not

optional arguments: -h, --help show this help message and exit -d, --default False -i, --interactive False -m, --missing-only False -c, --completion False -v, --verbose False

$ python/run.py pylint -h usage: run.py pylint [-h] [--rcfile RCFILE] [--reports REPORTS] [args [args ...]]

Wraps `pylint` and provides defaults. Run `prospector --help` for more details. Trailing
arguments are a list of files, packages or modules. if nothing is specified, default value is
./python/sparkdl

positional arguments: args list of files,packages or modules. if nothing is specified, default value is sparkdl (default: -)

optional arguments: -h, --help show this help message and exit --rcfile RCFILE './python/.pylint/accepted.rc' --reports REPORTS 'y'

codecov-io commented 6 years ago

Codecov Report

Merging #124 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #124   +/-   ##
=======================================
  Coverage   85.37%   85.37%           
=======================================
  Files          33       33           
  Lines        1921     1921           
  Branches       44       44           
=======================================
  Hits         1640     1640           
  Misses        281      281

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b09974b...8cc1679. Read the comment docs.

mengxr commented 6 years ago

@MrBago Could you take another pass?

mengxr commented 6 years ago

LGTM and merged it into master. Thanks!