Skip to content

CI: replace flake8-pyi with ruff #52226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
types_or: [python, pyi]
additional_dependencies: [black==23.1.0]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.255
rev: v0.0.259
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
Expand Down Expand Up @@ -392,14 +392,6 @@ repos:
files: ^pandas/
exclude: ^(pandas/_libs/|pandas/tests/|pandas/errors/__init__.py$|pandas/_version.py)
types: [python]
- id: flake8-pyi
name: flake8-pyi
entry: flake8 --extend-ignore=E301,E302,E305,E701,E704
types: [pyi]
language: python
additional_dependencies:
- flake8==5.0.4
- flake8-pyi==22.8.1
- id: future-annotations
name: import annotations from __future__
entry: 'from __future__ import annotations'
Expand Down
15 changes: 14 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ select = [
"PLE", "PLR", "PLW",
# misc lints
"PIE",
# flake8-pyi
"PYI",
# tidy imports
"TID",
# implicit string concatenation
Expand Down Expand Up @@ -266,6 +268,14 @@ ignore = [
"PLR0915",
# Global statements are discouraged
"PLW0603",
# Docstrings should not be included in stubs
"PYI021",
# Use typing_extensions.TypeAlias for type aliases
# "PYI026", # not yet implemented
# Use "collections.abc.*" instead of "typing.*" (PEP 585 syntax)
# "PYI027", # not yet implemented
# while int | float can be shortened to float, the former is more explicit
# "PYI041", # not yet implemented

# Additional checks that don't pass yet
# Within an except clause, raise exceptions with ...
Expand All @@ -281,6 +291,8 @@ exclude = [
"doc/build/*.py",
"doc/temp/*.py",
".eggs/*.py",
# vendored files
"pandas/util/version/*",
"versioneer.py",
# exclude asv benchmark environments from linting
"env",
Expand All @@ -292,8 +304,9 @@ exclude = [
# to be enabled gradually
"pandas/core/*" = ["PLR5501", "PLW2901"]
"pandas/io/*" = ["PLW2901"]
"pandas/tests/*" = ["PLW2901"]
"pandas/tests/*" = ["B028", "PLW2901"]
"pandas/plotting/*" = ["PLW2901"]
"scripts/*" = ["B028"]
# Keep this one enabled
"pandas/_typing.py" = ["TCH"]

Expand Down
14 changes: 2 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[flake8]
max-line-length = 88
# Although ruff is now the main linter for style checks, this section
# is still needed for validate_docstrings.py and flake8-pyi
# is still needed for validate_docstrings.py
ignore =
# space before : (needed for how black formats slicing)
E203,
Expand All @@ -12,17 +12,7 @@ ignore =
# module level import not at top of file
E402,
# do not assign a lambda expression, use a def
E731,
# found modulo formatter (incorrect picks up mod operations)
Y002,
# Docstrings should not be included in stubs
Y021,
# Use typing_extensions.TypeAlias for type aliases
Y026,
# Use "collections.abc.*" instead of "typing.*" (PEP 585 syntax)
Y027,
# while int | float can be shortened to float, the former is more explicit
Y041
E731
exclude =
doc/sphinxext/*.py,
doc/build/*.py,
Expand Down