diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 03883b5f73609c1384b1d23def84e15bee3f4679..0000000000000000000000000000000000000000 --- a/.flake8 +++ /dev/null @@ -1,13 +0,0 @@ -[flake8] -exclude = - .venv - __pycache__ - notebooks - .ipynb_checkpoints - examples -# Recommend matching the black line length (default 88), -# rather than using the flake8 default of 79: -max-line-length = 88 -extend-ignore = - # See https://github.com/PyCQA/pycodestyle/issues/373 - E203, diff --git a/.gitignore b/.gitignore index f888afc8f4631c36e339a13905f47f432eed51ba..0900a937e6bbf43d8d39a2952ee76c38bf8a1b42 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ coverage.xml *.py,cover .hypothesis/ .pytest_cache/ +.ruff_cache # Translations *.mo diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7e43d3b057d0ed4e43480a28db50db806ce01eaa --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.243 + hooks: + - id: ruff diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ab185fe3db6842959e49d0b621451738291b650d..4dcd73cfe1a9d620b164fc07d95c2fbad32ba8f4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,7 +53,13 @@ You can format and lint your changes with the following commands in the root dir make format; make lint ``` -We run an assortment of linters: `black`, `isort`, `mypy`, `flake8`. +You can also make use of our pre-commit hooks by setting up git hook scripts: + +```bash +pre-commit install +``` + +We run an assortment of linters: `black`, `ruff`, `mypy`. ### Testing diff --git a/Makefile b/Makefile index 11f224f37191e11c667b547a80d4dafa15eae1a1..eb1e3c09ab32b5fd687a9c6a1d12afe25f3cf070 100644 --- a/Makefile +++ b/Makefile @@ -2,13 +2,11 @@ format: black . - isort . lint: mypy . black . --check - isort . --check - flake8 . + ruff check . test: - pytest tests \ No newline at end of file + pytest tests diff --git a/pyproject.toml b/pyproject.toml index dd8bdcdb7fe30420f3957e5f27152b534ca9c99e..8e44e5b0c360bcbf5a8b7d74eb2b760daa8837fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,15 @@ -[tool.isort] -profile = "black" - [tool.mypy] ignore_missing_imports = "True" disallow_untyped_defs = "True" exclude = ["notebooks", "build", "examples"] + +[tool.ruff] +exclude = [ + ".venv", + "__pycache__", + ".ipynb_checkpoints", + ".mypy_cache", + ".ruff_cache", + "examples", + "notebooks", +] diff --git a/requirements.txt b/requirements.txt index fc1e2aeaf7c6594749406ecef30eac2b6234d6b5..f58524987425f699e2b90d4a88e0c2ba3cbcfc09 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,8 +14,7 @@ types-setuptools==67.1.0.0 # linting black==22.12.0 -isort==5.11.4 mypy==0.991 -flake8==6.0.0 -flake8-docstrings==1.6.0 +pre-commit==3.2.0 pylint==2.15.10 +ruff==0.0.259 \ No newline at end of file