From 50442e1d29f091bffd08dc1464dbd83160746234 Mon Sep 17 00:00:00 2001 From: iap Date: Sat, 20 Sep 2025 20:34:40 -0400 Subject: [PATCH 1/4] add platformdirs to deps --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index b852a0b3..01f14576 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ dependencies = [ "watchfiles>=0.21,<2.0", "yarl>=1.9,<2.0", "cssutils>=2.11.1,<3.0", + "platformdirs>=4.3.7", ] requires-python = ">= 3.10" readme = "README.md" From c7bd3b14b797b5bea00fbd5d549f286f7cb88a6a Mon Sep 17 00:00:00 2001 From: iap Date: Wed, 24 Sep 2025 14:35:02 -0400 Subject: [PATCH 2/4] fix icon loading (update to new fetch_as_bytes return type) --- pyproject.toml | 1 - rio/app.py | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 025c13df..f2660f01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,6 @@ dependencies = [ "watchfiles>=0.21,<2.0", "yarl>=1.9,<2.0", "cssutils>=2.11.1,<3.0", - "platformdirs>=4.3.7", ] requires-python = ">= 3.10" readme = "README.md" diff --git a/rio/app.py b/rio/app.py index deae16d4..26b7fbfe 100644 --- a/rio/app.py +++ b/rio/app.py @@ -431,7 +431,7 @@ class App: # Nope, get it try: - icon_blob, _ = await self._icon.fetch_as_bytes() + icon_blob = await self._icon.fetch_as_bytes() input_buffer = io.BytesIO(icon_blob) output_buffer = io.BytesIO() @@ -442,17 +442,17 @@ class App: self._icon_as_png_blob = output_buffer.getvalue() # Loading has failed. Use the default icon. - except Exception: + except Exception as e: if isinstance(self._icon, assets.PathAsset): logging.error( - f"Could not fetch the app's icon from {self._icon.path.absolute()}" + f"Could not fetch the app's icon from {self._icon.path.absolute()}: {e}" ) elif isinstance(self._icon, assets.UrlAsset): logging.error( - f"Could not fetch the app's icon from {self._icon.url}" + f"Could not fetch the app's icon from {self._icon.url}: {e}" ) else: - logging.error("Could not fetch the app's icon") + logging.error(f"Could not fetch the app's icon: {e}") assert DEFAULT_ICON_PATH.suffix == ".png", ( "The default icon must be PNG" From f1f6c9c2cc2c422cbec272f8ac405c1c787e0c83 Mon Sep 17 00:00:00 2001 From: iap Date: Fri, 26 Sep 2025 19:59:14 -0400 Subject: [PATCH 3/4] do not crash trying to notify a gc'd component of a size change --- rio/session.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rio/session.py b/rio/session.py index 482477d0..eece2309 100644 --- a/rio/session.py +++ b/rio/session.py @@ -3883,13 +3883,14 @@ a.remove(); """ Called by the client when a component is resized. """ - component = self._weak_components_by_id[component_id] - resize_event = rio.ComponentResizeEvent(new_width, new_height) + component = self._weak_components_by_id.get(component_id) + if component: + resize_event = rio.ComponentResizeEvent(new_width, new_height) - for handler, _ in component._rio_event_handlers_[ - rio.event.EventTag.ON_RESIZE - ]: - self._call_event_handler_sync(handler, component, resize_event) + for handler, _ in component._rio_event_handlers_[ + rio.event.EventTag.ON_RESIZE + ]: + self._call_event_handler_sync(handler, component, resize_event) @unicall.local(name="onFullscreenChange") async def _on_fullscreen_change(self, fullscreen: bool) -> None: From f94aacf2f51e5fe498f0e6b7246839a575a18e38 Mon Sep 17 00:00:00 2001 From: iap Date: Fri, 26 Sep 2025 20:01:54 -0400 Subject: [PATCH 4/4] speedup build command now that scripts.build has no deps --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f2660f01..8587e699 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -126,7 +126,7 @@ PYTHONPATH = "." [[tool.hatch.build.hooks.build-scripts.scripts]] commands = [ "npm install", - "uvx --with-requirements pyproject.toml python -m scripts.build", + "uvx python -m scripts.build", ] [tool.ruff]