-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major change to the pre-commit fixes & checks to align with the current state of https://learn.scientific-python.org/development/guides/style/ The main thing: Switching to ruff, motivated by problems updating the pre-commit tools (black made changes that flake8 then complained about). Using ruff replaces using black and flake8 directly. It has a long list of rules that can be configured. A lot of style changes were made automatically, and I've temporarily(?) disabled rules that caused a problem needing manual changes. Some minor fixes to CI, including switching from the deprecated pre-commit action to the pre-commit.ci application
- Loading branch information
Showing
33 changed files
with
337 additions
and
277 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,25 +4,18 @@ on: | |
workflow_dispatch: | ||
pull_request: | ||
branches: [ main, staging ] | ||
schedule: | ||
# Weekly on Sunday | ||
- cron: "0 1 * * 0" | ||
|
||
jobs: | ||
pre-commit: | ||
name: Format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v2 | ||
- uses: pre-commit/[email protected] | ||
with: | ||
extra_args: --hook-stage manual --all-files | ||
|
||
checks: | ||
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }} | ||
runs-on: ${{ matrix.runs-on }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10"] | ||
python-version: ["3.9", "3.10", "3.11"] | ||
runs-on: [ubuntu-latest, macos-latest, windows-latest] | ||
|
||
# include: | ||
|
@@ -36,9 +29,9 @@ jobs: | |
run: brew reinstall gfortran | ||
shell: bash | ||
|
||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v2 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
|
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 |
---|---|---|
|
@@ -141,4 +141,8 @@ cython_debug/ | |
src/*/_version.py | ||
|
||
# VSCode | ||
.vscode/* | ||
.vscode | ||
|
||
# Other dev tool junk | ||
.ruff_cache | ||
node_modules |
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,97 +1,91 @@ | ||
exclude: ^(.*/data/.*) | ||
|
||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 23.1.0 | ||
hooks: | ||
- id: black-jupyter | ||
# Strip outputs from notebooks | ||
- repo: https://github.com/kynan/nbstripout | ||
rev: "0.7.1" | ||
hooks: | ||
- id: nbstripout | ||
args: | ||
["--extra-keys", "metadata.kernelspec metadata.language_info.version"] | ||
|
||
- repo: https://github.com/kynan/nbstripout | ||
rev: "0.6.1" | ||
hooks: | ||
- id: nbstripout | ||
args: ["--extra-keys", "metadata.kernelspec metadata.language_info.version"] | ||
# The rest of the checks are from: | ||
# https://github.com/scientific-python/cookie/blob/main/%7B%7Bcookiecutter.project_name%7D%7D/.pre-commit-config.yaml | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: requirements-txt-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: "v4.5.0" | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: name-tests-test | ||
args: ["--pytest-test-first"] | ||
- id: requirements-txt-fixer | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: v1.10.0 | ||
hooks: | ||
- id: python-check-blanket-noqa | ||
# - id: python-check-blanket-type-ignore | ||
- id: python-no-eval | ||
- id: python-use-type-annotations | ||
- id: rst-backticks | ||
- id: rst-directive-colons | ||
- id: rst-inline-touching-normal | ||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: "v1.10.0" | ||
hooks: | ||
- id: rst-backticks | ||
- id: rst-directive-colons | ||
- id: rst-inline-touching-normal | ||
|
||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
# args: ["-a", "from __future__ import annotations"] # Python 3.7+ | ||
# - repo: https://github.com/pre-commit/mirrors-prettier | ||
# rev: "v4.0.0-alpha.8" | ||
# hooks: | ||
# - id: prettier | ||
# types_or: [yaml, markdown, html, css, scss, javascript, json] | ||
# args: [--prose-wrap=always] | ||
|
||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.3.1 | ||
hooks: | ||
- id: pyupgrade | ||
args: ["--py37-plus"] | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: "v0.2.1" | ||
hooks: | ||
- id: ruff | ||
args: ["--fix", "--show-fixes"] | ||
- id: ruff-format | ||
|
||
# - repo: https://github.com/hadialqattan/pycln | ||
# rev: v1.1.0 | ||
# hooks: | ||
# - id: pycln | ||
# args: [--config=pyproject.toml] | ||
# TODO: Enable type checking | ||
# - repo: https://github.com/pre-commit/mirrors-mypy | ||
# rev: "v1.8.0" | ||
# hooks: | ||
# - id: mypy | ||
# files: src|tests | ||
# args: [] | ||
# additional_dependencies: | ||
# - pytest | ||
|
||
- repo: https://github.com/asottile/yesqa | ||
rev: v1.4.0 | ||
hooks: | ||
- id: yesqa | ||
exclude: docs/conf.py | ||
additional_dependencies: &flake8_dependencies | ||
- flake8-bugbear | ||
- flake8-print | ||
- repo: https://github.com/codespell-project/codespell | ||
rev: "v2.2.6" | ||
hooks: | ||
- id: codespell | ||
|
||
- repo: https://github.com/pycqa/flake8 | ||
rev: 6.0.0 | ||
hooks: | ||
- id: flake8 | ||
exclude: docs/conf.py | ||
additional_dependencies: *flake8_dependencies | ||
- repo: https://github.com/shellcheck-py/shellcheck-py | ||
rev: "v0.9.0.6" | ||
hooks: | ||
- id: shellcheck | ||
|
||
# - repo: https://github.com/pre-commit/mirrors-mypy | ||
# rev: v0.930 | ||
# hooks: | ||
# - id: mypy | ||
# files: src | ||
# args: [--show-error-codes] | ||
- repo: local | ||
hooks: | ||
- id: disallow-caps | ||
name: Disallow improper capitalization | ||
language: pygrep | ||
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest | ||
exclude: .pre-commit-config.yaml | ||
|
||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.2.2 | ||
hooks: | ||
- id: codespell | ||
- repo: https://github.com/abravalheri/validate-pyproject | ||
rev: "v0.16" | ||
hooks: | ||
- id: validate-pyproject | ||
additional_dependencies: ["validate-pyproject-schema-store[all]"] | ||
|
||
- repo: https://github.com/shellcheck-py/shellcheck-py | ||
rev: v0.9.0.2 | ||
hooks: | ||
- id: shellcheck | ||
|
||
- repo: local | ||
hooks: | ||
- id: disallow-caps | ||
name: Disallow improper capitalization | ||
language: pygrep | ||
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest | ||
exclude: .pre-commit-config.yaml | ||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: "0.28.0" | ||
hooks: | ||
- id: check-dependabot | ||
- id: check-github-workflows | ||
- id: check-readthedocs |
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
Oops, something went wrong.