Traits 7.0.0
This is a major release of the Traits package. Some highlights:
- Python versions through Python 3.13 are now supported.
- The Traits package now includes (partial) type hints. (Type hints
were previously distributed in a separatetraits-stubs
package.) - There is some experimental and provisional support for async
observer dispatch. - Many long-deprecated pieces of functionality have finally been removed
from the codebase.
Detailed changes
The following people contributed code changes and reviews for this release:
- Mark Dickinson
- Robert Haschke
- Chengyu Liu
- Frank Longford
- Sai Rahul Poruri
- Matt Smarte
- Corran Webster
Features
- The traits package now ships with stub files directly, instead of requiring
those files to be installed via the separatetraits-stubs
package.
(#1714) - Experimental support for async dispatch has been added. This API should
be considered provisional, and may change in the future. (#1771) - Python versions through 3.13 are now supported. (#1773)
- Event types
TraitChangeEvent
,ListChangeEvent
,DictChangeEvent
andSetChangeEvent
for theevent
received by observers are now
available intraits.observation.api
. This is useful for those wanting to
use the types in type annotations. (#1805)
Changes
- The behaviour of observers using
dispatch="ui"
when no GUI system is
present (in particular, if Pyface has not performed toolkit selection)
has changed. Previously, if such an observer was triggered then
it would raise an exception. Now it will raise with a clear error message
if triggered from a thread other than the main thread, and will execute
synchronously if triggered on the main thread. (#1740) AttributeError
s raised bysome_trait_default
methods are
no longer swallowed. (#1762)- The
Date
trait type no longer acceptsdatetime
instances
unlessallow_datetime=True
is used. (#1736) - The
Date
,Time
andDatetime
trait types no longer
accept a value ofNone
unlessallow_none=True
is used. (#1736) - Calling an interface class no longer performs implicit adaptation.
Adaptation must be performed explicitly, using theadapt
function.
(#1719)
Removals
- Python versions earlier than 3.8 are no longer supported. (#1773)
- Removed deprecated
rich_compare
Trait metadata. (#1698) - Removed deprecated
find_resource
andstore_resource
functions. (#1697) - Removed deprecated
TraitList
,TraitDict
andTraitTuple
classes.
(#1634) - Removed the deprecated ability of
cTrait.default_value
to set the default
value of a trait. It can now only be used for getting, not for setting.
(#1632) - Removed the deprecated
typecode
parameter toArray
trait types.
(#1633) - Removed the deprecated
nose_tools
module. (#1636) - Removed the deprecated
Long
,CLong
,BaseLong
andBaseCLong
trait types. UseInt
,CInt
,BaseInt
andBaseCInt
instead.
(#1701) - Removed the deprecated
TraitPrefixList
andTraitPrefixMap
classes.
UsePrefixList
andPrefixMap
instead. (#1703) - Removed the deprecated
Function
,Method
andSymbol
trait types.
(#1819) - Removed the deprecated
SingletonHasTraits
,SingletonHasStrictTraits
andSingletonHasPrivateTraits
classes. (#1794) - Removed the deprecated
HasTraits.get
andHasTraits.set
methods.
(#1738) - Removed the deprecated
MetaHasTraits.add_listener
and
MetaHasTraits.remove_listener
methods. (#1730) - Removed the deprecated
Color
,RGBColor
andFont
traits.
Code that needs these trait types should import them from TraitsUI instead.
(#1737) - Removed the deprecated trait type aliases
ListInt
,ListFloat
,
ListStr
,ListUnicode
,ListComplex
,ListBool
,
ListFunction
,ListMethod
,ListThis
,DictStrAny
,
DictStrStr
,DictStrInt
,DictStrFloat
,DictStrBool
,
DictStrList
. (#1723) - Removed the deprecated
clean_filename
andclean_timestamp
utilities. (#1820)
Fixes
- Fixed build error on Python 3.13 triggered by removal of the
PyTRASHCAN_SAFE_BEGIN
andPyTRASHCAN_SAFE_END
macros. (#1767) - Fixed warning messages from use of
PyDict_GetItem
in Python >= 3.13.
(#1818) - Fixed a race condition in test of background thread notification. (#1798)
- Fixed missing observer registration when inserting into a nested
list. (#1761) - Fixed a use of the deprecated
datetime.datetime.utcnow
method. (#1758) - Fixed a use of a deprecated TraitsUI version check. (#1746)
- Fixed various type stubs. (#1718)
Tests
- Reworked
ui_dispatch
tests to no longer require Qt. (#1792) - Removed Cython-based tests (after fixing them). (#1793, #1759)
- Fixed two tests that were triggering TraitsUI deprecation warnings. (#1790)
- Remove uses of
UITester
from the test suite. (#1788) - Fix a fragile
configure_traits
test that could fail on warnings unrelated
to the test goal. (#1749)
Build and continuous integration
- Added Python 3.11 to the workflow that tests wheels from PyPI. (#1715)
- Added dependabot config to aid keeping GitHub Actions up to date. (#1776)
- Brought various GitHub Actions up to date. (#1814, #1810, #1808,
#1807, #1800, #1799, #1797, #1796, #1780, #1779, #1778, #1777) - Removed uses of the
voxmedia
action for Slack notification. (#1782) - Fix the set of architectures tested in the PyPI workflow. (#1795)
- Removed PySide as a test dependency. (#1791)
- Fixed a couple of compiler warnings related to integer conversions in the
Windows build. (#1774) - Temporarily pinned the Python 3.13 version to avoid an upstream bug with
Python 3.13.0a4. (#1775, #1773) - Updated workflows for Python 3.12 support. (#1757)
- Updated workflows for compatibility with Ubuntu 22.04. (#1727)
- Updated workflows to use Python 3.11 final. (#1725)
- Moved cibuildwheel config to
pyproject.toml
. (#1717) - Temporarily pinned
setuptools
to avoid an incompatibility with EDM
runtimes. (#1722) - The PyPI release workflow has been modernized. (#1716)
Documentation
- Clarify behaviour of observers listening to
attr1:attr2
. (#1806) - Fixed Trait documenter tests for Sphinx >= 7.2. (#1755)
- Fixed inconsistent spacing style in docs. (#1728)