Skip to content

Commit

Permalink
Merge pull request #1989 from martinholmer/pep8-renamed
Browse files Browse the repository at this point in the history
Switch from using pep8 to pycodestyle
  • Loading branch information
martinholmer authored May 1, 2018
2 parents e3bdff2 + d26f1d3 commit 9a0232a
Show file tree
Hide file tree
Showing 53 changed files with 80 additions and 81 deletions.
42 changes: 21 additions & 21 deletions CODING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,44 @@ guidelines.
There are two recommended tools that can help you develop seamless and
correct code enhancements.

pep8
----
pycodestype (the program formerly known as pep8)
------------------------------------------------

One of these tools, `pep8`, enforces coding styles that are required
One of these tools, `pycodestyle`, enforces coding styles that are required
of all Python code in the repository, and therefore, all pull requests
are tested using the `pep8` tool. Pull requests that fail these
`pep8` tests need to be revised before they can be merged into the
are tested using the `pycodestyle` tool. Pull requests that fail these
tests need to be revised before they can be merged into the
repository. The most efficient way to comply with this coding style
requirement is to process each file containing revisions through
`pep8` on your local computer before submitting your pull request.
`pycodestyle` on your local computer before submitting your pull request.

Make sure you have an up-to-date version of `pep8` installed on your
Make sure you have an up-to-date version of `pycodestyle` installed on your
computer by entering at the operating system command line:
```
pep8 --version
pycodestyle --version
```
If you get a no-such-command error, install `pep8` as follows:
If you get a no-such-command error, install `pycodestyle` as follows:
```
conda install pep8
conda install pycodestyle
```
If you do have `pep8` installed, but the version is before 1.7.0,
If you do have `pycodestyle` installed, but the version is before 2.4.0,
then get a more recent version as follows:
```
conda update pep8
conda update pycodestyle
```
Once you have a current version of `pep8` installed on your computer,
use the `pep8` tool as follows:
Once you have a current version of `pycodestyle` installed on your computer,
use the `pycodestyle` tool as follows:
```
pep8 --ignore=E402 records.py
pycodestyle records.py
```
where in the above example you want to check the coding style of your
proposed revisions to the `records.py` file.

In addition, if you are proposing revisions to one of the files in the
taxcalc directory that has a `.json` extension, you should use the
`pep8` tool as follows:
`pycodestyle` tool as follows:
```
pep8 --ignore=E501,E121 current_law_policy.json
pycodestyle --ignore=E501,E121 current_law_policy.json
```
where in the above example you want to check the coding style of your
proposed revisions to the `current_law_policy.json` file.
Expand All @@ -75,18 +75,18 @@ Note that you can easily check **all** the Python files in the
directory tree beginning with the `taxcalc` directory as follows:
```
cd taxcalc
pep8 .
pycodestyle .
```
or
```
pep8 taxcalc
pycodestyle taxcalc
```

pylint
------

The other of these tools, `pylint`, warns about deviations from a
broader set coding styles than does `pep8`. The use of `pylint`,
broader set coding styles than does `pycodestyle`. The use of `pylint`,
while being the number one recommendation in the [Google Python Style
Guide](https://google.github.io/styleguide/pyguide.html), is
strictly-speaking optional for Tax-Calculator work. But several
Expand All @@ -107,7 +107,7 @@ If you get a no-such-command error, install `pylint` as follows:
```
conda install pylint
```
If you do have `pylint` installed, but the version is before 1.5.4,
If you do have `pylint` installed, but the version is before 1.8.4,
then get a more recent version as follows:
```
conda update pylint
Expand Down
16 changes: 8 additions & 8 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ GitHub.

Currently there are three phases of testing.

Testing with pep8
-----------------
Testing with pycodetest (the program formerly known as pep8)
------------------------------------------------------------

The first phase of testing checks the formatting of the Python code
against the PEP8 standard. Assuming you are in the top-level directory
of the repository, do the PEP8 tests either of these two ways:
against PEP8-like standard. Assuming you are in the top-level directory
of the repository, do these tests either of these two ways:

```
cd taxcalc
pep8 .
pycodestyle .
```
or
```
pep8 taxcalc
pycodestyle taxcalc
```

No messages indicate the PEP8 tests pass. Fix any errors. When you
pass all the PEP8 tests, proceed to the second phase of testing.
No messages indicate the tests pass. Fix any errors. When you
pass all these PEP8-like tests, proceed to the second phase of testing.

Testing with py.test
--------------------
Expand Down
4 changes: 1 addition & 3 deletions continuous_integration/run_tests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ call activate %CONDA_ENV%

set PYTHONFAULTHANDLER=1

@rem `--capture=sys` avoids clobbering faulthandler tracebacks on crash
set PYTEST=py.test --capture=sys

@rem %PYTEST% -v --runslow dask\dataframe\tests\test_groupby.py
%PYTEST% -v -m "not requires_pufcsv and not pre_release and not local" --pep8
%PYTEST% -v -m "not requires_pufcsv and not pre_release and not local"
2 changes: 1 addition & 1 deletion docs/cookbook/make_cookbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
python make_cookbook.py
"""
# CODING-STYLE CHECKS:
# pep8 --ignore=E402 make_cookbook.py
# pycodestyle --ignore=E402 make_cookbook.py
# pylint --disable=locally-disabled make_cookbook.py

from __future__ import print_function
Expand Down
2 changes: 1 addition & 1 deletion docs/cookbook/test_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
the script output with the expected output in the recipeNN.res file.
"""
# CODING-STYLE CHECKS:
# pep8 --ignore=E402 test_recipes.py
# pycodestyle --ignore=E402 test_recipes.py
# pylint --disable=locally-disabled test_recipes.py

from __future__ import print_function
Expand Down
2 changes: 1 addition & 1 deletion docs/make_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
containing information from several JSON files.
"""
# CODING-STYLE CHECKS:
# pep8 --ignore=E402 make_index.py
# pycodestyle --ignore=E402 make_index.py
# pylint --disable=locally-disabled make_index.py

import os
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies:
- bokeh >=0.12.3
- mock
- pep8
- pycodestyle
- pylint
- coverage
- pytest-pep8
Expand Down
2 changes: 1 addition & 1 deletion puf_fuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
generated by the standard puf.csv input file.
"""
# CODING-STYLE CHECKS:
# pep8 --ignore=E402 puf_fuzz.py
# pycodestyle --ignore=E402 puf_fuzz.py
# pylint --disable=locally-disabled puf_fuzz.py

import argparse
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[tool:pytest]
pep8ignore = E402
testpaths = taxcalc
2 changes: 1 addition & 1 deletion simtax.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SIMple input-output capabilities for TAX-calculator used in validation work
"""
# CODING-STYLE CHECKS:
# pep8 --ignore=E402 simtax.py
# pycodestyle --ignore=E402 simtax.py
# pylint --disable=locally-disabled simtax.py

import argparse
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tax-Calculator elasticity-based behavioral-response Behavior class.
"""
# CODING-STYLE CHECKS:
# pep8 behavior.py
# pycodestyle behavior.py
# pylint --disable=locally-disabled behavior.py

from __future__ import print_function
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tax-Calculator federal tax Calculator class.
"""
# CODING-STYLE CHECKS:
# pep8 calculate.py
# pycodestyle calculate.py
# pylint --disable=locally-disabled calculate.py
#
# pylint: disable=invalid-name,no-value-for-parameter,too-many-lines
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/cli/tc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
which can be accessed as 'tc' from an installed taxcalc conda package.
"""
# CODING-STYLE CHECKS:
# pep8 tc.py
# pycodestyle tc.py
# pylint --disable=locally-disabled tc.py

import os
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/consumption.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tax-Calculator Consumption class.
"""
# CODING-STYLE CHECKS:
# pep8 consumption.py
# pycodestyle consumption.py
# pylint --disable=locally-disabled consumption.py

from taxcalc.parameters import ParametersBase
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
the functions.py module.
"""
# CODING-STYLE CHECKS:
# pep8 decorators.py
# pycodestyle decorators.py
# pylint --disable=locally-disabled decorators.py

import ast
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
indexing).
"""
# CODING-STYLE CHECKS:
# pep8 functions.py
# pycodestyle functions.py
# pylint --disable=locally-disabled functions.py
#
# pylint: disable=too-many-lines
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/growdiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tax-Calculator Growdiff class.
"""
# CODING-STYLE CHECKS:
# pep8 growdiff.py
# pycodestyle growdiff.py
# pylint --disable=locally-disabled growdiff.py

import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/growfactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tax-Calculator Growfactors class.
"""
# CODING-STYLE CHECKS:
# pep8 growfactors.py
# pycodestyle growfactors.py
# pylint --disable=locally-disabled growfactors.py

import os
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/macro_elasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Implements TaxBrain "Macroeconomic Elasticities Simulation" dynamic analysis.
"""
# CODING-STYLE CHECKS:
# pep8 macro_elasticity.py
# pycodestyle macro_elasticity.py
# pylint --disable=locally-disabled macro_elasticity.py

from taxcalc.policy import Policy
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tax-Calculator abstract base parameters class.
"""
# CODING-STYLE CHECKS:
# pep8 parameters.py
# pycodestyle parameters.py

import os
import json
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tax-Calculator federal tax policy Policy class.
"""
# CODING-STYLE CHECKS:
# pep8 policy.py
# pycodestyle policy.py
# pylint --disable=locally-disabled policy.py

from __future__ import print_function
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tax-Calculator tax-filing-unit Records class.
"""
# CODING-STYLE CHECKS:
# pep8 records.py
# pycodestyle records.py
# pylint --disable=locally-disabled records.py

import os
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/simpletaxio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tax-Calculator simple tax input-output class used in TAXSIM validation work.
"""
# CODING-STYLE CHECKS:
# pep8 simpletaxio.py
# pycodestyle simpletaxio.py
# pylint --disable=locally-disabled simpletaxio.py

import os
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/taxcalcio.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tax-Calculator Input-Output class.
"""
# CODING-STYLE CHECKS:
# pep8 taxcalcio.py
# pycodestyle taxcalcio.py
# pylint --disable=locally-disabled taxcalcio.py

import os
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/tbi/tbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
tax results.
"""
# CODING-STYLE CHECKS:
# pep8 tbi.py
# pycodestyle tbi.py
# pylint --disable=locally-disabled tbi.py

from __future__ import print_function
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/tbi/tbi_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Private utility functions used only by public functions in the tbi.py file.
"""
# CODING-STYLE CHECKS:
# pep8 tbi_utils.py
# pycodestyle tbi_utils.py
# pylint --disable=locally-disabled tbi_utils.py

from __future__ import print_function
Expand Down
3 changes: 2 additions & 1 deletion taxcalc/tests/test_4package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tests for package existence and dependencies consistency.
"""
# CODING-STYLE CHECKS:
# pep8 test_4package.py
# pycodestyle test_4package.py
# pylint --disable=locally-disabled test_4package.py

import os
Expand Down Expand Up @@ -37,6 +37,7 @@ def test_for_consistency(tests_path):
dev_pkgs = set([
'mock',
'pep8',
'pycodestyle',
'pylint',
'coverage',
'pytest-pep8',
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/tests/test_behavior.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CODING-STYLE CHECKS:
# pep8 test_behavior.py
# pycodestyle test_behavior.py

import os
import json
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/tests/test_calculate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CODING-STYLE CHECKS:
# pep8 test_calculate.py
# pycodestyle test_calculate.py

import os
import json
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/tests/test_compatible_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
plug-in pytest-xdist is able to run all parametrized functions in parallel
"""
# CODING-STYLE CHECKS:
# pep8 test_compatible_data.py
# pycodestyle test_compatible_data.py
# pylint --disable=locally-disabled test_compatible_data.py

from __future__ import print_function
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/tests/test_consumption.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CODING-STYLE CHECKS:
# pep8 test_consumption.py
# pycodestyle test_consumption.py

import numpy as np
import pytest
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/tests/test_cpscsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Read tax-calculator/TESTING.md for details.
"""
# CODING-STYLE CHECKS:
# pep8 test_cpscsv.py
# pycodestyle test_cpscsv.py
# pylint --disable=locally-disabled test_cpscsv.py

from __future__ import print_function
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/tests/test_decorators.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CODING-STYLE CHECKS:
# pep8 test_decorators.py
# pycodestyle test_decorators.py

import sys
import pytest
Expand Down
Loading

0 comments on commit 9a0232a

Please sign in to comment.