Skip to content

CI: flake8-pyi #47595

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
Jul 5, 2022
Merged

CI: flake8-pyi #47595

merged 1 commit into from
Jul 5, 2022

Conversation

twoertwein
Copy link
Member

No description provided.

@@ -229,3 +229,11 @@ repos:
entry: python scripts/validate_min_versions_in_sync.py
language: python
files: ^(ci/deps/actions-.*-minimum_versions\.yaml|pandas/compat/_optional\.py)$
- id: flake8-pyi
name: flake8-pyi
entry: flake8 --extend-ignore=E301,E302,E305,E701,E704
Copy link
Member Author

@twoertwein twoertwein Jul 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flake8 doesn't like black's formatting in pyi files

# Use typing_extensions.TypeAlias for type aliases
Y026,
# Use "collections.abc.*" instead of "typing.*" (PEP 585 syntax)
Y027
Copy link
Member Author

@twoertwein twoertwein Jul 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y002: we have one if TYPE_CHECKING, without it mypy cannot infer some types (too many cyclic dependencies or does it hide actual errors?)
Y019: pandas does not (explicitly) depend on typeshed/typing_extension
Y021: some files have notes on how the cython and python types relate to each other
Y026: pandas does not (explicitly) depend on typing_extension
Y027: let's wait until we also do that change for the in-line annotations

entry: flake8 --extend-ignore=E301,E302,E305,E701,E704
types: [pyi]
language: python
additional_dependencies:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could these be added to flake8_dependencies in the flake8 block above and then this line changed to additional_dependencies: *flake8_dependencies?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I first tried to add flake8-pyi to all the other flake8 plugins but the issue is that we need different ignores for pyi files than for normal py files.

I think flake8 supports file-specific ignores. If they support something along the lines *.pyi: E301,E302,E305,E701,E704 that would be the best approach. I'll look into that later today.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. That can be a followup PR if it works.

@mroeschke mroeschke added this to the 1.5 milestone Jul 5, 2022
@mroeschke mroeschke added the Typing type annotations, mypy/pyright type checking label Jul 5, 2022
@mroeschke mroeschke merged commit 4d17588 into pandas-dev:main Jul 5, 2022
@mroeschke
Copy link
Member

Thanks @twoertwein

yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
@twoertwein twoertwein deleted the flake8-pyi branch September 21, 2022 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants