Skip to content

Commit

Permalink
refactor: Remove stale references to flake8 (#1625)
Browse files Browse the repository at this point in the history
In PR #1466, `flake8`, `black`,
and `isort` were replaced with the [ruff](https://astral.sh/ruff) linter
and formatter. It seems there are a few leftovers of this transition. In
this PR, I did a quick search for flake8 and deleted / replaced all
instances found.

Removing `flake8` means rebuilding the requirements (to propagate the
changes to the frozen `requirements-*` files), which updates a couple of
dependencies.

We also decided to remove the `linter-*` tasks of `tox` since they have
been replaced by `pre-commit`.
  • Loading branch information
romanc committed Sep 3, 2024
1 parent 7824e38 commit e4fb802
Show file tree
Hide file tree
Showing 37 changed files with 530 additions and 552 deletions.
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ repos:
## version = re.search('ruff==([0-9\.]*)', open("constraints.txt").read())[1]
## print(f"rev: v{version}")
##]]]
rev: v0.5.6
rev: v0.6.3
##[[[end]]]
hooks:
# Run the linter.
Expand All @@ -66,9 +66,9 @@ repos:
## version = re.search('mypy==([0-9\.]*)', open("constraints.txt").read())[1]
## print(f"#========= FROM constraints.txt: v{version} =========")
##]]]
#========= FROM constraints.txt: v1.11.1 =========
#========= FROM constraints.txt: v1.11.2 =========
##[[[end]]]
rev: v1.11.1 # MUST match version ^^^^ in constraints.txt (if the mirror is up-to-date)
rev: v1.11.2 # MUST match version ^^^^ in constraints.txt (if the mirror is up-to-date)
hooks:
- id: mypy
additional_dependencies: # versions from constraints.txt
Expand All @@ -92,21 +92,21 @@ repos:
- click==8.1.7
- cmake==3.30.2
- cytoolz==0.12.3
- deepdiff==7.0.1
- deepdiff==8.0.1
- devtools==0.12.2
- factory-boy==3.3.0
- factory-boy==3.3.1
- frozendict==2.4.4
- gridtools-cpp==2.3.4
- importlib-resources==6.4.0
- importlib-resources==6.4.4
- jinja2==3.1.4
- lark==1.1.9
- lark==1.2.2
- mako==1.3.5
- nanobind==2.0.0
- nanobind==2.1.0
- ninja==1.11.1.1
- numpy==1.24.4
- packaging==24.1
- pybind11==2.13.1
- setuptools==72.1.0
- pybind11==2.13.5
- setuptools==74.0.0
- tabulate==0.9.0
- typing-extensions==4.12.2
- xxhash==3.0.0
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- List format (alphabetical order): Surname, Name. Employer/Affiliation -->

- Benedicic, Lucas. ETH Zurich - CSCS
- Cattaneo, Roman. SSAI/NASA-GSFC
- Cruz, Felipe. ETH Zurich - CSCS
- Dahm, Johann. Allen Institute for AI
- Davis, Eddie. Allen Institute for AI
Expand Down
3 changes: 0 additions & 3 deletions CODING_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,7 @@ https://testandcode.com/116

[doctest]: https://docs.python.org/3/library/doctest.html
[google-style-guide]: https://google.github.io/styleguide/pyguide.html
[mypy]: https://mypy.readthedocs.io/
[mypy-error-codes]: https://mypy.readthedocs.io/en/stable/error_code_list.html
[pre-commit]: https://pre-commit.com/
[pylint]: https://pylint.pycqa.org/
[ruff-formatter]: https://docs.astral.sh/ruff/formatter/
[ruff-linter]: https://docs.astral.sh/ruff/linter/
Expand All @@ -233,4 +231,3 @@ https://testandcode.com/116
[sphinx-autodoc]: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
[sphinx-napoleon]: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/index.html#
[sphinx-rest]: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
[ci-docs]: docs/development/CI/infrastructure.md
20 changes: 6 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ pre-commit run
# Check all the files in the repository: -a / --all-files
pre-commit run -a
# Run only some of the tools (e.g. flake8)
pre-commit run -a flake8
# Run only some of the tools (e.g. ruff)
pre-commit run -a ruff
```

### Unit and Regression Tests
Expand Down Expand Up @@ -175,9 +175,7 @@ Before submitting a pull request, check that it meets the following criteria:

As mentioned above, we use several tools to help us write high-quality code. New tools could be added in the future, especially if they do not add a large overhead to our workflow and they bring extra benefits to keep our codebase in shape. The most important ones which we currently rely on are:

- [Black][black] for autoformatting source code.
- [isort][isort] for autoformatting import statements.
- [Flake8][flake8] for style enforcement and code linting.
- [ruff][ruff] for style enforcement and code linting.
- [pre-commit][pre-commit] for automating the execution of QA tools.
- [pytest][pytest] for writing readable tests, extended with:
- [Coverage.py][coverage] and [pytest-cov][pytest-cov] for test coverage reports.
Expand All @@ -189,21 +187,15 @@ As mentioned above, we use several tools to help us write high-quality code. New

<!-- Reference links -->

[black]: https://black.readthedocs.io/en/stable/
[commitizen]: https://commitizen-tools.github.io/commitizen/
[conventional-commits]: https://www.conventionalcommits.org/en/v1.0.0/#summary
[coverage]: https://coverage.readthedocs.io/
[flake8]: https://flake8.pycqa.org/
[google-style-guide]: https://google.github.io/styleguide/pyguide.html
[isort]: https://pycqa.github.io/isort/
[ruff]: https://astral.sh/ruff
[jupytext]: https://jupytext.readthedocs.io/
[pre-commit]: https://pre-commit.com/
[pylint]: https://pylint.pycqa.org/
[pytest]: https://docs.pytest.org/
[pytest-cov]: https://pypi.org/project/pytest-cov/
[pytest-xdist]: https://pytest-xdist.readthedocs.io/en/latest/
[sphinx]: https://www.sphinx-doc.org
[sphinx-autodoc]: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
[sphinx-napoleon]: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/index.html#
[sphinx-rest]: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
[tox]: https://tox.wiki/en/latest/#
[sphinx-napoleon]: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/index.html
[tox]: https://tox.wiki/en/latest/
77 changes: 31 additions & 46 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ alabaster==0.7.13 # via sphinx
annotated-types==0.7.0 # via pydantic
asttokens==2.4.1 # via devtools, stack-data
astunparse==1.6.3 ; python_version < "3.9" # via dace, gt4py (pyproject.toml)
attrs==24.2.0 # via flake8-bugbear, flake8-eradicate, gt4py (pyproject.toml), hypothesis, jsonschema, referencing
babel==2.15.0 # via sphinx
attrs==24.2.0 # via gt4py (pyproject.toml), hypothesis, jsonschema, referencing
babel==2.16.0 # via sphinx
backcall==0.2.0 # via ipython
black==24.8.0 # via gt4py (pyproject.toml)
boltons==24.0.0 # via gt4py (pyproject.toml)
bracex==2.5 # via wcmatch
build==1.2.1 # via pip-tools
bump-my-version==0.25.0 # via -r requirements-dev.in
bump-my-version==0.26.0 # via -r requirements-dev.in
cached-property==1.5.2 # via gt4py (pyproject.toml)
cachetools==5.4.0 # via tox
certifi==2024.7.4 # via requests
cachetools==5.5.0 # via tox
certifi==2024.8.30 # via requests
cfgv==3.4.0 # via pre-commit
chardet==5.2.0 # via tox
charset-normalizer==3.3.2 # via requests
Expand All @@ -37,38 +37,28 @@ dace==0.16.1 # via gt4py (pyproject.toml)
darglint==1.8.1 # via -r requirements-dev.in
debugpy==1.8.5 # via ipykernel
decorator==5.1.1 # via ipython
deepdiff==7.0.1 # via gt4py (pyproject.toml)
deepdiff==8.0.1 # via gt4py (pyproject.toml)
devtools==0.12.2 # via gt4py (pyproject.toml)
dill==0.3.8 # via dace
distlib==0.3.8 # via virtualenv
docutils==0.20.1 # via restructuredtext-lint, sphinx, sphinx-rtd-theme
eradicate==2.3.0 # via flake8-eradicate
docutils==0.20.1 # via sphinx, sphinx-rtd-theme
exceptiongroup==1.2.2 # via hypothesis, pytest
execnet==2.1.1 # via pytest-cache, pytest-xdist
executing==2.0.1 # via devtools, stack-data
factory-boy==3.3.0 # via gt4py (pyproject.toml), pytest-factoryboy
faker==26.2.0 # via factory-boy
executing==2.1.0 # via devtools, stack-data
factory-boy==3.3.1 # via gt4py (pyproject.toml), pytest-factoryboy
faker==28.1.0 # via factory-boy
fastjsonschema==2.20.0 # via nbformat
filelock==3.15.4 # via tox, virtualenv
flake8==7.1.1 # via -r requirements-dev.in, flake8-bugbear, flake8-builtins, flake8-debugger, flake8-docstrings, flake8-eradicate, flake8-mutable, flake8-pyproject, flake8-rst-docstrings
flake8-bugbear==24.4.26 # via -r requirements-dev.in
flake8-builtins==2.5.0 # via -r requirements-dev.in
flake8-debugger==4.1.2 # via -r requirements-dev.in
flake8-docstrings==1.7.0 # via -r requirements-dev.in
flake8-eradicate==1.5.0 # via -r requirements-dev.in
flake8-mutable==1.2.0 # via -r requirements-dev.in
flake8-pyproject==1.2.3 # via -r requirements-dev.in
flake8-rst-docstrings==0.3.0 # via -r requirements-dev.in
fonttools==4.53.1 # via matplotlib
fparser==0.1.4 # via dace
frozendict==2.4.4 # via gt4py (pyproject.toml)
gridtools-cpp==2.3.4 # via gt4py (pyproject.toml)
hypothesis==6.109.0 # via -r requirements-dev.in, gt4py (pyproject.toml)
hypothesis==6.111.2 # via -r requirements-dev.in, gt4py (pyproject.toml)
identify==2.6.0 # via pre-commit
idna==3.7 # via requests
idna==3.8 # via requests
imagesize==1.4.1 # via sphinx
importlib-metadata==8.2.0 # via build, jupyter-client, sphinx
importlib-resources==6.4.0 ; python_version < "3.9" # via gt4py (pyproject.toml), jsonschema, jsonschema-specifications, matplotlib
importlib-metadata==8.4.0 # via build, jupyter-client, sphinx
importlib-resources==6.4.4 ; python_version < "3.9" # via gt4py (pyproject.toml), jsonschema, jsonschema-specifications, matplotlib
inflection==0.5.1 # via pytest-factoryboy
iniconfig==2.0.0 # via pytest
ipykernel==6.29.5 # via nbmake
Expand All @@ -82,19 +72,18 @@ jupyter-client==8.6.2 # via ipykernel, nbclient
jupyter-core==5.7.2 # via ipykernel, jupyter-client, nbformat
jupytext==1.16.4 # via -r requirements-dev.in
kiwisolver==1.4.5 # via matplotlib
lark==1.1.9 # via gt4py (pyproject.toml)
lark==1.2.2 # via gt4py (pyproject.toml)
mako==1.3.5 # via gt4py (pyproject.toml)
markdown-it-py==3.0.0 # via jupytext, mdit-py-plugins, rich
markupsafe==2.1.5 # via jinja2, mako
matplotlib==3.7.5 # via -r requirements-dev.in
matplotlib-inline==0.1.7 # via ipykernel, ipython
mccabe==0.7.0 # via flake8
mdit-py-plugins==0.4.1 # via jupytext
mdurl==0.1.2 # via markdown-it-py
mpmath==1.3.0 # via sympy
mypy==1.11.1 # via -r requirements-dev.in
mypy==1.11.2 # via -r requirements-dev.in
mypy-extensions==1.0.0 # via black, mypy
nanobind==2.0.0 # via gt4py (pyproject.toml)
nanobind==2.1.0 # via gt4py (pyproject.toml)
nbclient==0.6.8 # via nbmake
nbformat==5.10.4 # via jupytext, nbclient, nbmake
nbmake==1.5.4 # via -r requirements-dev.in
Expand All @@ -103,7 +92,7 @@ networkx==3.1 # via dace
ninja==1.11.1.1 # via gt4py (pyproject.toml)
nodeenv==1.9.1 # via pre-commit
numpy==1.24.4 # via contourpy, dace, gt4py (pyproject.toml), matplotlib, scipy
ordered-set==4.1.0 # via deepdiff
orderly-set==5.2.2 # via deepdiff
packaging==24.1 # via black, build, gt4py (pyproject.toml), ipykernel, jupytext, matplotlib, pipdeptree, pyproject-api, pytest, pytest-factoryboy, setuptools-scm, sphinx, tox
parso==0.8.4 # via jedi
pathspec==0.12.1 # via black
Expand All @@ -121,15 +110,12 @@ prompt-toolkit==3.0.36 # via ipython, questionary
psutil==6.0.0 # via -r requirements-dev.in, ipykernel, pytest-xdist
ptyprocess==0.7.0 # via pexpect
pure-eval==0.2.3 # via stack-data
pybind11==2.13.1 # via gt4py (pyproject.toml)
pycodestyle==2.12.1 # via flake8, flake8-debugger
pybind11==2.13.5 # via gt4py (pyproject.toml)
pydantic==2.8.2 # via bump-my-version, pydantic-settings
pydantic-core==2.20.1 # via pydantic
pydantic-settings==2.4.0 # via bump-my-version
pydocstyle==6.3.0 # via flake8-docstrings
pyflakes==3.2.0 # via flake8
pygments==2.18.0 # via -r requirements-dev.in, devtools, flake8-rst-docstrings, ipython, nbmake, rich, sphinx
pyparsing==3.1.2 # via matplotlib
pygments==2.18.0 # via -r requirements-dev.in, devtools, ipython, nbmake, rich, sphinx
pyparsing==3.1.4 # via matplotlib
pyproject-api==1.7.1 # via tox
pyproject-hooks==1.1.0 # via build, pip-tools
pytest==8.3.2 # via -r requirements-dev.in, gt4py (pyproject.toml), nbmake, pytest-cache, pytest-cov, pytest-factoryboy, pytest-instafail, pytest-xdist
Expand All @@ -142,19 +128,18 @@ python-dateutil==2.9.0.post0 # via faker, jupyter-client, matplotlib
python-dotenv==1.0.1 # via pydantic-settings
pytz==2024.1 # via babel
pyyaml==6.0.2 # via dace, jupytext, pre-commit
pyzmq==26.1.0 # via ipykernel, jupyter-client
pyzmq==26.2.0 # via ipykernel, jupyter-client
questionary==2.0.1 # via bump-my-version
referencing==0.35.1 # via jsonschema, jsonschema-specifications
requests==2.32.3 # via sphinx
restructuredtext-lint==1.4.0 # via flake8-rst-docstrings
rich==13.7.1 # via bump-my-version, rich-click
rich==13.8.0 # via bump-my-version, rich-click
rich-click==1.8.3 # via bump-my-version
rpds-py==0.20.0 # via jsonschema, referencing
ruff==0.5.6 # via -r requirements-dev.in
ruff==0.6.3 # via -r requirements-dev.in
scipy==1.10.1 # via gt4py (pyproject.toml)
setuptools-scm==8.1.0 # via fparser
six==1.16.0 # via asttokens, astunparse, python-dateutil
snowballstemmer==2.2.0 # via pydocstyle, sphinx
snowballstemmer==2.2.0 # via sphinx
sortedcontainers==2.4.0 # via hypothesis
sphinx==7.1.2 # via -r requirements-dev.in, sphinx-rtd-theme, sphinxcontrib-jquery
sphinx-rtd-theme==2.0.0 # via -r requirements-dev.in
Expand All @@ -168,23 +153,23 @@ sphinxcontrib-serializinghtml==1.1.5 # via sphinx
stack-data==0.6.3 # via ipython
sympy==1.12.1 # via dace, gt4py (pyproject.toml)
tabulate==0.9.0 # via gt4py (pyproject.toml)
tomli==2.0.1 ; python_version < "3.11" # via -r requirements-dev.in, black, build, coverage, flake8-pyproject, jupytext, mypy, pip-tools, pyproject-api, pytest, setuptools-scm, tox
tomlkit==0.13.0 # via bump-my-version
tomli==2.0.1 ; python_version < "3.11" # via -r requirements-dev.in, black, build, coverage, jupytext, mypy, pip-tools, pyproject-api, pytest, setuptools-scm, tox
tomlkit==0.13.2 # via bump-my-version
toolz==0.12.1 # via cytoolz
tornado==6.4.1 # via ipykernel, jupyter-client
tox==4.17.0 # via -r requirements-dev.in
tox==4.18.0 # via -r requirements-dev.in
traitlets==5.14.3 # via comm, ipykernel, ipython, jupyter-client, jupyter-core, matplotlib-inline, nbclient, nbformat
types-tabulate==0.9.0.20240106 # via -r requirements-dev.in
typing-extensions==4.12.2 # via annotated-types, black, gt4py (pyproject.toml), ipython, mypy, pydantic, pydantic-core, pytest-factoryboy, rich, rich-click, setuptools-scm
urllib3==2.2.2 # via requests
virtualenv==20.26.3 # via pre-commit, tox
wcmatch==9.0 # via bump-my-version
wcwidth==0.2.13 # via prompt-toolkit
websockets==12.0 # via dace
websockets==13.0.1 # via dace
wheel==0.44.0 # via astunparse, pip-tools
xxhash==3.0.0 # via gt4py (pyproject.toml)
zipp==3.19.2 # via importlib-metadata, importlib-resources
zipp==3.20.1 # via importlib-metadata, importlib-resources

# The following packages are considered to be unsafe in a requirements file:
pip==24.2 # via pip-tools, pipdeptree
setuptools==72.1.0 # via gt4py (pyproject.toml), pip-tools, setuptools-scm
setuptools==74.0.0 # via gt4py (pyproject.toml), pip-tools, setuptools-scm
2 changes: 1 addition & 1 deletion docs/development/tools/ci-infrastructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ flowchart LR

The `Test Eve`, `Test Storage (CPU)`, `Test Cartesian (CPU)`, and `Test Next (CPU)` workflows run the automated tests for the respective subpackages. In all cases only tests are run that do not require the presence of a GPU.

The `Code Quality` workflow runs pre-commit to check code quality requirements through tools like **mypy** or **flake8**.
The `Code Quality` workflow runs pre-commit to check code quality requirements through tools like **mypy** or **ruff**.

Code coverage workflows are currently disabled.

Expand Down
14 changes: 6 additions & 8 deletions docs/user/next/workshop/exercises/1_simple_addition.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"metadata": {},
"outputs": [],
"source": [
"def addition ... # TODO fix this cell"
"def addition(): ... # TODO fix this cell"
]
},
{
Expand Down Expand Up @@ -89,14 +89,12 @@
" print(\"Result:\")\n",
" print(c)\n",
" print(c.asnumpy())\n",
" \n",
"\n",
" # Plots\n",
" fig, ax = plt.subplot_mosaic([\n",
" ['a', 'b', 'c']\n",
" ])\n",
" ax['a'].imshow(a.asnumpy())\n",
" ax['b'].imshow(b.asnumpy())\n",
" ax['c'].imshow(c.asnumpy())\n",
" fig, ax = plt.subplot_mosaic([[\"a\", \"b\", \"c\"]])\n",
" ax[\"a\"].imshow(a.asnumpy())\n",
" ax[\"b\"].imshow(b.asnumpy())\n",
" ax[\"c\"].imshow(c.asnumpy())\n",
"\n",
" print(\"\\nTest successful!\")"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,12 @@
" print(\"Result:\")\n",
" print(c)\n",
" print(c.asnumpy())\n",
" \n",
"\n",
" # Plots\n",
" fig, ax = plt.subplot_mosaic([\n",
" ['a', 'b', 'c']\n",
" ])\n",
" ax['a'].imshow(a.asnumpy())\n",
" ax['b'].imshow(b.asnumpy())\n",
" ax['c'].imshow(c.asnumpy())\n",
" fig, ax = plt.subplot_mosaic([[\"a\", \"b\", \"c\"]])\n",
" ax[\"a\"].imshow(a.asnumpy())\n",
" ax[\"b\"].imshow(b.asnumpy())\n",
" ax[\"c\"].imshow(c.asnumpy())\n",
"\n",
" print(\"\\nTest successful!\")"
]
Expand Down
15 changes: 3 additions & 12 deletions docs/user/next/workshop/exercises/2_divergence_exercise.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,7 @@
" A: np.array,\n",
" edge_orientation: np.array,\n",
") -> np.array:\n",
" uv_div = (\n",
" np.sum(\n",
" (u[c2e] * nx[c2e] + v[c2e] * ny[c2e]) * L[c2e] * edge_orientation, axis=1\n",
" )\n",
" / A\n",
" )\n",
" uv_div = np.sum((u[c2e] * nx[c2e] + v[c2e] * ny[c2e]) * L[c2e] * edge_orientation, axis=1) / A\n",
" return uv_div"
]
},
Expand Down Expand Up @@ -105,9 +100,7 @@
" ny = random_field(edge_domain, allocator=backend)\n",
" L = random_field(edge_domain, allocator=backend)\n",
" A = random_field(cell_domain, allocator=backend)\n",
" edge_orientation = random_sign(\n",
" gtx.domain({C: n_cells, C2EDim: 3}), allocator=backend\n",
" )\n",
" edge_orientation = random_sign(gtx.domain({C: n_cells, C2EDim: 3}), allocator=backend)\n",
"\n",
" divergence_ref = divergence_numpy(\n",
" c2e_table,\n",
Expand All @@ -120,9 +113,7 @@
" edge_orientation.asnumpy(),\n",
" )\n",
"\n",
" c2e_connectivity = gtx.NeighborTableOffsetProvider(\n",
" c2e_table, C, E, 3, has_skip_values=False\n",
" )\n",
" c2e_connectivity = gtx.NeighborTableOffsetProvider(c2e_table, C, E, 3, has_skip_values=False)\n",
"\n",
" divergence_gt4py = gtx.zeros(cell_domain, allocator=backend)\n",
"\n",
Expand Down
Loading

0 comments on commit e4fb802

Please sign in to comment.