Skip to content

add alias for AnyDisplay & convert to ruff #48

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 4 commits into from
May 29, 2025

Conversation

FoamyGuy
Copy link
Contributor

There is a similar definition used in core docstrings here: https://github.com/adafruit/circuitpython/blob/main/shared-bindings/displayio/__init__.c#L48

This would allow us to easily annotate arguments that can be any kind of display.

@FoamyGuy
Copy link
Contributor Author

This failed actions because it's not able to run the version of pylint requested under python 3.12 which the workflow is using.

Instead of updating pylint, I just swapped this over to use ruff so it matches the libraries. This one isn't in the bundle since it doesn't go on devices and therefore wasn't part of the recent sweep doing these conversions.

@FoamyGuy FoamyGuy changed the title add alias for AnyDisplay add alias for AnyDisplay & convert to ruff May 29, 2025
@FoamyGuy FoamyGuy requested a review from a team May 29, 2025 18:17
Copy link
Member

@tekktrik tekktrik left a comment

Choose a reason for hiding this comment

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

One small change request. Also, not surprising but that's one heck of a linting rule disable list! Is it spread out across files? And is any of it a target for someone to hack away at over time?

from epaperdisplay import EPaperDisplay
from framebufferio import FramebufferDisplay

AnyDisplay: TypeAlias = Union[BusDisplay | EPaperDisplay | FramebufferDisplay]
Copy link
Member

@tekktrik tekktrik May 29, 2025

Choose a reason for hiding this comment

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

I think you mean Union[X, Y, Z] and not Union[X | Y | Z]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, thank you!

@FoamyGuy
Copy link
Contributor Author

Also, not surprising but that's one heck of a linting rule disable list! Is it spread out across files? And is any of it a target for someone to hack away at over time?

@tekktrik I'd say anyone is welcome to work on making changes to reduce the number of disables needed. While doing the pass for conversion to ruff recently I started adding any disable rules that were popping up over and over in code into the main disable list inside the config rather than continuing to have disable comments scattered in the codebase because it seemed easier to maintain over time to me.

For some of the "too many ___" rules in particular the targets are a little low IMO, I haven't looked into it to determine if we can raise the limits, but if so I would say it's worth considering that because a lot of our libraries do surpass some of those limits as-is.

I did just copy the config from an unrelated library though, and there were a few rules disabled that didn't need to be so I've removed those in the latest commit.

@FoamyGuy FoamyGuy merged commit a8054ac into adafruit:main May 29, 2025
1 check passed
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.

3 participants