From fb16c52699cfa5efa9d9a66a71fe5ce9952270ed Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 15:24:57 +0100 Subject: [PATCH 01/20] style fixes --- pyproject.toml | 22 +++++----------------- template/utils/_docs.py | 8 ++++---- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 51b73adf..572b0672 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,10 +65,9 @@ full = [ ] style = [ 'bibclean', - 'black', 'codespell', 'isort', - 'pydocstyle[toml]', + 'mypy', 'ruff', 'toml-sort', 'yamllint', @@ -88,21 +87,6 @@ homepage = 'https://github.com/mscheltienne/template-python' source = 'https://github.com/mscheltienne/template-python' tracker = 'https://github.com/mscheltienne/template-python/issues' -[tool.black] -extend-exclude = ''' -( - __pycache__ - | .github - | setup.py - | doc/ - | examples/ - | tutorials/ -) -''' -include = '\.pyi?$' -line-length = 88 -target-version = ['py39'] - [tool.coverage.report] exclude_lines = [ 'if __name__ == .__main__.:', @@ -152,10 +136,14 @@ extend-exclude = [ 'setup.py', ] line-length = 88 +target-version = 'py39' [tool.ruff.per-file-ignores] '__init__.py' = ['F401'] +[tool.ruff.format] +docstring-code-format = true + [tool.setuptools] include-package-data = false diff --git a/template/utils/_docs.py b/template/utils/_docs.py index 70caba3c..b8430c31 100644 --- a/template/utils/_docs.py +++ b/template/utils/_docs.py @@ -75,16 +75,16 @@ def fill_doc(f: Callable[..., Any]) -> Callable[..., Any]: def _indentcount_lines(lines: list[str]) -> int: """Minimum indent for all lines in line list. - >>> lines = [' one', ' two', ' three'] + >>> lines = [" one", " two", " three"] >>> indentcount_lines(lines) 1 >>> lines = [] >>> indentcount_lines(lines) 0 - >>> lines = [' one'] + >>> lines = [" one"] >>> indentcount_lines(lines) 1 - >>> indentcount_lines([' ']) + >>> indentcount_lines([" "]) 0 """ indent = sys.maxsize @@ -125,7 +125,7 @@ def copy_doc(source: Callable[..., Any]) -> Callable[..., Any]: >>> class B(A): ... @copy_doc(A.m1) ... def m1(): - ... ''' this gets appended''' + ... '''this gets appended''' ... pass >>> print(B.m1.__doc__) Docstring for m1 this gets appended From a61622059a2fd28e26b4967d1c7ec15dcc50650d Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 15:25:08 +0100 Subject: [PATCH 02/20] use ruff --- .pre-commit-config.yaml | 23 +++++++---------------- pyproject.toml | 1 + 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 71eb6acf..1b3c515f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ ci: - skip: [codespell, pydocstyle, yamllint] + skip: [codespell, yamllint] repos: - repo: https://github.com/pycqa/isort @@ -8,18 +8,16 @@ repos: - id: isort files: template - - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.12.0 - hooks: - - id: black - args: [--quiet] - files: template - - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.1.8 hooks: - id: ruff - args: [--fix, --exit-non-zero-on-fix] + name: ruff linter + args: [--fix, --config=pyproject.toml] + files: template + - id: ruff-format + name: ruff formatter + args: [--config=pyproject.toml] files: template - repo: https://github.com/codespell-project/codespell @@ -28,13 +26,6 @@ repos: - id: codespell args: [--check-filenames, --ignore-words=.codespellignore] - - repo: https://github.com/pycqa/pydocstyle - rev: 6.3.0 - hooks: - - id: pydocstyle - files: template - additional_dependencies: [tomli] - - repo: https://github.com/mscheltienne/bibclean rev: 0.8.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 572b0672..98de97d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -136,6 +136,7 @@ extend-exclude = [ 'setup.py', ] line-length = 88 +select = ["E", "F", "W"] target-version = 'py39' [tool.ruff.per-file-ignores] From 207be11994680a705b5c469cde1b596b09d6d3cc Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 15:26:15 +0100 Subject: [PATCH 03/20] fix --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 98de97d8..f996dfe9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -139,12 +139,12 @@ line-length = 88 select = ["E", "F", "W"] target-version = 'py39' -[tool.ruff.per-file-ignores] -'__init__.py' = ['F401'] - [tool.ruff.format] docstring-code-format = true +[tool.ruff.per-file-ignores] +'__init__.py' = ['F401'] + [tool.setuptools] include-package-data = false From 5aabfef9585003e187e7a592e267a346a4ff9215 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 14:27:31 +0000 Subject: [PATCH 04/20] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- template/utils/_docs.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/template/utils/_docs.py b/template/utils/_docs.py index b8430c31..ca8de61f 100644 --- a/template/utils/_docs.py +++ b/template/utils/_docs.py @@ -16,9 +16,7 @@ docdict: dict[str, str] = dict() # ---------------------------------- verbose --------------------------------- -docdict[ - "verbose" -] = """ +docdict["verbose"] = """ verbose : int | str | bool | None Sets the verbosity level. The verbosity increases gradually between ``"CRITICAL"``, ``"ERROR"``, ``"WARNING"``, ``"INFO"`` and ``"DEBUG"``. If None is provided, the From 5442ed72505301dd80e82471b05eb77f45f1587b Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 15:31:40 +0100 Subject: [PATCH 05/20] de-duplicate code-style workflows --- .github/workflows/code-style.yaml | 12 ------------ .pre-commit-config.yaml | 9 ++++++++- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/code-style.yaml b/.github/workflows/code-style.yaml index 06f9d560..da53e1d0 100644 --- a/.github/workflows/code-style.yaml +++ b/.github/workflows/code-style.yaml @@ -24,14 +24,6 @@ jobs: run: | python -m pip install --progress-bar off --upgrade pip setuptools python -m pip install --progress-bar off .[style] - - name: Run isort - uses: isort/isort-action@master - - name: Run black - uses: psf/black@stable - with: - options: "--check --verbose" - - name: Run Ruff - run: ruff check . - name: Run codespell uses: codespell-project/actions-codespell@master with: @@ -41,9 +33,5 @@ jobs: ignore_words_file: ./.codespellignore - name: Run pydocstyle run: pydocstyle . - - name: Run bibclean - run: bibclean-check doc/references.bib - - name: Run toml-sort - run: toml-sort pyproject.toml --check - name: Run yamllint run: yamllint . -c .yamllint.yaml --strict diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b3c515f..322e7871 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ ci: - skip: [codespell, yamllint] + skip: [codespell, pydocstyle, yamllint] repos: - repo: https://github.com/pycqa/isort @@ -26,6 +26,13 @@ repos: - id: codespell args: [--check-filenames, --ignore-words=.codespellignore] + - repo: https://github.com/pycqa/pydocstyle + rev: 6.3.0 + hooks: + - id: pydocstyle + files: template + additional_dependencies: [tomli] + - repo: https://github.com/mscheltienne/bibclean rev: 0.8.0 hooks: From 66d888c83d55e8b08e59c3591ed25bc8d6bb9420 Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 15:33:20 +0100 Subject: [PATCH 06/20] add back pydocstyle --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index f996dfe9..1f9f002f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,6 +68,7 @@ style = [ 'codespell', 'isort', 'mypy', + 'pydocstyle[toml]', 'ruff', 'toml-sort', 'yamllint', From e9c056dadf1969a25dbc4c6f0d745d113c82e53b Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 15:36:16 +0100 Subject: [PATCH 07/20] test --- .pre-commit-config.yaml | 3 +-- pyproject.toml | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 322e7871..eb7a8848 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,11 +13,10 @@ repos: hooks: - id: ruff name: ruff linter - args: [--fix, --config=pyproject.toml] + args: [--fix] files: template - id: ruff-format name: ruff formatter - args: [--config=pyproject.toml] files: template - repo: https://github.com/codespell-project/codespell diff --git a/pyproject.toml b/pyproject.toml index 1f9f002f..09cfede6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -143,9 +143,6 @@ target-version = 'py39' [tool.ruff.format] docstring-code-format = true -[tool.ruff.per-file-ignores] -'__init__.py' = ['F401'] - [tool.setuptools] include-package-data = false From fcfd9673621dea6e113848588d088cdcf3032916 Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 15:36:23 +0100 Subject: [PATCH 08/20] ete --- template/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/template/__init__.py b/template/__init__.py index 5f5bdd5f..433d7113 100644 --- a/template/__init__.py +++ b/template/__init__.py @@ -1,3 +1,5 @@ from ._version import __version__ # noqa: F401 from .utils.config import sys_info # noqa: F401 from .utils.logs import add_file_handler, logger, set_log_level # noqa: F401 + +import time From 0aa02b38e02fa39ceb57c6c3d7223fd38a83af05 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 14:37:10 +0000 Subject: [PATCH 09/20] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- template/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/template/__init__.py b/template/__init__.py index 433d7113..5f5bdd5f 100644 --- a/template/__init__.py +++ b/template/__init__.py @@ -1,5 +1,3 @@ from ._version import __version__ # noqa: F401 from .utils.config import sys_info # noqa: F401 from .utils.logs import add_file_handler, logger, set_log_level # noqa: F401 - -import time From 790c527d02a31b4f513e947fb9fda12328565d2b Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 15:36:51 +0100 Subject: [PATCH 10/20] add back rule --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 09cfede6..1f9f002f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -143,6 +143,9 @@ target-version = 'py39' [tool.ruff.format] docstring-code-format = true +[tool.ruff.per-file-ignores] +'__init__.py' = ['F401'] + [tool.setuptools] include-package-data = false From a804f801a88c5475f2d93ddb4cfdfb7ad58b0d79 Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 15:40:05 +0100 Subject: [PATCH 11/20] add ruff badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0db66652..07680413 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/) +[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![codecov](https://codecov.io/gh/mscheltienne/template-python/branch/main/graph/badge.svg?token=KRYRRUXDYY)](https://codecov.io/gh/mscheltienne/template-python) [![tests](https://github.com/mscheltienne/template-python/actions/workflows/pytest.yaml/badge.svg?branch=main)](https://github.com/mscheltienne/template-python/actions/workflows/pytest.yaml) [![doc](https://github.com/mscheltienne/template-python/actions/workflows/doc.yaml/badge.svg?branch=main)](https://github.com/mscheltienne/template-python/actions/workflows/doc.yaml) From 58f8d3ec5289123c50da253659ad743716328c69 Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 15:40:46 +0100 Subject: [PATCH 12/20] bettre first --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 07680413..71f7f3bb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ +[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/) -[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![codecov](https://codecov.io/gh/mscheltienne/template-python/branch/main/graph/badge.svg?token=KRYRRUXDYY)](https://codecov.io/gh/mscheltienne/template-python) [![tests](https://github.com/mscheltienne/template-python/actions/workflows/pytest.yaml/badge.svg?branch=main)](https://github.com/mscheltienne/template-python/actions/workflows/pytest.yaml) [![doc](https://github.com/mscheltienne/template-python/actions/workflows/doc.yaml/badge.svg?branch=main)](https://github.com/mscheltienne/template-python/actions/workflows/doc.yaml) From 8b331c17c0e72f8eca4e7ddac5c0a75e785bb7c1 Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 15:59:03 +0100 Subject: [PATCH 13/20] try --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 8 +++++++- template/utils/logs.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eb7a8848..f94e0cc0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ ci: - skip: [codespell, pydocstyle, yamllint] + skip: [pydocstyle, yamllint] repos: - repo: https://github.com/pycqa/isort @@ -23,7 +23,7 @@ repos: rev: v2.2.6 hooks: - id: codespell - args: [--check-filenames, --ignore-words=.codespellignore] + args: [--write-changes] - repo: https://github.com/pycqa/pydocstyle rev: 6.3.0 diff --git a/pyproject.toml b/pyproject.toml index 1f9f002f..bfa9d0ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,7 +65,7 @@ full = [ ] style = [ 'bibclean', - 'codespell', + 'codespell[toml]>=2.2.4', 'isort', 'mypy', 'pydocstyle[toml]', @@ -88,6 +88,12 @@ homepage = 'https://github.com/mscheltienne/template-python' source = 'https://github.com/mscheltienne/template-python' tracker = 'https://github.com/mscheltienne/template-python/issues' +[tool.codespell] +check-hidden = true +check-filenames = true +ignore-words = '.codespellignore' +skip = 'build,.git,.mypy_cache,.pytest_cache' + [tool.coverage.report] exclude_lines = [ 'if __name__ == .__main__.:', diff --git a/template/utils/logs.py b/template/utils/logs.py index 07415453..e658ad48 100644 --- a/template/utils/logs.py +++ b/template/utils/logs.py @@ -82,7 +82,7 @@ def set_log_level(verbose: Optional[Union[bool, str, int]]) -> None: class _LoggerFormatter(logging.Formatter): - """Format string Syntax.""" + """Format string snytax.""" # Format string syntax for the different Log levels _formatters = dict() From 07a3b0ae7e44a6245c5cb290e72672de8c435040 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:00:03 +0000 Subject: [PATCH 14/20] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyproject.toml | 2 +- template/utils/logs.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bfa9d0ae..661f216c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,8 +89,8 @@ source = 'https://github.com/mscheltienne/template-python' tracker = 'https://github.com/mscheltienne/template-python/issues' [tool.codespell] -check-hidden = true check-filenames = true +check-hidden = true ignore-words = '.codespellignore' skip = 'build,.git,.mypy_cache,.pytest_cache' diff --git a/template/utils/logs.py b/template/utils/logs.py index e658ad48..b3ca1307 100644 --- a/template/utils/logs.py +++ b/template/utils/logs.py @@ -82,7 +82,7 @@ def set_log_level(verbose: Optional[Union[bool, str, int]]) -> None: class _LoggerFormatter(logging.Formatter): - """Format string snytax.""" + """Format string syntax.""" # Format string syntax for the different Log levels _formatters = dict() From fe50b39f04f3d6e674cf9c414c6c9cad1f77470d Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 16:00:52 +0100 Subject: [PATCH 15/20] remove codespell from style workflow --- .github/workflows/code-style.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/code-style.yaml b/.github/workflows/code-style.yaml index da53e1d0..c4727dcd 100644 --- a/.github/workflows/code-style.yaml +++ b/.github/workflows/code-style.yaml @@ -24,13 +24,6 @@ jobs: run: | python -m pip install --progress-bar off --upgrade pip setuptools python -m pip install --progress-bar off .[style] - - name: Run codespell - uses: codespell-project/actions-codespell@master - with: - check_filenames: true - check_hidden: true - skip: './.git,./build,./.mypy_cache,./.pytest_cache' - ignore_words_file: ./.codespellignore - name: Run pydocstyle run: pydocstyle . - name: Run yamllint From c7365fb2de2f7fd8f9b1f0de98f28e006689ca35 Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 16:02:27 +0100 Subject: [PATCH 16/20] test --- .pre-commit-config.yaml | 89 ++++++++++++++++++++--------------------- template/utils/logs.py | 2 +- 2 files changed, 44 insertions(+), 47 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f94e0cc0..e97c8b3e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,53 +1,50 @@ -ci: - skip: [pydocstyle, yamllint] - repos: - - repo: https://github.com/pycqa/isort - rev: 5.13.2 - hooks: - - id: isort - files: template + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + files: template - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.8 - hooks: - - id: ruff - name: ruff linter - args: [--fix] - files: template - - id: ruff-format - name: ruff formatter - files: template + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.8 + hooks: + - id: ruff + name: ruff linter + args: [--fix] + files: template + - id: ruff-format + name: ruff formatter + files: template - - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 - hooks: - - id: codespell - args: [--write-changes] + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + args: [--write-changes] - - repo: https://github.com/pycqa/pydocstyle - rev: 6.3.0 - hooks: - - id: pydocstyle - files: template - additional_dependencies: [tomli] + - repo: https://github.com/pycqa/pydocstyle + rev: 6.3.0 + hooks: + - id: pydocstyle + files: template + additional_dependencies: [tomli] - - repo: https://github.com/mscheltienne/bibclean - rev: 0.8.0 - hooks: - - id: bibclean-fix - files: doc/references.bib - args: [--exit-non-zero-on-fix] + - repo: https://github.com/mscheltienne/bibclean + rev: 0.8.0 + hooks: + - id: bibclean-fix + files: doc/references.bib + args: [--exit-non-zero-on-fix] - - repo: https://github.com/pappasam/toml-sort - rev: v0.23.1 - hooks: - - id: toml-sort-fix - files: pyproject.toml + - repo: https://github.com/pappasam/toml-sort + rev: v0.23.1 + hooks: + - id: toml-sort-fix + files: pyproject.toml - - repo: https://github.com/adrienverge/yamllint - rev: v1.33.0 - hooks: - - id: yamllint - args: [--strict, -c, .yamllint.yaml] - files: (.github/|.codecov.yaml|.pre-commit-config.yaml|.yamllint.yaml) + - repo: https://github.com/adrienverge/yamllint + rev: v1.33.0 + hooks: + - id: yamllint + args: [--strict, -c, .yamllint.yaml] + files: (.github/|.codecov.yaml|.pre-commit-config.yaml|.yamllint.yaml) diff --git a/template/utils/logs.py b/template/utils/logs.py index b3ca1307..e658ad48 100644 --- a/template/utils/logs.py +++ b/template/utils/logs.py @@ -82,7 +82,7 @@ def set_log_level(verbose: Optional[Union[bool, str, int]]) -> None: class _LoggerFormatter(logging.Formatter): - """Format string syntax.""" + """Format string snytax.""" # Format string syntax for the different Log levels _formatters = dict() From f2290db1c9cbb2e792ba120dc989ccb6cb0bcbf5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:03:15 +0000 Subject: [PATCH 17/20] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- template/utils/logs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/utils/logs.py b/template/utils/logs.py index e658ad48..b3ca1307 100644 --- a/template/utils/logs.py +++ b/template/utils/logs.py @@ -82,7 +82,7 @@ def set_log_level(verbose: Optional[Union[bool, str, int]]) -> None: class _LoggerFormatter(logging.Formatter): - """Format string snytax.""" + """Format string syntax.""" # Format string syntax for the different Log levels _formatters = dict() From 85b4d6575ce6cb0ca674f8d43f4f746298c60f9c Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 16:03:07 +0100 Subject: [PATCH 18/20] Revert "test" This reverts commit c7365fb2de2f7fd8f9b1f0de98f28e006689ca35. --- .pre-commit-config.yaml | 89 +++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e97c8b3e..f94e0cc0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,50 +1,53 @@ +ci: + skip: [pydocstyle, yamllint] + repos: - - repo: https://github.com/pycqa/isort - rev: 5.13.2 - hooks: - - id: isort - files: template + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + files: template - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.8 - hooks: - - id: ruff - name: ruff linter - args: [--fix] - files: template - - id: ruff-format - name: ruff formatter - files: template + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.8 + hooks: + - id: ruff + name: ruff linter + args: [--fix] + files: template + - id: ruff-format + name: ruff formatter + files: template - - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 - hooks: - - id: codespell - args: [--write-changes] + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + args: [--write-changes] - - repo: https://github.com/pycqa/pydocstyle - rev: 6.3.0 - hooks: - - id: pydocstyle - files: template - additional_dependencies: [tomli] + - repo: https://github.com/pycqa/pydocstyle + rev: 6.3.0 + hooks: + - id: pydocstyle + files: template + additional_dependencies: [tomli] - - repo: https://github.com/mscheltienne/bibclean - rev: 0.8.0 - hooks: - - id: bibclean-fix - files: doc/references.bib - args: [--exit-non-zero-on-fix] + - repo: https://github.com/mscheltienne/bibclean + rev: 0.8.0 + hooks: + - id: bibclean-fix + files: doc/references.bib + args: [--exit-non-zero-on-fix] - - repo: https://github.com/pappasam/toml-sort - rev: v0.23.1 - hooks: - - id: toml-sort-fix - files: pyproject.toml + - repo: https://github.com/pappasam/toml-sort + rev: v0.23.1 + hooks: + - id: toml-sort-fix + files: pyproject.toml - - repo: https://github.com/adrienverge/yamllint - rev: v1.33.0 - hooks: - - id: yamllint - args: [--strict, -c, .yamllint.yaml] - files: (.github/|.codecov.yaml|.pre-commit-config.yaml|.yamllint.yaml) + - repo: https://github.com/adrienverge/yamllint + rev: v1.33.0 + hooks: + - id: yamllint + args: [--strict, -c, .yamllint.yaml] + files: (.github/|.codecov.yaml|.pre-commit-config.yaml|.yamllint.yaml) From 74ad927d61358586e83ce7b416067cf8c3026e28 Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 19 Dec 2023 16:15:21 +0100 Subject: [PATCH 19/20] rm code-style workflow entirely --- .github/workflows/code-style.yaml | 30 ------------------------------ .pre-commit-config.yaml | 3 --- pyproject.toml | 6 +++++- 3 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/code-style.yaml diff --git a/.github/workflows/code-style.yaml b/.github/workflows/code-style.yaml deleted file mode 100644 index c4727dcd..00000000 --- a/.github/workflows/code-style.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: code-style -concurrency: - group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} - cancel-in-progress: true -on: # yamllint disable-line rule:truthy - pull_request: - push: - branches: [main] - workflow_dispatch: - -jobs: - style: - timeout-minutes: 10 - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Setup Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: '3.9' - architecture: 'x64' - - name: Install dependencies - run: | - python -m pip install --progress-bar off --upgrade pip setuptools - python -m pip install --progress-bar off .[style] - - name: Run pydocstyle - run: pydocstyle . - - name: Run yamllint - run: yamllint . -c .yamllint.yaml --strict diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f94e0cc0..2af32bc8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,3 @@ -ci: - skip: [pydocstyle, yamllint] - repos: - repo: https://github.com/pycqa/isort rev: 5.13.2 diff --git a/pyproject.toml b/pyproject.toml index 661f216c..66875b79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,12 +67,16 @@ style = [ 'bibclean', 'codespell[toml]>=2.2.4', 'isort', - 'mypy', 'pydocstyle[toml]', 'ruff', 'toml-sort', 'yamllint', ] +stubs = [ + 'isort', + 'mypy', + 'ruff', +] test = [ 'pytest', 'pytest-cov', From 042bab2b60f38a91c318a4d06d1c321a98cc8cb1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:16:09 +0000 Subject: [PATCH 20/20] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 66875b79..2f461e6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,11 @@ doc = [ full = [ 'template[all]', ] +stubs = [ + 'isort', + 'mypy', + 'ruff', +] style = [ 'bibclean', 'codespell[toml]>=2.2.4', @@ -72,11 +77,6 @@ style = [ 'toml-sort', 'yamllint', ] -stubs = [ - 'isort', - 'mypy', - 'ruff', -] test = [ 'pytest', 'pytest-cov',