Skip to content

Commit 5c4cc4a

Browse files
authored
CI: replace flake8-pyi with ruff (#52226)
1 parent fa3aa5f commit 5c4cc4a

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

.pre-commit-config.yaml

+1-9
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ repos:
2828
types_or: [python, pyi]
2929
additional_dependencies: [black==23.1.0]
3030
- repo: https://github.com/charliermarsh/ruff-pre-commit
31-
rev: v0.0.255
31+
rev: v0.0.259
3232
hooks:
3333
- id: ruff
3434
args: [--exit-non-zero-on-fix]
@@ -392,14 +392,6 @@ repos:
392392
files: ^pandas/
393393
exclude: ^(pandas/_libs/|pandas/tests/|pandas/errors/__init__.py$|pandas/_version.py)
394394
types: [python]
395-
- id: flake8-pyi
396-
name: flake8-pyi
397-
entry: flake8 --extend-ignore=E301,E302,E305,E701,E704
398-
types: [pyi]
399-
language: python
400-
additional_dependencies:
401-
- flake8==5.0.4
402-
- flake8-pyi==22.8.1
403395
- id: future-annotations
404396
name: import annotations from __future__
405397
entry: 'from __future__ import annotations'

pyproject.toml

+14-1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ select = [
215215
"PLE", "PLR", "PLW",
216216
# misc lints
217217
"PIE",
218+
# flake8-pyi
219+
"PYI",
218220
# tidy imports
219221
"TID",
220222
# implicit string concatenation
@@ -266,6 +268,14 @@ ignore = [
266268
"PLR0915",
267269
# Global statements are discouraged
268270
"PLW0603",
271+
# Docstrings should not be included in stubs
272+
"PYI021",
273+
# Use typing_extensions.TypeAlias for type aliases
274+
# "PYI026", # not yet implemented
275+
# Use "collections.abc.*" instead of "typing.*" (PEP 585 syntax)
276+
# "PYI027", # not yet implemented
277+
# while int | float can be shortened to float, the former is more explicit
278+
# "PYI041", # not yet implemented
269279

270280
# Additional checks that don't pass yet
271281
# Within an except clause, raise exceptions with ...
@@ -281,6 +291,8 @@ exclude = [
281291
"doc/build/*.py",
282292
"doc/temp/*.py",
283293
".eggs/*.py",
294+
# vendored files
295+
"pandas/util/version/*",
284296
"versioneer.py",
285297
# exclude asv benchmark environments from linting
286298
"env",
@@ -292,8 +304,9 @@ exclude = [
292304
# to be enabled gradually
293305
"pandas/core/*" = ["PLR5501", "PLW2901"]
294306
"pandas/io/*" = ["PLW2901"]
295-
"pandas/tests/*" = ["PLW2901"]
307+
"pandas/tests/*" = ["B028", "PLW2901"]
296308
"pandas/plotting/*" = ["PLW2901"]
309+
"scripts/*" = ["B028"]
297310
# Keep this one enabled
298311
"pandas/_typing.py" = ["TCH"]
299312

setup.cfg

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[flake8]
22
max-line-length = 88
33
# Although ruff is now the main linter for style checks, this section
4-
# is still needed for validate_docstrings.py and flake8-pyi
4+
# is still needed for validate_docstrings.py
55
ignore =
66
# space before : (needed for how black formats slicing)
77
E203,
@@ -12,17 +12,7 @@ ignore =
1212
# module level import not at top of file
1313
E402,
1414
# do not assign a lambda expression, use a def
15-
E731,
16-
# found modulo formatter (incorrect picks up mod operations)
17-
Y002,
18-
# Docstrings should not be included in stubs
19-
Y021,
20-
# Use typing_extensions.TypeAlias for type aliases
21-
Y026,
22-
# Use "collections.abc.*" instead of "typing.*" (PEP 585 syntax)
23-
Y027,
24-
# while int | float can be shortened to float, the former is more explicit
25-
Y041
15+
E731
2616
exclude =
2717
doc/sphinxext/*.py,
2818
doc/build/*.py,

0 commit comments

Comments
 (0)