From 93688b274fad5c115f753f5bf75e9c032def20f0 Mon Sep 17 00:00:00 2001 From: Florian Scherf Date: Mon, 22 May 2023 19:38:53 +0200 Subject: [PATCH] release 1.14 Signed-off-by: Florian Scherf --- doc/content/api-reference/channels.rst | 4 + doc/content/api-reference/server.rst | 4 + doc/content/api-reference/views.rst | 11 +++ doc/content/changelog.rst | 95 ++++++++++++++++++++- doc/content/demos/daemonized-view/index.rst | 2 +- lona/__init__.py | 2 +- pyproject.toml | 2 +- 7 files changed, 116 insertions(+), 4 deletions(-) diff --git a/doc/content/api-reference/channels.rst b/doc/content/api-reference/channels.rst index 523ded99..ee458e12 100644 --- a/doc/content/api-reference/channels.rst +++ b/doc/content/api-reference/channels.rst @@ -3,6 +3,10 @@ Channels ======== +.. note:: + + Added in 1.14 + Lona channels facilitate soft real-time communication between different components of the server side of your application by implementing a straightforward publish/subscribe system. They provide a means to exchange diff --git a/doc/content/api-reference/server.rst b/doc/content/api-reference/server.rst index 1a30b853..bd3e034d 100644 --- a/doc/content/api-reference/server.rst +++ b/doc/content/api-reference/server.rst @@ -76,6 +76,10 @@ Server.reverse() Server.fire_view_event() ~~~~~~~~~~~~~~~~~~~~~~~~ + .. note:: + + Deprecated since 1.14. Use Channels instead + .. note:: Added in 1.7.3 diff --git a/doc/content/api-reference/views.rst b/doc/content/api-reference/views.rst index 0dbea6e4..6f035195 100644 --- a/doc/content/api-reference/views.rst +++ b/doc/content/api-reference/views.rst @@ -627,6 +627,9 @@ browser URL. return input_event def on_view_event(self, view_event): + # deprecated since 1.14 + # use Channels instead + pass def on_stop(self, reason): @@ -673,6 +676,10 @@ This hook is gets called for every input event that is not awaited in LonaView.on_view_event\(view_event\) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. note:: + + View events are deprecated since 1.14. Use Channels instead. + This hook gets called for every incoming `view event <#view-events>`_. @@ -1431,6 +1438,10 @@ LonaView.iter_objects\(\) LonaView.fire_view_event\(name, data=None\) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + .. note:: + + View events are deprecated since 1.14. Use Channels instead. + .. note:: Added in 1.7.3 diff --git a/doc/content/changelog.rst b/doc/content/changelog.rst index 4316c6ee..5b5686b3 100644 --- a/doc/content/changelog.rst +++ b/doc/content/changelog.rst @@ -6,6 +6,99 @@ is_template: False Changelog ========= +.. changelog-header:: 1.14 (2023-05-22) + +Changes +~~~~~~~ + +* Templates + + * Support for favicons was added to the default frontend template + ``lona/frontend.html`` + +* HTML + + * Performance of ``Node.append()`` was improved + + * Previously, ``Node.append()`` used ``NodeList.index()`` internally, + which called ``Node._serialize()`` which is an expensive operation. + + ``Node.append()`` now calculates the index of the appended node itself, + which is much faster. + + * Performance of ``Node.__eq__()`` was improved + + * Previously, ``Node.__eq__()`` used ``Node._serialize()`` which is an + expensive operation. Now ``Node.__eq__()`` checks all attributes of two + nodes individually, trying to find a difference as soon as possible. + + * ``Node.tag_name`` and ``Node.widget`` are read-only now + + * Re-writing of these properties was never supported, so it should not be + possible to write them, to prevent confusion. + +* State + + * ``State.to_json()`` was added + +* Sessions + + * ``SESSIONS_REUSE`` setting was added + + * When set to ``False`` the session middleware will create a random session + key for every new connection. This is useful for debugging multi-user + views. + +* Client 1&2 + + * Support for reconnecting without creating a window was added + + * Previously, when implementing auto-reconnect, the client would reopen the + websocket connection, and in the case of success reload the tab. This + reload is crucial to ensure a connect and a reconnect result in the same + user experience, but has the side effect of accessing the same view + twice. This created problems when debugging or reading the server logs. + + To account for that, the option ``create_window`` was added to + ``LonaContext.reconnect()``, which is set to ``true`` by default. + +* Channels + + * Channels were added + + * Channels are the successor to View Events, and are the new mechanism for + soft real-time communication and multi-user features. + +* Views + + * View Events are deprecated now in favor of Channels + + +Bugfixes +~~~~~~~~ + +* Client 1&2 + + * Index of inserted nodes was fixed + + * Previously, the rendering engine used ``Element.children`` to insert + newly rendered nodes. This only works correctly when the target node only + contains elements and no text nodes, because ``Element.children`` only + contains references to child elements, in contrast to + ``Element.childNodes`` which contains child elements and child text + nodes. The usage of only this subset of nodes lead to incorrect indices, + and nodes ending up in wrong order, in some cases. + +* Client 2 + + * Crashes while rendering node list slices were fixed + + * Previously, the rendering engine could crash when a slice of + ``Node.nodes`` was re-rendered. This was due incorrect node cache + cleaning on the client, and was fixed by cleaning the cache after every + node-reset-operation. + + .. changelog-header:: 1.13 (2023-04-01) Changes @@ -1568,4 +1661,4 @@ Bugfixes .. changelog-header:: 1.0 (2021-08-09) -Initial stable release \ No newline at end of file +Initial stable release diff --git a/doc/content/demos/daemonized-view/index.rst b/doc/content/demos/daemonized-view/index.rst index 923ecf05..cfda49a3 100644 --- a/doc/content/demos/daemonized-view/index.rst +++ b/doc/content/demos/daemonized-view/index.rst @@ -34,4 +34,4 @@ Source code ----------- .. code-block:: python - :include: daemonized-view.py \ No newline at end of file + :include: daemonized-view.py diff --git a/lona/__init__.py b/lona/__init__.py index 0cf90001..6e136070 100644 --- a/lona/__init__.py +++ b/lona/__init__.py @@ -10,5 +10,5 @@ from .view import View from .app import App -VERSION = (1, 13) +VERSION = (1, 14) VERSION_STRING = '.'.join(str(i) for i in VERSION) diff --git a/pyproject.toml b/pyproject.toml index a0c0f8aa..9929ef7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] -version = "1.13" +version = "1.14" name = "lona" description = "Write responsive web apps in full python"