diff --git a/README.md b/README.md index 5961030cc5a..43a86d924a5 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ a Python version greater than 2.7 (Python 3.2 is not supported anymore). * **Sphinx**: Rich text mode for the Help pane. * **Pygments** 2.0+: Syntax highlighting for all file types it supports. * **Pylint**: Static code analysis. -* **Pep8**: Style analysis. +* **Pycodestyle**: Style analysis. * **Psutil**: CPU and memory usage on the status bar. * **Nbconvert**: Manipulation of notebooks in the Editor. * **Qtawesome** 0.4.1+: To have an icon theme based on FontAwesome. diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 40e30ce2b5f..1d019baf85c 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -26,7 +26,7 @@ requirements: - nbconvert - pygments >=2.0 - sphinx - - pep8 + - pycodestyle - psutil - pylint - qtawesome >=0.4.1 diff --git a/continuous_integration/circle/install.sh b/continuous_integration/circle/install.sh index 7c6882332d1..ec442c6a97a 100755 --- a/continuous_integration/circle/install.sh +++ b/continuous_integration/circle/install.sh @@ -7,7 +7,7 @@ if [ "$CIRCLE_NODE_INDEX" = "3" ]; then export CONDA_DEPENDENCIES="" else export CONDA_DEPENDENCIES_FLAGS="--quiet" - export CONDA_DEPENDENCIES="rope pyflakes sphinx pygments pylint pep8 psutil nbconvert \ + export CONDA_DEPENDENCIES="rope pyflakes sphinx pygments pylint pycodestyle psutil nbconvert \ qtawesome pickleshare qtpy pyzmq chardet mock nomkl pandas \ pytest pytest-cov numpydoc scipy cython" export PIP_DEPENDENCIES="coveralls pytest-qt pytest-xvfb flaky jedi" diff --git a/continuous_integration/conda-recipes/spyder/meta.yaml b/continuous_integration/conda-recipes/spyder/meta.yaml index e0e971dbab8..660e8c89da2 100644 --- a/continuous_integration/conda-recipes/spyder/meta.yaml +++ b/continuous_integration/conda-recipes/spyder/meta.yaml @@ -28,7 +28,7 @@ requirements: - nbconvert - pygments - sphinx - - pep8 + - pycodestyle - psutil - pylint - qtawesome >=0.4.1 diff --git a/create_app.py b/create_app.py index b718ee4a92c..09c98d4ecbb 100644 --- a/create_app.py +++ b/create_app.py @@ -91,7 +91,7 @@ def get_stdlib_modules(): shutil.copyfile('scripts/spyder', APP_MAIN_SCRIPT) APP = [APP_MAIN_SCRIPT] -DEPS = ['pylint', 'logilab', 'astroid', 'pep8', 'setuptools'] +DEPS = ['pylint', 'logilab', 'astroid', 'pycodestyle', 'setuptools'] EXCLUDES = DEPS + ['mercurial'] PACKAGES = ['spyder', 'spyder_breakpoints', 'spyder_io_dcm', 'spyder_io_hdf5', 'spyder_profiler', 'spyder_pylint', 'sphinx', 'jinja2', 'docutils', @@ -157,7 +157,7 @@ def get_stdlib_modules(): shutil.copytree(osp.join(app_python_lib, p), osp.join(minimal_lib, p)) # Add necessary Python programs to the app -PROGRAMS = ['pylint', 'pep8'] +PROGRAMS = ['pylint', 'pycodestyle'] system_progs = [find_program(p) for p in PROGRAMS] progs_dest = [resources + osp.sep + p for p in PROGRAMS] for i in range(len(PROGRAMS)): diff --git a/doc/installation.rst b/doc/installation.rst index 76c148e4770..1b255ddae28 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -175,7 +175,7 @@ The requirements to run Spyder are: * `Pylint `_ -- for static code analysis. -* `Pep8 `_ -- for style analysis. +* `Pycodestyle `_ -- for style analysis. * `Psutil `_ -- for memory/CPU usage in the status bar. diff --git a/setup.py b/setup.py index e13a103ce53..5c9840d4dc3 100644 --- a/setup.py +++ b/setup.py @@ -278,7 +278,7 @@ def run(self): 'qtconsole>=4.2.0', 'nbconvert', 'sphinx', - 'pep8', + 'pycodestyle', 'pylint', 'psutil', 'qtawesome>=0.4.1', diff --git a/spyder/plugins/editor.py b/spyder/plugins/editor.py index 2837be404d5..c95862b023a 100644 --- a/spyder/plugins/editor.py +++ b/spyder/plugins/editor.py @@ -237,8 +237,8 @@ def setup_page(self): codeanalysis.PYFLAKES_REQVER) pep8_box = newcb(_("Real-time code style analysis"), 'code_analysis/pep8', default=False, - tip=_("

If enabled, Python source code will be analyzed" - "using pep8, lines that are not following PEP8 " + tip=_("

If enabled, Python source code will be analyzed " + "using pycodestyle, lines that are not following PEP8 " "style guide will be highlighted.

" "

Note: add analysis:ignore in " "a comment to ignore style analysis " diff --git a/spyder/utils/codeanalysis.py b/spyder/utils/codeanalysis.py index 894fd0fbdde..534cfa3630c 100644 --- a/spyder/utils/codeanalysis.py +++ b/spyder/utils/codeanalysis.py @@ -91,9 +91,9 @@ def check_with_pyflakes(source_code, filename=None): dependencies.add("pyflakes", _("Real-time code analysis on the Editor"), required_version=PYFLAKES_REQVER) -PEP8_REQVER = '>=0.6' -dependencies.add("pep8", _("Real-time code style analysis on the Editor"), - required_version=PEP8_REQVER) +PYCODESTYLE_REQVER = '>=2.3' +dependencies.add("pycodestyle", _("Real-time code style analysis on the Editor"), + required_version=PYCODESTYLE_REQVER) def is_pyflakes_installed(): @@ -117,7 +117,7 @@ def get_checker_executable(name): return [sys.executable, path1] elif path2 is not None: # checker.py is available # Checker package is available but its script has not been - # installed (this works with pep8 but not with pyflakes) + # installed (this works with pycodestyle but not with pyflakes) return [sys.executable, path2] @@ -129,7 +129,7 @@ def check(args, source_code, filename=None, options=None): if options is not None: args += options if any(['pyflakes' in arg for arg in args]): - # Pyflakes requires an ending new line (pep8 don't! -- see Issue 1123) + # Pyflakes requires an ending new line (pycodestyle don't! -- see Issue 1123) # Note: this code is not used right now as it is faster to invoke # pyflakes in current Python interpreter (see `check_with_pyflakes` # function above) than calling it through a subprocess @@ -165,9 +165,9 @@ def check(args, source_code, filename=None, options=None): def check_with_pep8(source_code, filename=None): - """Check source code with pep8""" + """Check source code with pycodestyle""" try: - args = get_checker_executable('pep8') + args = get_checker_executable('pycodestyle') results = check(args, source_code, filename=filename, options=['-r']) except Exception: # Never return None to avoid lock in spyder/widgets/editor.py diff --git a/spyder/utils/tests/test_codeanalysis.py b/spyder/utils/tests/test_codeanalysis.py index 57bbbda7ce2..813e08464cd 100644 --- a/spyder/utils/tests/test_codeanalysis.py +++ b/spyder/utils/tests/test_codeanalysis.py @@ -27,9 +27,9 @@ def test_codeanalysis(): check_results = check_with_pyflakes(code, TEST_FILE) + \ check_with_pep8(code, TEST_FILE) + find_tasks(code) if PY2: - num_results = 86 - else: num_results = 87 + else: + num_results = 88 assert len(check_results) == num_results diff --git a/spyder/widgets/editor.py b/spyder/widgets/editor.py index 4c7832a3ee6..f62835b4c39 100644 --- a/spyder/widgets/editor.py +++ b/spyder/widgets/editor.py @@ -199,7 +199,7 @@ def run_code_analysis(self, run_pyflakes, run_pep8): """Run code analysis""" run_pyflakes = run_pyflakes and codeanalysis.is_pyflakes_installed() run_pep8 = run_pep8 and\ - codeanalysis.get_checker_executable('pep8') is not None + codeanalysis.get_checker_executable('pycodestyle') is not None self.pyflakes_results = [] self.pep8_results = [] if self.editor.is_python():