Skip to content
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

Replace flake8 with ruff #243

Merged
merged 4 commits into from
Aug 23, 2023
Merged

Replace flake8 with ruff #243

merged 4 commits into from
Aug 23, 2023

Conversation

bmerry
Copy link
Contributor

@bmerry bmerry commented Aug 23, 2023

I also enabled a few extra plugins beyond the flake8 basics, and fixed resulting errors.

It fixed a bunch of unnecessary imports in .pyi files too!
It rewrites the .pyi files to use more modern syntax.
It's the equivalent of yesqa (warns about useless noqa).
It does additional .pyi files checks. Mostly the fixes are just
stylistic, but it did pick up incorrect typing on the `__iadd__` return
type (only noticeable if you actually call it as `__iadd__`, since `+=`
is a statement not an expression.
@@ -112,7 +98,7 @@ class MemoryPool(MemoryAllocator):
upper: int,
max_free: int,
initial: int,
allocator: Optional[MemoryAllocator] = None,
allocator: MemoryAllocator | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

My only concern is that this kind of change will break backwards compatibility. Unless for new versions of spead2 you are only planning on supporting Python 3.10+?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I saw that ruff had made these changes my first thought was it was a bug, since I've told it to be 3.8-compatible. But this is a .pyi file, so it's only interpreted by type checkers and not the actual Python runtime.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, that makes sense.

@bmerry bmerry merged commit 44507d9 into master Aug 23, 2023
19 of 20 checks passed
@bmerry bmerry deleted the ruff branch August 23, 2023 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants