From ee6c3990fe0e3800cad3012522ade3284e0748dd Mon Sep 17 00:00:00 2001 From: Paul V Craven Date: Thu, 1 Oct 2026 12:53:46 -0500 Subject: [PATCH 1/3] Update pyglet to 3.0.dev11 Update the pyglet pin from 3.0.dev8 to 3.0.dev11 in pyproject.toml and uv.lock. Only the pyglet entries in the lock file change. Arcade needed no code changes: every arcade module imports, and the full test suite gives the same results as on dev8. The breaking changes in dev9-dev11 (ShaderProgram vertex_layout, resource handle/key, pyglet.gui UIManager) are in pyglet APIs arcade doesn't use. The new macOS display link draw source isn't started because arcade calls pyglet.app.run(None) and schedules its own frames. Document the changes for users who use pyglet directly in the changelog. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- uv.lock | 8 ++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab3d7924c..fb202ee67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ Arcade [PyPi Release History](https://pypi.org/project/arcade/#history) page. ## Unreleased +### Breaking Changes +- Updated pyglet to 3.0.dev11 (from 3.0.dev8). Arcade itself needed no changes; these mostly affect code that uses pyglet directly. + - `pyglet.graphics.ShaderProgram` now requires a `vertex_layout` keyword argument (a `pyglet.graphics.VertexLayout`, or `None` to infer it from the shader). `create_vertex_layout()` and `set_instance_attributes()` are replaced by `VertexLayout` and `get_vertex_view()`. Arcade's own shaders use `arcade.gl` and are unaffected. + - pyglet graphics resources (textures, buffers, shaders, framebuffers, ...) now have a backend `handle` and a stable `key`. The `.id` attribute is deprecated; use `.handle` for backend calls and `.key` for equality and caching. `MouseCursor.gl_drawable` was renamed to `MouseCursor.api_drawable`. + - `pyglet.gui` was rewritten around a new `UIManager`. This doesn't affect `arcade.gui`. + - Pressing Ctrl+C now stops `arcade.run()` cleanly through `pyglet.app.exit` instead of raising `KeyboardInterrupt` (except in headless mode, which uses its own loop). + - On macOS 14 and later, pyglet can now drive window redraws from the display (`pyglet.options.osx_displaylink`). Arcade schedules its own frames, so its update and draw rates are unaffected. + ### Fixes - Fixed `check_for_collision` (and the list-based collision functions) missing collisions when a sprite was flipped with a negative scale. The negative width/height cancelled out in the broad-phase distance check, so flipped sprites could pass through each other. - Fixed `SpatialHash` queries (`get_sprites_near_sprite`, `get_sprites_near_point`, `get_sprites_near_rect`, and the collision functions that use them) adding an empty bucket for every grid cell they looked at. Memory use grew as sprites moved around large maps. Queries and adding sprites to a spatial hash are also faster, since the hit box points are now scanned once instead of four times. diff --git a/pyproject.toml b/pyproject.toml index 721a8c021..b596d5b9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ classifiers = [ dependencies = [ "pillow>=11.3.0", "pytiled-parser~=2.2.9", - "pyglet==3.0.dev8", + "pyglet==3.0.dev11", ] dynamic = ["version"] diff --git a/uv.lock b/uv.lock index 00dd8f9a1..616f91369 100644 --- a/uv.lock +++ b/uv.lock @@ -99,7 +99,7 @@ testing-libraries = [ [package.metadata] requires-dist = [ { name = "pillow", specifier = ">=11.3.0" }, - { name = "pyglet", specifier = "==3.0.dev8" }, + { name = "pyglet", specifier = "==3.0.dev11" }, { name = "pytiled-parser", specifier = "~=2.2.9" }, ] @@ -1019,11 +1019,11 @@ wheels = [ [[package]] name = "pyglet" -version = "3.0.dev8" +version = "3.0.dev11" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/b7/77/6d58f67b31f8d0a5215c49ce0c0692d496d16d5c5cd55173462cf2420503/pyglet-3.0.dev8.tar.gz", hash = "sha256:41a7a8b810605b53efed11231249e8d66b1c09f0edd48863f86eab133f7460b6", size = 7037708, upload-time = "2026-08-20T09:51:14.361Z" } +sdist = { url = "https://files.pythonhosted.org/packages/4d/7b/4a2a710751730fd5b9a26af610436e3eab8d767252e37c77e721b1b48e91/pyglet-3.0.dev11.tar.gz", hash = "sha256:e8bb6d4e5f1eb34da4fba30d2786b9c823e84f780db8ef76b60ffc975e51ef00", size = 1502390, upload-time = "2026-09-25T09:37:48.713Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/bf/77/5d973f3e3fdb3bf3d44471a62147a68c371eb2efca6d043485def5d02e2a/pyglet-3.0.dev8-py3-none-any.whl", hash = "sha256:f49e70582247ee7c632f7d201a15708ff7cde1e4452b736a136d96da7df72343", size = 1592079, upload-time = "2026-08-20T09:51:08.435Z" }, + { url = "https://files.pythonhosted.org/packages/7d/1b/9a654be062972d403c0c1aaaa5d26a84f2ff8e823b497852398bfffeedbe/pyglet-3.0.dev11-py3-none-any.whl", hash = "sha256:13f0bd3b286bf33ed5aa4de6df687512e136676080b5f991b01ead5c37df0432", size = 1662636, upload-time = "2026-09-25T09:37:45.816Z" }, ] [[package]] From 3379ba8afe1b27205aad9ee808e21263c5ba921c Mon Sep 17 00:00:00 2001 From: Paul V Craven Date: Thu, 1 Oct 2026 13:15:19 -0500 Subject: [PATCH 2/3] Use PYGLET_DOC_BUILD for doc builds with pyglet 3.0.dev11 pyglet 3.0.dev11 detects documentation builds through the PYGLET_DOC_BUILD environment variable, read when pyglet is first imported, instead of the sys.is_pyglet_doc_run flag. With only the old flag set, pyglet.lib.LibraryMock was never defined, so doc/conf.py's patch to it raised AttributeError and the docs build failed. Set the environment variable instead, before anything imports pyglet, and drop the LibraryMock patch: dev11's mock already defines __bool__ and __iter__. Co-Authored-By: Claude Opus 5.5 --- doc/conf.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 11eae1b56..023a8808a 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -45,19 +45,13 @@ from util.doc_helpers.real_filesystem import copy_media -# As of pyglet==2.1.dev7, this is no longer set in pyglet/__init__.py -# because Jupyter / IPython always load Sphinx into sys.modules. See -# the following for more info: -# 1. The ticket: https://github.com/pyglet/pyglet/issues/1215 -# 2. The commit: https://github.com/pyglet/pyglet/commit/97076c3a33a7d368cc9c9e44ca67769b6a16a905 -sys.is_pyglet_doc_run = True - -# pyglet 3.0.dev3 LibraryMock lacks __iter__/__bool__, causing crashes -# when ffmpeg codec init calls get_input_extensions() during doc builds. -# Patch before any pyglet imports trigger media codec loading. -import pyglet.lib # noqa: E402 -pyglet.lib.LibraryMock.__bool__ = lambda self: False -pyglet.lib.LibraryMock.__iter__ = lambda self: iter([]) +# Tell pyglet this is a documentation build, so it mocks out native +# libraries instead of loading them. As of pyglet 3.0.dev11 this is the +# PYGLET_DOC_BUILD environment variable, read when pyglet is first +# imported, so it must be set before anything imports pyglet. It replaces +# the old sys.is_pyglet_doc_run flag, and pyglet's LibraryMock now has the +# __bool__ and __iter__ methods this file used to patch in. +os.environ["PYGLET_DOC_BUILD"] = "1" # --- Pre-processing Tasks From 0c9e93d9fba80992128dd326879abcea8bb91126 Mon Sep 17 00:00:00 2001 From: Paul V Craven Date: Thu, 1 Oct 2026 13:16:08 -0500 Subject: [PATCH 3/3] Changelog: note the docs build config change for pyglet dev11 Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e77b66bf1..81355cf7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Arcade [PyPi Release History](https://pypi.org/project/arcade/#history) page. ## Unreleased ### Breaking Changes -- Updated pyglet to 3.0.dev11 (from 3.0.dev8). Arcade itself needed no changes; these mostly affect code that uses pyglet directly. +- Updated pyglet to 3.0.dev11 (from 3.0.dev8). Arcade's library code needed no changes (only its docs build configuration did); these mostly affect code that uses pyglet directly. - `pyglet.graphics.ShaderProgram` now requires a `vertex_layout` keyword argument (a `pyglet.graphics.VertexLayout`, or `None` to infer it from the shader). `create_vertex_layout()` and `set_instance_attributes()` are replaced by `VertexLayout` and `get_vertex_view()`. Arcade's own shaders use `arcade.gl` and are unaffected. - pyglet graphics resources (textures, buffers, shaders, framebuffers, ...) now have a backend `handle` and a stable `key`. The `.id` attribute is deprecated; use `.handle` for backend calls and `.key` for equality and caching. `MouseCursor.gl_drawable` was renamed to `MouseCursor.api_drawable`. - `pyglet.gui` was rewritten around a new `UIManager`. This doesn't affect `arcade.gui`.