Skip to content

Commit

Permalink
Swap out isort/flake8 in favor of ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
jpolchlo committed Mar 21, 2023
1 parent 3a9a5f1 commit 301ee83
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
11 changes: 3 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ PySTAC-Client uses
- `black <https://github.com/psf/black>`_ for Python code formatting
- `codespell <https://github.com/codespell-project/codespell/>`_ to check code for common misspellings
- `doc8 <https://github.com/pycqa/doc8>`__ for style checking on RST files in the docs
- `flake8 <https://flake8.pycqa.org/en/latest/>`_ for Python style checks
- `ruff <https://beta.ruff.rs/docs/>`_ for Python style checks
- `mypy <http://www.mypy-lang.org/>`_ for Python type annotation checks

Run all of these with ``pre-commit run --all-files`` or a single one using
Expand Down
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"]
1 change: 0 additions & 1 deletion pystac_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
__all__ = [
"Client",
"CollectionClient",
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -20,4 +20,4 @@ doc8~=1.1.1
pre-commit==3.2.0

# optional dependencies
orjson==3.8.7
orjson==3.8.7
3 changes: 1 addition & 2 deletions scripts/format
Original file line number Diff line number Diff line change
Expand Up @@ -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
fi
4 changes: 2 additions & 2 deletions scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -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
fi
8 changes: 0 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 301ee83

Please sign in to comment.