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

Bump pillow to 10.4.0 and mode check PyMunkHitBoxAlgorithm #2375

Merged
merged 9 commits into from
Sep 30, 2024

Conversation

pushfoo
Copy link
Member

@pushfoo pushfoo commented Sep 29, 2024

TL;DR: Pull in various pillow fixes + update our typing / code

Why

  1. Help users with dependabot / vuln scanning (example: fixes a buffer overflow
  2. Help map out changes for the prospective EOL 2.6.18 release / Latest arcade 2.6.17 requires pyglet 2.0.dev23 #2358
  3. Various bug fixes

Changes

  1. Use the new Transpose and Resampling enums
  2. Replace direct attribute access with hasattr tests recommended by Pillow doc
  3. Cover image mode edge case in PyMunkHitBoxAlgorithm:
    • Raise a ValueError when passed a non-RGBA image
    • Add tests for this edge case
  4. Fix minor typing issue in tilemap loading
  5. Silence mypy problems with 10.4.0:
    1. Opening an image file now returns an ImageFile subclass
    2. While pyright is fine with this, mypy is not
    3. typing.cast is slow, so we use an ugly little trick
  6. Some drive-by doc changes which help understand how this works

Follow-up Work

Continue the revision pass over texture atlas doc I have in git stash:

  • I started it to help myself understand the code affected
  • It'd be best to finish it

* Use getattr for is_animated attribute per the pillow doc

* Use getattr for the n_frames attribute as well
* Use str | Path annotation

* Add an Args block documenting resource_name

* Cross-ref the resource handles page in the programming guide
* Add ValueError when given non-RGBA image

* Add a test for the ValueError

* Annotate trace_image's argument

* Correct pyright issues inside it

* Elaborate on the doc and fix issues with it
@pushfoo pushfoo changed the title Bump pillow to 10.4.0 Bump pillow to 10.4.0 and mode check PyMunkHitBoxAlgorithm Sep 30, 2024
@pushfoo pushfoo merged commit f273639 into development Sep 30, 2024
8 checks passed
@pushfoo pushfoo deleted the bump-pillow-to-10.4.0 branch September 30, 2024 08:39
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.

1 participant