Skip to content

Eliminate pyright errors #2062

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 33 commits into from
Apr 15, 2024
Merged

Conversation

pushfoo
Copy link
Member

@pushfoo pushfoo commented Apr 13, 2024

TL;DR: Non-#type: ignore fixes for GUI type issues through annotations + int conversion

Why

  1. Build failure details on every commit are:
    • wasting everyone's time since we always have to inspect the build failures to see what they mean
    • confusing and scaring less experienced contributors
  2. Until pyglet 2.1 finishes the float conversion of their labels & layouts, we need to account for it:
    • pyglet 2.0.X (our current version) will probably keep the int behavior / storage for layouts
    • pyglet 2.1 + dev releases (our future version) will switch to float storage
      • text layout & other positioning may floor / round values to whole pixels
      • animatable / data storage would remain float to avoid error loss / jitter
    • pyglet hasn't implemented the new behavior yet
  3. LRWH rectangles have uses outside of the GUI (Complete Camera Overhaul #1853)

Changes

  1. Add AsFloat = Union[float, int type to:
    • Make pyright happy
    • Convey meaning to readers
  2. Annotate + document arcade.gui.Rect
  3. Add tests for existing arcade.gui.Rect.scale behavior
  4. Add rounding=None behavior to arcade.gui.Rect.scale + tests
  5. Add int conversion shims to stop pyright issues
    • We haven't yet switched to a pyglet 2.1dev*release
    • The float storage behavior hasn't beein implemented on their side yet
    • would fix issues with their .pyi useful to reduce #type: ignore cruft

Test steps taken

  • Add tests for any new functionality
  • CI
  • Human shakedown of the GUI after changes
    • Linux (pushfoo)
    • Mac (@eruvanos)
    • Windows (DigiDuncan)

@pushfoo pushfoo changed the title Attempt to fix some of the GUI pyright issues Eliminate GUI pyright errors Apr 13, 2024
@pushfoo pushfoo changed the title Eliminate GUI pyright errors Eliminate pyright errors Apr 13, 2024
@eruvanos
Copy link
Member

Thanks for the contribution.

@pushfoo Is this ready to merge? For me it looks fine, the new functionality within Rect seems to be useful and the AsFloat makes the usage of values clear.

@pushfoo
Copy link
Member Author

pushfoo commented Apr 14, 2024

TL;DR: Give it a look over on Mac and Windows for the text scrolling text and text drawing examples?

I just went through those examples under Linux. It looks fine here as far as a quick glance can tell. @DigiDuncan @DragonMoffon could you two help out look at those examples under Windows? Also, I think Eruvanos has a mac.

Btw, scale changes are actually somewhat conservative. I'm considering more in the future but the current one seemed small enough to merge now.

@eruvanos eruvanos merged commit 47fd3cb into pythonarcade:development Apr 15, 2024
8 checks 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.

2 participants