-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor(trove-classifiers): update to python 3.7-3.9 * refactor(linters): add `.flake8` and `.codespellrc` configuration files Also add `PullRequest` to `ignore_words.txt` * feat(pyproject): add `pyproject.toml` Currently, this is only use for configuring linters and formatters (no build file specifications are set). Configuration options for `black` and `pydocstyle` are added here in this commit. * feat(pre-commit): add pre-commit * fix(mypy): add `mypy` dependency to `environment.yml` This supports conda test/build environments. * feat(pylint): Update `.pylintrc` Make this match settings specififed in `Makefile`. * feat(test): align checks All checks are placed in appropriate config files. Test runner scripts point to these so that there exists a single source of truth for all configurations and that the tests performed across systems is the same. This may be adjusted, of course, if different settings must be used on a per-system basis. * feat(requirements): add `toml` This package supports reading `pyproject.toml`, which is required for some of our tests. * fix(pre-commit): fix file passing errors `pre-commit` is known to override behavior from config files in certain instances. This commit fixes known issues for: - `isort` - `black` - `mypy` - `pydocstyle` For relevant details, see: isort: + https://jugmac00.github.io/blog/isort-and-pre-commit-a-friendship-with-obstacles/ + PyCQA/isort#885 black: + psf/black#1584 mypy/pydocstyle: + python/mypy#4008 (comment) + https://pre-commit.com/#hooks-pass_filenames * feat(ignores): ignore specific linting errors Ignore linting errors in source code in this PR. The purpose of this PR is to update linting tools. A future PR will correct the errors. This is done to separate concerns. Co-authored-by: Hendry, Adam <[email protected]>
- Loading branch information
1 parent
a84558f
commit a3886c2
Showing
15 changed files
with
254 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[codespell] | ||
skip = ./.ci/*,./.git/*,./.hypothesis/*,./dist/*,./doc/examples/*,./doc/images/*,./docs/_build/*,./docs/images/*,./tests/tinypages/_build/*,.hypothesis*,*.doctree,*.eot,*.gif,*.html,*.inv,*.ipynb,*.jpg,*.js,*.json,*.mp4,*.mypy_cache/*,*.pickle,*.ply,*.png,*.pyc,*.ttf,*.txt,*.vti,*.vtk,*.vtu,*.woff,*.woff2,*.yml,*/_autosummary/*,*~,*cover,doc/_build/*,flycheck* | ||
ignore-words-list = lod,byteorder,flem,parm,doubleclick,revered,PullRequest | ||
quiet-level = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[flake8] | ||
max-line-length = 88 | ||
exclude = | ||
__pycache__, | ||
.venv, | ||
.cache, | ||
.eggs | ||
.git, | ||
.tox, | ||
*.egg-info, | ||
*.pyc, | ||
*.pyi, | ||
build, | ||
dist, | ||
# This is adopted from VTK | ||
pyvistaqt/rwi.py, | ||
# Only lint source files | ||
tests/*.py, | ||
docs/*.py, | ||
# Ignore errors here in this commit (fix in future PR) | ||
pyvistaqt/*.py, | ||
setup.py | ||
max-complexity = 10 | ||
doctests = true | ||
extend-ignore = | ||
# whitespace before ':' | ||
E203, | ||
# line break before binary operator | ||
W503, | ||
# line length too long | ||
E501, | ||
# do not assign a lambda expression, use a def | ||
E731, | ||
# missing class docstring; use ``__init__`` docstring instead | ||
D101, | ||
# missing docstring in magic method | ||
D105, | ||
# Qt uses camelCase | ||
N802 | ||
per-file-ignores = | ||
# Allow re-export of modules at package level | ||
__init__.py:F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
[settings] | ||
profile=black | ||
multi_line_output=3 | ||
include_trailing_comma=True | ||
force_grid_wrap=0 | ||
use_parentheses=True | ||
line_length=88 | ||
ensure_newline_before_comments=True | ||
extend_skip_glob=tests/*.py,docs/conf.py,setup.py,pyvistaqt/rwi.py | ||
# `pre-comment` doesn't see skips; `filter_files=True` forces it | ||
# to see these files | ||
# | ||
# See: | ||
# - https://jugmac00.github.io/blog/isort-and-pre-commit-a-friendship-with-obstacles/ | ||
# - https://github.com/PyCQA/isort/issues/885 | ||
filter_files=True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 22.3.0 | ||
hooks: | ||
- id: black | ||
args: [ | ||
"--config=pyproject.toml" | ||
] | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.10.1 | ||
hooks: | ||
- id: isort | ||
args: [ | ||
"--check", | ||
"--settings=.isort.cfg" | ||
] | ||
|
||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v0.961 | ||
hooks: | ||
- id: mypy | ||
# `pass_filenames` is used to overcome the "duplicate module" | ||
# error from occuring. We are explicitly passing a 'txt' | ||
# file to search. This setting tells `pre-commit` to not do a | ||
# search and pass files to check to mypy, like it normally does. | ||
# | ||
# See: | ||
# - https://github.com/python/mypy/issues/4008#issuecomment-708060733 | ||
# - https://pre-commit.com/#hooks-pass_filenames | ||
language: system | ||
pass_filenames: false | ||
args: [ | ||
"--config-file", | ||
"mypy.ini", | ||
"@mypy_checklist.txt" | ||
] | ||
|
||
- repo: https://gitlab.com/PyCQA/flake8 | ||
rev: 3.9.2 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: [ | ||
"flake8-black==0.3.2", | ||
"flake8-isort==4.1.1", | ||
"flake8-quotes==3.3.1", | ||
] | ||
args: [ | ||
"--config=.flake8" | ||
] | ||
|
||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.1.0 | ||
hooks: | ||
- id: codespell | ||
args: [ | ||
"docs examples examples_flask pyvista tests", | ||
"*.py *.rst *.md", | ||
] | ||
|
||
- repo: https://github.com/pycqa/pydocstyle | ||
rev: 6.1.1 | ||
hooks: | ||
- id: pydocstyle | ||
additional_dependencies: [toml==0.10.2] | ||
# We use the 'match' and do not want pre-commit to pass | ||
# globbed files | ||
pass_filenames: false | ||
args: [ | ||
"--config=pyproject.toml", | ||
] | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: check-merge-conflict | ||
- id: debug-statements | ||
- id: no-commit-to-branch | ||
args: [--branch, main] | ||
|
||
# this validates our github workflow files | ||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.16.1 | ||
hooks: | ||
- id: check-github-workflows | ||
|
||
- repo: local | ||
hooks: | ||
- id: pylint | ||
name: pylint | ||
entry: pylint | ||
language: system | ||
types: [python] | ||
args: | ||
[ | ||
"-rn", # Only display messages | ||
"-sn", # Don't display the score | ||
"--rcfile=.pylintrc", # Specify rc file | ||
] | ||
- id: pycodestyle | ||
name: pycodestyle | ||
entry: pycodestyle | ||
language: system | ||
types: [python] | ||
args: | ||
[ | ||
"--config=./\\.pycodestyle", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[pycodestyle] | ||
ignore = E501, | ||
E203, | ||
W503 | ||
exclude = tests/*.py, | ||
docs/*.py, | ||
rwi.py | ||
filename = pyvistaqt/*.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.