diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ad2e4fe..17afa7e 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"] diff --git a/newfile2 b/newfile2 deleted file mode 100644 index 345e6ae..0000000 --- a/newfile2 +++ /dev/null @@ -1 +0,0 @@ -Test diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2b9b214 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,58 @@ +# SPDX-FileCopyrightText: 2022 Fermi Research Alliance, LLC +# SPDX-License-Identifier: Apache-2.0 + +[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] +lint.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 +] +lint.extend-ignore = [ + "PLR", # Design related pylint codes + "E501", # Line too long + "PT004", # Use underscore for non-returning fixture (use usefixture instead) +] +lint.typing-modules = ["mypackage._compat.typing"] +src = ["src"] +lint.unfixable = [ + "T20", # Removes print statements + "F841", # Removes unused variables +] +exclude = [] +lint.flake8-unused-arguments.ignore-variadic-names = true +lint.isort.required-imports = ["from __future__ import annotations"] + +[tool.ruff.lint.per-file-ignores] +"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