Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: autoupdate pre-commit hooks #20

Merged
merged 8 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 21 additions & 36 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ci:
autoupdate_commit_msg: "MAINT: autoupdate pre-commit hooks"
autoupdate_schedule: quarterly
skip:
- prettier
- pyright
- taplo

Expand All @@ -11,6 +12,18 @@ repos:
- id: check-hooks-apply
- id: check-useless-excludes

- repo: https://github.com/ComPWA/policy
rev: 0.2.0
hooks:
- id: check-dev-files
args:
- --no-gitpod
- --no-prettierrc
- --no-pypi
- --repo-name=ComPWA benchmarks
- --repo-title=benchmarks
- id: colab-toc-visible

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
Expand All @@ -26,37 +39,16 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/ComPWA/repo-maintenance
rev: 0.1.0
hooks:
- id: check-dev-files
args:
- --no-gitpod
- --no-prettierrc
- --no-pypi
- --repo-name=ComPWA benchmarks
- --repo-title=benchmarks
- id: colab-toc-visible
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-pyupgrade
args:
- --py37-plus
- id: nbqa-ruff
args:
- --fix

- repo: https://github.com/psf/black
rev: 23.9.1
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
hooks:
- id: black
- id: black-jupyter
args: [--line-length=85]
types_or: [jupyter]

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: 2.7.2
rev: 2.7.3
hooks:
- id: editorconfig-checker
name: editorconfig
Expand Down Expand Up @@ -92,28 +84,21 @@ repos:
metadata.vscode

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v4.0.0-alpha.8
hooks:
- id: prettier

- repo: https://github.com/ComPWA/mirrors-pyright
rev: v1.1.330
rev: v1.1.345
hooks:
- id: pyright

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args:
- --py37-plus

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
rev: v0.1.13
hooks:
- id: ruff
args:
- --fix
args: [--fix]
types_or: [python, pyi, jupyter]

- repo: https://github.com/ComPWA/mirrors-taplo
rev: v0.8.1
Expand Down
4 changes: 3 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"executablebookproject.myst-highlight",
"garaioag.garaio-vscode-unwanted-recommendations",
"github.vscode-github-actions",
"github.vscode-pull-request-github",
"ms-python.black-formatter",
Expand All @@ -15,6 +14,7 @@
"ms-vsliveshare.vsliveshare",
"oijaz.unicode-latex",
"redhat.vscode-yaml",
"Soulcode.vscode-unwanted-extensions",
"stkb.rewrap",
"tamasfe.even-better-toml",
"tyriar.sort-lines",
Expand All @@ -23,10 +23,12 @@
"unwantedRecommendations": [
"bungcip.better-toml",
"davidanson.vscode-markdownlint",
"garaioag.garaio-vscode-unwanted-recommendations",
"ms-python.flake8",
"ms-python.isort",
"ms-python.mypy-type-checker",
"ms-python.pylint",
"streetsidesoftware.code-spell-checker",
"travisillig.vscode-json-stable-stringify"
]
}
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.rulers": [88]
Expand All @@ -27,13 +27,15 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"black-formatter.importStrategy": "fromEnvironment",
"diffEditor.experimental.showMoves": true,
"editor.formatOnSave": true,
"files.associations": {
".cspell/*.txt": "plaintext"
},
"files.eol": "\n",
"github-actions.workflows.pinned.workflows": [".github/workflows/ci.yml"],
"livePreview.defaultPreviewPath": "docs/_build/html",
"multiDiffEditor.experimental.enabled": true,
"notebook.gotoSymbols.showAllSymbols": true,
"python.analysis.autoImportCompletions": false,
"rewrap.wrappingColumn": 88,
Expand Down
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ dependencies:
- pip
- pip:
- -e .[dev]
variables:
PRETTIER_LEGACY_CLI: "1"
48 changes: 30 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dev = [
"benchmarks[doc]",
"benchmarks[jupyter]",
"benchmarks[sty]",
"benchmarks[test]",
"sphinx-autobuild",
"tox >=1.9", # for skip_install, use_develop
]
Expand All @@ -55,8 +56,15 @@ format = [
"black",
]
jupyter = [
"isort",
"jupyterlab >=3.0",
"jupyterlab",
"jupyterlab-code-formatter",
"jupyterlab-git",
"jupyterlab-lsp",
"jupyterlab-myst",
"python-lsp-ruff",
"python-lsp-server[rope]",
'jupyterlab-myst; python_version >="3.7.0"',
]
lint = [
Expand All @@ -67,6 +75,9 @@ sty = [
"benchmarks[lint]",
"pre-commit >=1.4.0",
]
test = [
"nbmake",
]

[project.readme]
content-type = "text/markdown"
Expand Down Expand Up @@ -99,24 +110,6 @@ target-version = [
"py39",
]

[tool.nbqa.addopts]
ruff = [
"--extend-ignore=B018",
"--extend-ignore=C408",
"--extend-ignore=C90",
"--extend-ignore=D",
"--extend-ignore=N806",
"--extend-ignore=N816",
"--extend-ignore=PLR09",
"--extend-ignore=PLR2004",
"--extend-ignore=PLW0602",
"--extend-ignore=PLW0603",
"--line-length=85",
]

[tool.nbqa.exclude]
flake8 = "^docs/appendix/benchmark.ipynb"

[tool.pyright]
reportGeneralTypeIssues = false
reportImportCycles = false
Expand Down Expand Up @@ -163,6 +156,7 @@ testpaths = [
]

[tool.ruff]
extend-include = ["*.ipynb"]
extend-select = [
"A",
"B",
Expand Down Expand Up @@ -213,13 +207,31 @@ target-version = "py37"
task-tags = ["cspell"]

[tool.ruff.per-file-ignores]
"*.ipynb" = [
"B018",
"C408",
"C90",
"D",
"E402",
"E703",
"N806",
"N816",
"PLR09",
"PLR2004",
"PLW0602",
"PLW0603",
"S101",
"T20",
"TCH00",
]
"docs/*" = [
"E402",
"INP001",
"S101",
"S113",
"T201",
]
"docs/conf.py" = ["D100"]
"scripts/*" = ["INP001"]
"setup.py" = ["D100"]

Expand Down
1 change: 1 addition & 0 deletions scripts/execute_jax_benchmark.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Execute JAX over a combination of physical cores."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions scripts/visualize_jax_benchmark.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Visualize benchmark results from :file:`execute_jax_benchmark.py`."""

from __future__ import annotations

import logging
Expand Down
29 changes: 29 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,25 @@ setenv =
FORCE_COLOR = yes
PYTHONHASHSEED = 0

[testenv:docnblive]
allowlist_externals =
sphinx-autobuild
commands =
sphinx-autobuild \
--open-browser \
--re-ignore .*/.ipynb_checkpoints/.* \
--re-ignore .*/__pycache__/.* \
--re-ignore .*\.tmp \
--watch docs \
docs/ docs/_build/html
description =
Set up a server to directly preview changes to the HTML pages
passenv = *
setenv =
EXECUTE_NB = yes
FORCE_COLOR = yes
PYTHONHASHSEED = 0

[testenv:docnb-force]
allowlist_externals =
sphinx-build
Expand Down Expand Up @@ -84,6 +103,16 @@ passenv = *
setenv =
FORCE_COLOR = yes

[testenv:nb]
allowlist_externals =
pytest
commands =
pytest --nbmake {posargs:docs}
description =
Run all notebooks with pytest
passenv = *
setenv =
PYTHONHASHSEED = 0

[testenv:sty]
description =
Expand Down
Loading