From 51a281515d5a9ce512733c3aba015ba7cb8b6d99 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Fri, 24 Jan 2025 20:35:19 +0000 Subject: [PATCH 1/5] Make ui_handler publicly available again (#1827) In #1792 we made `traits.trait_notifiers.ui_handler` private, renaming it to `_ui_handler`. However, it turns out that Pyface wants to access the value of `ui_handler` directly, so this change breaks current Pyface. This PR reverts that change. Pyface code links: - https://github.com/enthought/pyface/blob/46f700999284c8104fb2a5468f549677dfadf063/pyface/ui/qt/init.py#L15 - https://github.com/enthought/pyface/blob/46f700999284c8104fb2a5468f549677dfadf063/pyface/ui/wx/init.py#L14 (cherry picked from commit 347e58bb3af060c00058561d573d82ca7ac1a4e1) --- CHANGES.rst | 14 ++++++++++++++ traits/trait_notifiers.py | 18 ++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 3dbd57b99..025080344 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,20 @@ Traits CHANGELOG ================ +Release 7.0.2 +------------- + +Released: 2025-01-24 + +This is a bugfix release of the Traits package that fixes an interoperability +issue with Pyface (a regression since Traits 6.4.3). + +Fixes +~~~~~ +* Make ``traits.trait_notifiers.ui_handler`` public again, since + Pyface relies on importing it directly. (#1827) + + Release 7.0.1 ------------- diff --git a/traits/trait_notifiers.py b/traits/trait_notifiers.py index ab7143d9e..3a8a94b2f 100644 --- a/traits/trait_notifiers.py +++ b/traits/trait_notifiers.py @@ -29,31 +29,33 @@ # The currently active handler for notifications that must be run on the UI # thread, or None if no handler has been set. -_ui_handler = None +# Note: the Pyface library current accesses the `ui_handler` attribute +# directly, so we can't make it private yet. +ui_handler = None def get_ui_handler(): """ Return the current user interface thread handler. """ - return _ui_handler + return ui_handler def set_ui_handler(handler): """ Sets up the user interface thread handler. """ - global _ui_handler + global ui_handler - _ui_handler = handler + ui_handler = handler def ui_dispatch(handler, *args, **kw): if threading.current_thread() == threading.main_thread(): handler(*args, **kw) - elif _ui_handler is None: + elif ui_handler is None: raise RuntimeError("no UI handler registered for dispatch='ui'") else: - _ui_handler(handler, *args, **kw) + ui_handler(handler, *args, **kw) class NotificationExceptionHandlerState(object): @@ -616,10 +618,10 @@ class FastUITraitChangeNotifyWrapper(TraitChangeNotifyWrapper): def dispatch(self, handler, *args): if threading.current_thread() == threading.main_thread(): handler(*args) - elif _ui_handler is None: + elif ui_handler is None: raise RuntimeError("no UI handler registered for dispatch='ui'") else: - _ui_handler(handler, *args) + ui_handler(handler, *args) class NewTraitChangeNotifyWrapper(TraitChangeNotifyWrapper): From c4b53e4f96b8f3f566600c6bcb38a904dc0692f5 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Fri, 24 Jan 2025 20:36:51 +0000 Subject: [PATCH 2/5] Bump version for 7.0.2 release --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6cdca078f..8028c4eae 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ # into the package source. MAJOR = 7 MINOR = 0 -MICRO = 1 +MICRO = 2 PRERELEASE = "" IS_RELEASED = True From 5ccf555caa44a74e377ec4939483ed5cfe3701fd Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Fri, 24 Jan 2025 20:41:29 +0000 Subject: [PATCH 3/5] Include Python 3.13 in all workflows (#1826) This PR updates all workflows to support 3.13. We may run into issues with the full test workflow on Python 3.13. (cherry picked from commit 0dda807fa2b3e4d236f79ad90ab8ba7a8fad7972) --- .github/workflows/run-traits-tests.yml | 2 +- .github/workflows/test-from-pypi.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-traits-tests.yml b/.github/workflows/run-traits-tests.yml index ecccb2a5f..35bd438e8 100644 --- a/.github/workflows/run-traits-tests.yml +++ b/.github/workflows/run-traits-tests.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] runs-on: ${{ matrix.os }} diff --git a/.github/workflows/test-from-pypi.yml b/.github/workflows/test-from-pypi.yml index fe0d4c60a..f62d0e3b4 100644 --- a/.github/workflows/test-from-pypi.yml +++ b/.github/workflows/test-from-pypi.yml @@ -10,7 +10,7 @@ jobs: test-pypi-sdist: strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] platform: - os: ubuntu-latest architecture: x64 @@ -44,7 +44,7 @@ jobs: test-pypi-wheel: strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] platform: - os: ubuntu-latest architecture: x64 From afc90c3ee2b1f49effbdb36b27a089ebb3197d50 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Fri, 24 Jan 2025 20:43:00 +0000 Subject: [PATCH 4/5] Add changelog entry for #1826 backport --- CHANGES.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 025080344..5aa27ec92 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,6 +14,10 @@ Fixes * Make ``traits.trait_notifiers.ui_handler`` public again, since Pyface relies on importing it directly. (#1827) +Build +~~~~~ +* Include Python 3.13 in all test workflows. + Release 7.0.1 ------------- From 21d86a2bcf0340f5b45d7c893d4e3e411237a39d Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Fri, 24 Jan 2025 20:45:36 +0000 Subject: [PATCH 5/5] Add missing PR number --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 5aa27ec92..6b17ab17c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -16,7 +16,7 @@ Fixes Build ~~~~~ -* Include Python 3.13 in all test workflows. +* Include Python 3.13 in all test workflows. (#1826) Release 7.0.1