diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fe938953..137e4dbf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,15 +19,10 @@ repos: args: [--ignore=D004] additional_dependencies: - importlib_metadata < 5; python_version == "3.7" - - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: 'v0.0.257' hooks: - - id: flake8 - - repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - name: isort (python) + - id: ruff - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.991 hooks: diff --git a/docs/contributing.rst b/docs/contributing.rst index 1b481796..76a22ae6 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -57,7 +57,7 @@ PySTAC-Client uses - `black `_ for Python code formatting - `codespell `_ to check code for common misspellings - `doc8 `__ for style checking on RST files in the docs -- `flake8 `_ for Python style checks +- `ruff `_ for Python style checks - `mypy `_ for Python type annotation checks Run all of these with ``pre-commit run --all-files`` or a single one using diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..4b149869 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.ruff] +ignore = [ + "E722", + "E731", +] +line-length = 88 +select = [ + "E", + "F", + "W", +] + +[tool.ruff.per-file-ignores] +"__init__.py" = ["F401"] +"test_item_search.py" = ["E501"] diff --git a/pystac_client/__init__.py b/pystac_client/__init__.py index 9e37dfcb..b04c5bae 100644 --- a/pystac_client/__init__.py +++ b/pystac_client/__init__.py @@ -1,4 +1,3 @@ -# flake8: noqa __all__ = [ "Client", "CollectionClient", diff --git a/requirements-dev.txt b/requirements-dev.txt index 9d6cdf95..bc4223e6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -9,7 +9,7 @@ requests-mock~=1.10.0 mypy~=1.1 types-requests~=2.28.11 types-python-dateutil~=2.8.19 -flake8~=6.0.0 +ruff==0.0.257 black~=23.1.0 codespell~=2.2.4 @@ -20,4 +20,4 @@ doc8~=1.1.1 pre-commit==3.2.0 # optional dependencies -orjson==3.8.7 \ No newline at end of file +orjson==3.8.7 diff --git a/scripts/format b/scripts/format index 26a03c60..6b605b10 100755 --- a/scripts/format +++ b/scripts/format @@ -18,6 +18,5 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then usage else pre-commit run black --all-files - pre-commit run isort --all-files fi -fi \ No newline at end of file +fi diff --git a/scripts/lint b/scripts/lint index 186109cd..82cb119e 100755 --- a/scripts/lint +++ b/scripts/lint @@ -19,7 +19,7 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then else pre-commit run codespell --all-files pre-commit run doc8 --all-files - pre-commit run flake8 --all-files + pre-commit run ruff --all-files pre-commit run mypy --all-files fi -fi \ No newline at end of file +fi diff --git a/setup.cfg b/setup.cfg index 71c8fb9c..3f37514d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,18 +1,10 @@ [metadata] license_file = LICENSE -[isort] -profile=black - [doc8] ignore-path=docs/_build,docs/tutorials max-line-length=130 -[flake8] -max-line-length = 88 -extend-ignore = E203, W503, E731, E722 -per-file-ignores = __init__.py:F401,test_item_search.py:E501 - [tool:pytest] markers = vcr: records network activity