From 5d034e6d7bd859a872cfec4222e5e0a232f27157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20A=2E=20Fidalgo-Rodr=C3=ADguez?= Date: Mon, 27 May 2024 01:28:11 -0400 Subject: [PATCH 1/5] add pyproject.toml and change pre-commit --- .pre-commit-config.yaml | 28 +++++---------------- pyproject.toml | 55 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 22 deletions(-) create mode 100644 pyproject.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ad2e4fe..b44a98b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,18 +20,8 @@ repos: - id: trailing-whitespace args: - "--markdown-linebreak-ext=md" - - repo: "https://github.com/pre-commit/pygrep-hooks" - rev: v1.9.0 - hooks: - - id: python-check-blanket-noqa - - id: python-check-blanket-type-ignore - - id: python-use-type-annotations - - repo: "https://github.com/pycqa/isort" - rev: 5.10.1 - hooks: - - id: isort - - repo: "https://github.com/psf/black" - rev: 22.3.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: "23.9.1" hooks: - id: black - repo: "https://github.com/pre-commit/mirrors-prettier" @@ -49,14 +39,8 @@ repos: - id: pyupgrade args: - "--py36-plus" - - repo: https://github.com/pycqa/pylint - # 2.13.9 is the last version supporting Python 3.6 - rev: v2.13.9 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.4.5" hooks: - - id: pylint - - repo: "https://github.com/fsfe/reuse-tool" - rev: v0.14.0 - hooks: - - id: reuse - additional_dependencies: - - python-debian==0.1.40 + - id: ruff + args: ["--fix", "--show-fixes"] \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..483022a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,55 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "planetsmath" +requires-python = ">= 3.8" +version = "0.0.1" +description = "Lovely Spam! Wonderful Spam!" +readme = "README.md" +license = {file = "LICENSE"} + +[tool.ruff] +select = [ + "E", "F", "W", # flake8 + "B", # flake8-bugbear + "I", # isort + "ARG", # flake8-unused-arguments + "C4", # flake8-comprehensions + "EM", # flake8-errmsg + "ICN", # flake8-import-conventions + "ISC", # flake8-implicit-str-concat + "G", # flake8-logging-format + "PGH", # pygrep-hooks + "PIE", # flake8-pie + "PL", # pylint + "PT", # flake8-pytest-style + "PTH", # flake8-use-pathlib + "RET", # flake8-return + "RUF", # Ruff-specific + "SIM", # flake8-simplify + "T20", # flake8-print + "UP", # pyupgrade + "YTT", # flake8-2020 + "EXE", # flake8-executable + "NPY", # NumPy specific rules + "PD", # pandas-vet +] +extend-ignore = [ + "PLR", # Design related pylint codes + "E501", # Line too long + "PT004", # Use underscore for non-returning fixture (use usefixture instead) +] +typing-modules = ["mypackage._compat.typing"] +src = ["src"] +unfixable = [ + "T20", # Removes print statements + "F841", # Removes unused variables +] +exclude = [] +flake8-unused-arguments.ignore-variadic-names = true +isort.required-imports = ["from __future__ import annotations"] + +[tool.ruff.per-file-ignores] +"tests/**" = ["T20"] \ No newline at end of file From c1003a71fb8feb4b9ec603b81e31ba4223c03ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20A=2E=20Fidalgo-Rodr=C3=ADguez?= Date: Mon, 27 May 2024 01:31:12 -0400 Subject: [PATCH 2/5] delete file --- newfile2 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 newfile2 diff --git a/newfile2 b/newfile2 deleted file mode 100644 index 345e6ae..0000000 --- a/newfile2 +++ /dev/null @@ -1 +0,0 @@ -Test From 411e35173a4b2be49bd12dad1e6bd37c75abd521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20A=2E=20Fidalgo-Rodr=C3=ADguez?= Date: Mon, 27 May 2024 01:34:31 -0400 Subject: [PATCH 3/5] add licensing text --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 483022a..f21e5d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2022 Fermi Research Alliance, LLC +# SPDX-License-Identifier: Apache-2.0 + [build-system] requires = ["hatchling"] build-backend = "hatchling.build" From ed1c6eeebc49da14ddfcaf1badec3f22dbdac175 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 05:39:23 +0000 Subject: [PATCH 4/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .pre-commit-config.yaml | 2 +- pyproject.toml | 2 +- setup.py | 1 + src/planetsmath/functions.py | 1 + src/planetsmath/test_functions.py | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b44a98b..17afa7e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,4 +43,4 @@ repos: rev: "v0.4.5" hooks: - id: ruff - args: ["--fix", "--show-fixes"] \ No newline at end of file + args: ["--fix", "--show-fixes"] diff --git a/pyproject.toml b/pyproject.toml index f21e5d2..222d894 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,4 +55,4 @@ flake8-unused-arguments.ignore-variadic-names = true isort.required-imports = ["from __future__ import annotations"] [tool.ruff.per-file-ignores] -"tests/**" = ["T20"] \ No newline at end of file +"tests/**" = ["T20"] diff --git a/setup.py b/setup.py index 9382ce1..861d9d0 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ # SPDX-FileCopyrightText: 2022 Fermi Research Alliance, LLC # SPDX-License-Identifier: Apache-2.0 +from __future__ import annotations from setuptools import setup diff --git a/src/planetsmath/functions.py b/src/planetsmath/functions.py index 02e76fe..056a04f 100644 --- a/src/planetsmath/functions.py +++ b/src/planetsmath/functions.py @@ -1,5 +1,6 @@ # SPDX-FileCopyrightText: 2022 Fermi Research Alliance, LLC # SPDX-License-Identifier: Apache-2.0 +from __future__ import annotations def sum_function(list): diff --git a/src/planetsmath/test_functions.py b/src/planetsmath/test_functions.py index a81a26d..a23effb 100644 --- a/src/planetsmath/test_functions.py +++ b/src/planetsmath/test_functions.py @@ -1,5 +1,6 @@ # SPDX-FileCopyrightText: 2022 Fermi Research Alliance, LLC # SPDX-License-Identifier: Apache-2.0 +from __future__ import annotations from .functions import sum_function From ed17db7ff127347157152bb144ab1630f53223d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20A=2E=20Fidalgo-Rodr=C3=ADguez?= Date: Mon, 27 May 2024 01:47:13 -0400 Subject: [PATCH 5/5] Update pyproject.toml --- pyproject.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 222d894..2b9b214 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ readme = "README.md" license = {file = "LICENSE"} [tool.ruff] -select = [ +lint.select = [ "E", "F", "W", # flake8 "B", # flake8-bugbear "I", # isort @@ -39,20 +39,20 @@ select = [ "NPY", # NumPy specific rules "PD", # pandas-vet ] -extend-ignore = [ +lint.extend-ignore = [ "PLR", # Design related pylint codes "E501", # Line too long "PT004", # Use underscore for non-returning fixture (use usefixture instead) ] -typing-modules = ["mypackage._compat.typing"] +lint.typing-modules = ["mypackage._compat.typing"] src = ["src"] -unfixable = [ +lint.unfixable = [ "T20", # Removes print statements "F841", # Removes unused variables ] exclude = [] -flake8-unused-arguments.ignore-variadic-names = true -isort.required-imports = ["from __future__ import annotations"] +lint.flake8-unused-arguments.ignore-variadic-names = true +lint.isort.required-imports = ["from __future__ import annotations"] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "tests/**" = ["T20"]