Skip to content

Commit 5683bb3

Browse files
committed
Revert "LINT - Run updated pre-commit hooks (#2049)"
This reverts commit f6102b4.
1 parent 6e492c2 commit 5683bb3

38 files changed

+125
-241
lines changed

.git-blame-ignore-revs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-blameignoreRevsFile
66
# https://github.com/pydata/pydata-sphinx-theme/pull/713
77
#
8-
90550b66ace16a370caa446e54698b126fda740b # initial black-format
9-
236d4c6d1f10f5da064d929e9eb594daecf23551 # apply black 20.8b1 format
10-
69f1a42a3b184f4ba4c98f1745779a277d56c5e2 # [pre-commit.ci] Automatic linting and formatting fixes
11-
a35529c9ee8d5863613df40787cda0021b3e0128 # Manual fixes for stylelint
12-
ce583b8f3136d52e8056c9a651bf6f92e7922f79 # Manual adjustments to autofixes
13-
d1ee9eb7a132cde51433e9594513319fdab41f2f # Autofix (stylelint)
14-
0f3aa5ca174fe1534ef4817d42f0e2ffa7d9d921 # [pre-commit.ci] Automatic linting and formatting fixes
15-
9c5a3d592d03849bd050fe946b246145ad171605 # Automated and manual fixes for pre-commits
8+
90550b66ace16a370caa446e54698b126fda740b # initial black-format
9+
236d4c6d1f10f5da064d929e9eb594daecf23551 # apply black 20.8b1 format
10+
69f1a42a3b184f4ba4c98f1745779a277d56c5e2 # [pre-commit.ci] Automatic linting and formatting fixes
11+
a35529c9ee8d5863613df40787cda0021b3e0128 # Manual fixes for stylelint
12+
ce583b8f3136d52e8056c9a651bf6f92e7922f79 # Manual adjustments to autofixes
13+
d1ee9eb7a132cde51433e9594513319fdab41f2f # Autofix (stylelint)

.pre-commit-config.yaml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,41 @@ ci:
99
# Fix the node version to avoid a GLIBC error
1010
# ref: https://stackoverflow.com/questions/71939099/bitbucket-pipeline-error-installing-pre-commit-ts-lint/71940852#71940852
1111
default_language_version:
12-
node: 22.9.0
12+
node: 16.14.2
1313

1414
repos:
15-
- repo: "https://github.com/pycontribs/mirrors-prettier"
16-
rev: v3.3.3
15+
- repo: https://github.com/pre-commit/mirrors-prettier
16+
rev: v4.0.0-alpha.8
1717
hooks:
1818
- id: prettier
1919
# Exclude the HTML, since it doesn't understand Jinja2
2020
# exclude also the webpack.config.js file has it embed complete url dificult to prettify
2121
# exclude the pytest-regressions folder tests/test_ally
2222
exclude: .+\.html|webpack\.config\.js|tests/test_a11y/
2323

24-
- repo: "https://github.com/astral-sh/ruff-pre-commit"
24+
- repo: https://github.com/psf/black
25+
rev: 24.10.0
26+
hooks:
27+
- id: black
28+
29+
- repo: https://github.com/astral-sh/ruff-pre-commit
2530
rev: "v0.7.2"
2631
hooks:
2732
- id: ruff
28-
args: [--exit-non-zero-on-fix]
29-
- id: ruff-format
3033

31-
- repo: "https://github.com/asottile/pyupgrade"
34+
- repo: https://github.com/asottile/pyupgrade
3235
rev: v3.19.0
3336
hooks:
3437
- id: pyupgrade
3538
args: [--py37-plus]
3639

37-
- repo: "https://github.com/Riverside-Healthcare/djLint"
40+
- repo: https://github.com/Riverside-Healthcare/djLint
3841
rev: v1.35.4
3942
hooks:
4043
- id: djlint-jinja
4144
types_or: ["html"]
4245

43-
- repo: "https://github.com/PyCQA/doc8"
46+
- repo: https://github.com/PyCQA/doc8
4447
rev: v1.1.2
4548
hooks:
4649
- id: doc8
@@ -50,12 +53,12 @@ repos:
5053
hooks:
5154
- id: nbstripout
5255

53-
- repo: "https://github.com/mondeja/pre-commit-po-hooks"
56+
- repo: https://github.com/mondeja/pre-commit-po-hooks
5457
rev: v1.7.3
5558
hooks:
5659
- id: remove-metadata
5760

58-
- repo: "https://github.com/thibaudcolas/pre-commit-stylelint"
61+
- repo: https://github.com/thibaudcolas/pre-commit-stylelint
5962
rev: v16.10.0
6063
hooks:
6164
- id: stylelint
@@ -65,9 +68,3 @@ repos:
6568
# stylelint itself needs to be here when using additional_dependencies.
6669
6770
68-
69-
- repo: "https://github.com/pre-commit/pre-commit-hooks"
70-
rev: v5.0.0
71-
hooks:
72-
- id: trailing-whitespace
73-
- id: end-of-file-fixer

docs/_extension/component_directive.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"""
77

88
import re
9-
109
from pathlib import Path
1110
from typing import Any, Dict, List
1211

@@ -15,7 +14,6 @@
1514
from sphinx.util import logging
1615
from sphinx.util.docutils import SphinxDirective
1716

18-
1917
logger = logging.getLogger(__name__)
2018

2119

docs/_extension/gallery_directive.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from sphinx.util.docutils import SphinxDirective
2020
from yaml import safe_load
2121

22-
2322
logger = logging.getLogger(__name__)
2423

2524

@@ -77,7 +76,7 @@ def run(self) -> List[nodes.Node]:
7776
path_doc = Path(path_doc).parent
7877
path_data = (path_doc / path_data_rel).resolve()
7978
if not path_data.exists():
80-
logger.info("Could not find grid data at %s.", path_data)
79+
logger.info(f"Could not find grid data at {path_data}.")
8180
nodes.text("No grid data found at {path_data}.")
8281
return
8382
yaml_string = path_data.read_text()

docs/conf.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# -- Path setup --------------------------------------------------------------
99
import os
1010
import sys
11-
1211
from pathlib import Path
1312
from typing import Any, Dict
1413

@@ -17,7 +16,6 @@
1716

1817
import pydata_sphinx_theme
1918

20-
2119
sys.path.append(str(Path(".").resolve()))
2220

2321
# -- Project information -----------------------------------------------------
@@ -194,8 +192,7 @@
194192
},
195193
"use_edit_page_button": True,
196194
"show_toc_level": 1,
197-
# [left, content, right] For testing that the navbar items align properly
198-
"navbar_align": "left",
195+
"navbar_align": "left", # [left, content, right] For testing that the navbar items align properly
199196
# "show_nav_level": 2,
200197
"announcement": "https://raw.githubusercontent.com/pydata/pydata-sphinx-theme/main/docs/_templates/custom-template.html",
201198
"show_version_warning_banner": True,
@@ -297,15 +294,10 @@
297294
def setup_to_main(
298295
app: Sphinx, pagename: str, templatename: str, context, doctree
299296
) -> None:
300-
"""
301-
Add a function that jinja can access for returning an "edit this page" link
302-
pointing to `main`.
303-
"""
297+
"""Add a function that jinja can access for returning an "edit this page" link pointing to `main`."""
304298

305299
def to_main(link: str) -> str:
306-
"""
307-
Transform "edit on github" links and make sure they always point to the
308-
main branch.
300+
"""Transform "edit on github" links and make sure they always point to the main branch.
309301
310302
Args:
311303
link: the link to the github edit interface

docs/examples/pydata.ipynb

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"import numpy as np\n",
3030
"import pandas as pd\n",
3131
"\n",
32-
"\n",
3332
"rng = np.random.default_rng(seed=15485863)\n",
3433
"data = rng.standard_normal((100, 26))\n",
3534
"df = pd.DataFrame(data, columns=list(string.ascii_lowercase))\n",
@@ -52,10 +51,8 @@
5251
"import ipywidgets as widgets\n",
5352
"import numpy as np\n",
5453
"import pandas as pd\n",
55-
"\n",
5654
"from IPython.display import display\n",
5755
"\n",
58-
"\n",
5956
"tab = widgets.Tab()\n",
6057
"\n",
6158
"descr_str = \"Hello\"\n",
@@ -68,9 +65,9 @@
6865
"\n",
6966
"# render in output widgets\n",
7067
"with widget_images:\n",
71-
" display(pd.DataFrame(np.random.randn(10, 10)))\n",
68+
" display(pd.DataFrame(np.random.randn(10,10)))\n",
7269
"with widget_annotations:\n",
73-
" display(pd.DataFrame(np.random.randn(10, 10)))\n",
70+
" display(pd.DataFrame(np.random.randn(10,10)))\n",
7471
"\n",
7572
"tab.children = [widget_images, widget_annotations]\n",
7673
"tab.titles = [\"Images\", \"Annotations\"]\n",
@@ -93,7 +90,6 @@
9390
"source": [
9491
"import matplotlib.pyplot as plt\n",
9592
"\n",
96-
"\n",
9793
"fig, ax = plt.subplots()\n",
9894
"ax.scatter(df[\"a\"], df[\"b\"], c=df[\"b\"], s=3)"
9995
]
@@ -129,13 +125,10 @@
129125
"import plotly.express as px\n",
130126
"import plotly.io as pio\n",
131127
"\n",
132-
"\n",
133128
"pio.renderers.default = \"notebook\"\n",
134129
"\n",
135130
"df = px.data.iris()\n",
136-
"fig = px.scatter(\n",
137-
" df, x=\"sepal_width\", y=\"sepal_length\", color=\"species\", size=\"sepal_length\"\n",
138-
")\n",
131+
"fig = px.scatter(df, x=\"sepal_width\", y=\"sepal_length\", color=\"species\", size=\"sepal_length\")\n",
139132
"fig"
140133
]
141134
},
@@ -156,10 +149,11 @@
156149
"source": [
157150
"import xarray as xr\n",
158151
"\n",
159-
"\n",
160152
"data = xr.DataArray(\n",
161-
" np.random.randn(2, 3), dims=(\"x\", \"y\"), coords={\"x\": [10, 20]}, attrs={\"foo\": \"bar\"}\n",
162-
")\n",
153+
" np.random.randn(2, 3),\n",
154+
" dims=(\"x\", \"y\"),\n",
155+
" coords={\"x\": [10, 20]}, attrs={\"foo\": \"bar\"}\n",
156+
" )\n",
163157
"data"
164158
]
165159
},
@@ -180,9 +174,8 @@
180174
"source": [
181175
"from ipyleaflet import Map, basemaps\n",
182176
"\n",
183-
"\n",
184177
"# display a map centered on France\n",
185-
"m = Map(basemap=basemaps.Esri.WorldImagery, zoom=5, center=[46.21, 2.21])\n",
178+
"m = Map(basemap=basemaps.Esri.WorldImagery, zoom=5, center=[46.21, 2.21])\n",
186179
"m"
187180
]
188181
}

docs/scripts/generate_collaborators_gallery.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
"""
2-
Uses the GitHub API to list a gallery of all people with direct access to the
3-
repository.
4-
"""
1+
"""Uses the GitHub API to list a gallery of all people with direct access to the repository."""
52

63
import json
74
import shlex
8-
95
from pathlib import Path
106
from subprocess import run
117

128
from yaml import dump
139

14-
1510
COLLABORATORS_API = "https://api.github.com/repos/pydata/pydata-sphinx-theme/collaborators?affiliation=direct"
1611

1712
print("Grabbing latest collaborators with GitHub API via GitHub's CLI...")

docs/scripts/update_kitchen_sink.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
from pathlib import Path
44
from urllib.request import urlopen
55

6-
76
EXTRA_MESSAGE = """\
87
.. note::
98
10-
The Kitchen Sink was generated from the
11-
`Sphinx Themes website <https://sphinx-themes.org/>`_, a community-supported showcase
12-
of themes for `Sphinx <https://www.sphinx-doc.org/>`_.
9+
The Kitchen Sink was generated from the `Sphinx Themes website <https://sphinx-themes.org/>`_, a community-supported showcase of themes for `Sphinx <https://www.sphinx-doc.org/>`_.
1310
Check it out to see other great themes.
1411
1512
.. button-link:: https://sphinx-themes.org

docs/user_guide/layout.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,3 +593,4 @@ Please find here the full list of keys you can use in the ``html_theme_options``
593593
.. include:: ../../src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf
594594
:code: ini
595595
:class: highlight-ini
596+

pyproject.toml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,30 +100,22 @@ ignore = ["D001"] # we follow a 1 line = 1 paragraph style
100100

101101
[tool.ruff]
102102
fix = true
103-
# keep consistent with black
104-
line-length = 88
105-
indent-width = 4
106103

107104
[tool.ruff.lint]
108105
ignore = [
106+
"E501", # line too long | Black take care of it
109107
"D107", # Missing docstring in `__init__` | set the docstring in the class
110-
"D205", # 1 blank line required between summary line and description,
111-
"D212", # docstring summary must be on first physical line
112-
"W291", # let pre-commit handle trailing whitespace
113108

114109
]
115-
select = ["E", "F", "W", "I", "D", "RUF", "G"]
110+
ignore-init-module-imports = true
111+
select = ["E", "F", "W", "I", "D", "RUF"]
116112

117113
[tool.ruff.lint.flake8-quotes]
118114
docstring-quotes = "double"
119115

120116
[tool.ruff.lint.pydocstyle]
121117
convention = "google"
122118

123-
[tool.ruff.lint.isort]
124-
lines-between-types = 1
125-
lines-after-imports = 2
126-
127119
[tool.djlint]
128120
profile = "jinja"
129121
extension = "html"

src/pydata_sphinx_theme/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
"""Bootstrap-based sphinx theme from the PyData community."""
22

33
import json
4-
54
from functools import partial
65
from pathlib import Path
76
from typing import Dict
87
from urllib.parse import urlparse
98

109
import requests
11-
1210
from requests.exceptions import ConnectionError, HTTPError, RetryError
1311
from sphinx.application import Sphinx
1412
from sphinx.builders.dirhtml import DirectoryHTMLBuilder
1513
from sphinx.errors import ExtensionError
1614

1715
from . import edit_this_page, logo, pygments, short_link, toctree, translator, utils
1816

19-
2017
__version__ = "0.16.1dev0"
2118

2219

@@ -205,7 +202,7 @@ def update_and_remove_templates(
205202
for i in range(len(context["css_files"])):
206203
asset = context["css_files"][i]
207204
# TODO: eventually the contents of context['css_files'] etc should probably
208-
# only be _CascadingStyleSheet etc. For now, assume mixed with strings.
205+
# only be _CascadingStyleSheet etc. For now, assume mixed with strings.
209206
asset_path = getattr(asset, "filename", str(asset))
210207
if asset_path == theme_css_name:
211208
del context["css_files"][i]
@@ -236,8 +233,7 @@ def update_and_remove_templates(
236233
DOCUMENTATION_OPTIONS.theme_version = '{__version__}';
237234
DOCUMENTATION_OPTIONS.theme_switcher_json_url = '{json_url}';
238235
DOCUMENTATION_OPTIONS.theme_switcher_version_match = '{version_match}';
239-
DOCUMENTATION_OPTIONS.show_version_warning_banner =
240-
{str(context["theme_show_version_warning_banner"]).lower()};
236+
DOCUMENTATION_OPTIONS.show_version_warning_banner = {str(context["theme_show_version_warning_banner"]).lower()};
241237
"""
242238
app.add_js_file(None, body=js)
243239

src/pydata_sphinx_theme/edit_this_page.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Create an "edit this page" url compatible with bitbucket, gitlab and github."""
22

33
import jinja2
4-
54
from sphinx.application import Sphinx
65
from sphinx.errors import ExtensionError
76

src/pydata_sphinx_theme/locale/ca/LC_MESSAGES/sphinx.po

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
# Copyright (C) 2024 ORGANIZATION
33
# This file is distributed under the same license as the PROJECT project.
44
# FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
5-
#
5+
#
66
# Translators:
77
# Cristhian Rivera, 2024
88
# Oriol Abril-Pla <[email protected]>, 2024
9+
#
910
msgid ""
1011
msgstr ""
1112

src/pydata_sphinx_theme/locale/cs/LC_MESSAGES/sphinx.po

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,4 @@ msgstr "Navigace na stránce"
180180

181181
#~ msgid "© <a href=\"%(path)s\">Copyright</a> %(copyright)s."
182182
#~ msgstr "© <a href=\"%(path)s\">Copyright</a> %(copyright)s."
183+

0 commit comments

Comments
 (0)