Skip to content

Commit a5c3e80

Browse files
authored
chore: switch to ruff-format from black (#1394)
1 parent d4bed27 commit a5c3e80

15 files changed

+2596
-2594
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,18 @@ repos:
1313
hooks:
1414
- id: ruff
1515
name: ruff
16-
entry: ruff
16+
entry: ruff check --force-exclude --fix --exit-non-zero-on-fix
1717
language: system
18-
stages: [commit]
19-
types: [python]
20-
args: [check, --fix, --exit-non-zero-on-fix]
18+
types_or: [python, pyi, jupyter]
19+
require_serial: true
2120

22-
- id: black
23-
name: black
24-
entry: black
21+
- id: ruff-format
22+
name: ruff-format
23+
entry: ruff format --force-exclude --check
2524
language: system
2625
stages: [commit]
27-
types: [python]
28-
29-
- id: black-jupyter
30-
name: black-jupyter
31-
entry: black
32-
language: python
26+
types_or: [python, pyi, jupyter]
3327
require_serial: true
34-
types_or: [pyi, jupyter]
35-
additional_dependencies: ["black[jupyter]"]
3628

3729
- id: codespell
3830
name: codespell

docs/conf.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,21 @@
6161

6262
extlinks = {
6363
"tutorial": (
64-
"https://github.com/stac-utils/pystac/"
65-
"tree/{}/docs/tutorials/%s".format(git_branch),
64+
"https://github.com/stac-utils/pystac/" "tree/{}/docs/tutorials/%s".format(
65+
git_branch
66+
),
6667
"%s tutorial",
6768
),
6869
"stac-spec": (
69-
"https://github.com/radiantearth/stac-spec/tree/"
70-
"v{}/%s".format(STACVersion.DEFAULT_STAC_VERSION),
70+
"https://github.com/radiantearth/stac-spec/tree/" "v{}/%s".format(
71+
STACVersion.DEFAULT_STAC_VERSION
72+
),
7173
"%s path",
7274
),
7375
"stac-api-spec": (
74-
"https://github.com/radiantearth/stac-api-spec/tree/"
75-
"v{}/%s".format(STACVersion.DEFAULT_STAC_API_VERSION),
76+
"https://github.com/radiantearth/stac-api-spec/tree/" "v{}/%s".format(
77+
STACVersion.DEFAULT_STAC_API_VERSION
78+
),
7679
"%s path",
7780
),
7881
"stac-ext": ("https://github.com/stac-extensions/%s", "%s extension"),

docs/contributing.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,13 @@ tl;dr: Run ``pre-commit install --overwrite`` to perform checks when committing,
5454
PySTAC uses
5555

5656
- `ruff <https://github.com/charliermarsh/ruff>`_ for Python code linting
57-
- `black <https://github.com/psf/black>`_ for Python code formatting
5857
- `codespell <https://github.com/codespell-project/codespell/>`_ to check code for common misspellings
5958
- `doc8 <https://github.com/pycqa/doc8>`__ for style checking on RST files in the docs
6059
- `mypy <http://www.mypy-lang.org/>`_ for Python type annotation checks
6160

6261
Run all of these with ``pre-commit run --all-files`` or a single one using
6362
``pre-commit run --all-files ID``, where ``ID`` is one of the command names above. For
64-
example, to format all the Python code, run ``pre-commit run --all-files black``.
63+
example, to lint all the Python code, run ``pre-commit run --all-files ruff``.
6564

6665
You can also install a Git pre-commit hook which will run the relevant linters and
6766
formatters on any staged code when committing. This will be much faster than running on

docs/tutorials/adding-new-and-custom-extensions.ipynb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,20 @@
2424
"metadata": {},
2525
"outputs": [],
2626
"source": [
27-
"from typing import Literal\n",
2827
"from datetime import datetime, timedelta\n",
2928
"from pprint import pprint\n",
30-
"from typing import Any, Dict, List, Optional, Union\n",
29+
"from typing import Any, Dict, List, Literal, Optional, Union\n",
3130
"from uuid import uuid4\n",
3231
"\n",
3332
"import pystac\n",
33+
"from pystac.extensions.base import ExtensionManagementMixin, PropertiesExtension\n",
3434
"from pystac.utils import (\n",
3535
" StringEnum,\n",
3636
" datetime_to_str,\n",
3737
" get_required,\n",
3838
" map_opt,\n",
3939
" str_to_datetime,\n",
40-
")\n",
41-
"from pystac.extensions.base import PropertiesExtension, ExtensionManagementMixin"
40+
")"
4241
]
4342
},
4443
{

0 commit comments

Comments
 (0)