Skip to content

Commit

Permalink
Prepare for Traits 7.0.2 release (#1828)
Browse files Browse the repository at this point in the history
This PR prepares for a Traits 7.0.2 release:

* Backport PR #1827 and PR #1826
* Bump the version number
  • Loading branch information
mdickinson authored Jan 24, 2025
1 parent 79b0604 commit 928d069
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-traits-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-from-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
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)

Build
~~~~~
* Include Python 3.13 in all test workflows. (#1826)


Release 7.0.1
-------------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# into the package source.
MAJOR = 7
MINOR = 0
MICRO = 1
MICRO = 2
PRERELEASE = ""
IS_RELEASED = True

Expand Down
18 changes: 10 additions & 8 deletions traits/trait_notifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 928d069

Please sign in to comment.