Skip to content

Enable linting of .pyi files #30006

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
May 9, 2025
Merged

Enable linting of .pyi files #30006

merged 1 commit into from
May 9, 2025

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented May 3, 2025

Enables linting of .pyi files. Most of the fixes here are line length, other fixes are:

  • Fix __all__ in __init__.pyi
  • Remove unused imports

@QuLogic
Copy link
Member

QuLogic commented May 5, 2025

@ksunden did not wrap .pyi files at the default 88 characters, so this might cause a bit of excess churn.

@dstansby dstansby marked this pull request as ready for review May 6, 2025 08:40
@oscargus
Copy link
Member

oscargus commented May 6, 2025

so this might cause a bit of excess churn.

Worth it to me. One time effort that is annoying, but still...

@QuLogic QuLogic requested a review from ksunden May 7, 2025 02:46
@ksunden
Copy link
Member

ksunden commented May 8, 2025

For the record, the reason I did not wrap at 88 is because the official python style guide for typing specifies 130 characters.

https://typing.python.org/en/latest/guides/writing_stubs.html#maximum-line-length

I don't have too strong of an opinion, but went with the standard for the filetype.

@oscargus
Copy link
Member

oscargus commented May 8, 2025

Interesting. Seems like it is not possible to configure different line lengths for pyi and py files (if I read the documentation correctly). This seems like a good motivation to support that though.

@timhoffm
Copy link
Member

timhoffm commented May 9, 2025

You could only make a separate run with different settings for pyi.

@dstansby
Copy link
Member Author

dstansby commented May 9, 2025

For the record, the reason I did not wrap at 88 is because the official python style guide for typing specifies 130 characters.

Ah, I didn't know this! In that case I've added a exclusion for rule E501 (line length) for .pyi files, but left the rest enabled.

@tacaswell tacaswell added this to the v3.11.0 milestone May 9, 2025
@timhoffm timhoffm merged commit 75d9199 into matplotlib:main May 9, 2025
38 of 40 checks passed
@dstansby dstansby deleted the lint-pyi branch May 10, 2025 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants