|
1 | 1 | Traits CHANGELOG |
2 | 2 | ================ |
3 | 3 |
|
| 4 | +Release 6.3.0 |
| 5 | +------------- |
| 6 | + |
| 7 | +Released: 2021-10-08 |
| 8 | + |
| 9 | +Traits 6.3 is the latest feature release in the Traits 6 series, with several |
| 10 | +improvements and fixes over Traits 6.2. |
| 11 | + |
| 12 | + |
| 13 | +Highlights of this release |
| 14 | +~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 | + |
| 16 | +* There have been various minor performance improvements to the core |
| 17 | + ``on_trait_change`` and ``observe`` machinery. These may improve |
| 18 | + startup time for some Traits-using applications. |
| 19 | +* The ``observe`` mini-language now has in-language support for listening |
| 20 | + to all traits, using the ``*`` character. |
| 21 | +* Support for Python 3.10 has been added. |
| 22 | + |
| 23 | + |
| 24 | +Migration guide |
| 25 | +~~~~~~~~~~~~~~~ |
| 26 | + |
| 27 | +Traits 6.3 is intended to be fully backwards compatible with Traits 6.2, and |
| 28 | +most projects should have no difficulties upgrading. However, you may see |
| 29 | +some new deprecation warnings for existing code, warning about behaviour |
| 30 | +that will be changed in Traits 7.0. There are two particular sets of changes |
| 31 | +to look out for: |
| 32 | + |
| 33 | +* Starting with Traits 7.0, the ``Any`` trait type will treat a default |
| 34 | + value of type ``list`` or ``dict`` differently. Currently, instances of |
| 35 | + ``list`` and ``dict`` are special-cased, and a per-instance copy of the |
| 36 | + default is provided to each ``HasTraits`` instance. In Traits 7.0, this |
| 37 | + special-casing will be removed, and the default value will be shared between |
| 38 | + all instances. For the 6.3 release of Traits, a deprecation warning is issued |
| 39 | + whenever a trait definition of the form ``Any([1, 2, 3])`` or ``Any({})`` |
| 40 | + is encountered. Users can retain the existing behaviour and suppress the |
| 41 | + warning by changing their code to use the new ``factory`` argument to the |
| 42 | + ``Any`` trait type, for example replacing a trait declaration ``foo = |
| 43 | + Any({})`` with ``foo = Any(factory=dict)``, and a trait declaration ``foo = |
| 44 | + Any([1, 2, 3])`` with ``foo = Any(factory=list, args=([1, 2, 3],))``. |
| 45 | + |
| 46 | +* Starting with Traits 7.0, the ``Date`` trait type will no longer accept |
| 47 | + ``datetime`` instances by default. Traits 6.3 will issue a deprecation |
| 48 | + warning whenever a ``datetime`` instance is assigned as a value for |
| 49 | + a ``Date`` trait. The existing behaviour can be preserved and the warning |
| 50 | + silenced by using ``Date(allow_datetime=True)``; alternatively, you can |
| 51 | + use ``Date(allow_datetime=False)`` to adopt the Traits 7.0 behaviour |
| 52 | + right now. |
| 53 | + |
| 54 | + |
| 55 | +Detailed PR-by-PR changes |
| 56 | +~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 57 | + |
| 58 | +Over 80 pull requests went into this release. The following people contributed |
| 59 | +to the release: |
| 60 | + |
| 61 | +* 0xflotus |
| 62 | +* Aaron Ayres |
| 63 | +* Kit Choi |
| 64 | +* Mark Dickinson |
| 65 | +* Chigozie Nri |
| 66 | +* Poruri Sai Rahul |
| 67 | +* Corran Webster |
| 68 | +* John Wiggins |
| 69 | +* Peter Zahemszky |
| 70 | + |
| 71 | +Thank you to all who contributed! |
| 72 | + |
| 73 | + |
| 74 | +Features |
| 75 | +~~~~~~~~ |
| 76 | + |
| 77 | +* The ``observe`` mini-language now supports use of ``"*"`` for listening to |
| 78 | + all traits on a ``HasTraits`` object. Currently this support is limited to |
| 79 | + cases where the ``"*"`` appears in a terminal position. For example, |
| 80 | + ``observe("foo:*")`` is supported, but ``observe("*:foo")`` is not. |
| 81 | + (#1496, #1525) |
| 82 | +* The ``Any`` trait type now supports a ``factory`` argument (with accompanying |
| 83 | + ``args`` and ``kw`` arguments). This can be used to specify a per-instance |
| 84 | + default, for example with ``Any(factory=dict)``. (#1557, #1558) |
| 85 | +* The ``DefaultValue`` enumeration has a new member ``DefaultValue.disallow`` |
| 86 | + intended to be used for trait types that don't have a meaningful default. For |
| 87 | + traits using this default value type, an attempt to retrieve the |
| 88 | + corresponding default using ``default_value_for`` will raise ``ValueError``. |
| 89 | + (#1546) |
| 90 | +* When a method is decorated with an ``observe`` decorator, the method |
| 91 | + signature is now checked, and a warning issued if it doesn't match the |
| 92 | + expected signature. This should catch the common error of forgetting to |
| 93 | + provide the ``event`` parameter. (#1529) |
| 94 | +* In ``ETSToolkit``, the ``"qt"`` toolkit name is now supported as a synonym |
| 95 | + for ``"qt4"``. (#1436) |
| 96 | +* The ``Date``, ``Datetime`` and ``Time`` trait types have a new argument |
| 97 | + ``allow_none``. In the future, these trait types will not accept ``None`` |
| 98 | + unless ``allow_none=True`` is specified. (#1432) |
| 99 | +* The ``Date`` trait type has a new argument ``allow_datetime``. In the future, |
| 100 | + ``datetime`` instances will not be valid values for a ``Date`` trait unless |
| 101 | + ``allow_datetime=True`` is specified. (#1429) |
| 102 | + |
| 103 | + |
| 104 | +Performance |
| 105 | +~~~~~~~~~~~ |
| 106 | + |
| 107 | +* The ``ObserverGraph`` instances that result from compiling |
| 108 | + ``ObserverExpression`` objects and observe mini-language strings are now |
| 109 | + cached. This should speed up creation and instantiation of ``HasTraits`` |
| 110 | + subclasses that involve listening for the same pattern in multiple places. |
| 111 | + (#1516, #1528) |
| 112 | +* The equality definition on ``ObserverExpression`` has been simplified. |
| 113 | + (#1517) |
| 114 | +* The ``ObserverExpression``, ``ObserverGraph`` and related |
| 115 | + classes now use ``__slots__`` to improve speed and memory use. (#1513, #1515) |
| 116 | +* The ``on_trait_change`` method has been sped up by almost a factor of two, |
| 117 | + by removing unnecessary internal usage of Traits in the parsing and listener |
| 118 | + functionality. (#1490, #1491, #1492, #1493) |
| 119 | + |
| 120 | + |
| 121 | +Changes |
| 122 | +~~~~~~~ |
| 123 | + |
| 124 | +* An invalid static default value in a ``PrefixList`` or ``PrefixMap`` trait |
| 125 | + declaration now raises ``ValueError`` rather than ``TraitError``. (#1564) |
| 126 | +* ``PrefixList`` and ``PrefixMap`` no longer cache completions. (#1564) |
| 127 | +* A failure to parse an ``observe`` mini-language string now raises |
| 128 | + ``ValueError`` rather than ``LarkError``. (#1507) |
| 129 | +* The ``NotifierNotFound`` exception is now published in |
| 130 | + ``traits.observation.api``. (#1498) |
| 131 | +* An attempt to access a nonexistent "dunder" attribute (an attribute whose |
| 132 | + name starts and ends with "__") on a ``CTrait`` instance will now raise |
| 133 | + ``AttributeError``. Previously, it would return ``None``. (#1469, #1474, |
| 134 | + #1477) |
| 135 | + |
| 136 | + |
| 137 | +Deprecations |
| 138 | +~~~~~~~~~~~~ |
| 139 | + |
| 140 | +* The ``Any`` trait type currently implicitly makes a per-``HasTraits``-instance |
| 141 | + copy of the default value if that value is an instance of either ``list`` or |
| 142 | + ``dict``. This behaviour is deprecated, and will be removed in Traits 7.0. |
| 143 | + For a per-instance default, use the new ``factory`` argument to ``Any`` |
| 144 | + instead. (#1548, #1532) |
| 145 | +* The ``Date``, ``Datetime`` and ``Time`` trait types will no longer accept |
| 146 | + ``None`` as a valid trait value in the future. To keep the existing |
| 147 | + behaviour, use the new ``allow_none`` keyword argument to these trait types. |
| 148 | + (#1444) |
| 149 | +* The ``Date`` trait type will no longer accept ``datetime`` instances by |
| 150 | + default in the future. To keep the existing behaviour, use the new |
| 151 | + ``allow_datetime`` keyword argument. (#1441) |
| 152 | +* The ``Symbol`` trait type is deprecated. For resolution of a string |
| 153 | + representing a package/module/object combination, use ``import_symbol`` |
| 154 | + instead. (#1542) |
| 155 | +* The ``MetaHasTraits.add_listener`` and ``MetaHasTraits.remove_listener`` |
| 156 | + methods are deprecated. (#1550) |
| 157 | +* The ``clean_filename`` and ``clean_timestamp`` utilities are deprecated. If |
| 158 | + you need these utilities in your own project, you're advised to copy the |
| 159 | + code directly into your project. (#1527) |
| 160 | +* The ``find_resource`` and ``store_resource`` functions are deprecated. New |
| 161 | + code should use ``importlib.resources`` or ``importlib_resources`` instead |
| 162 | + of either of these functions. (#1501) |
| 163 | + |
| 164 | + |
| 165 | +Fixes |
| 166 | +~~~~~ |
| 167 | + |
| 168 | +* Invalid assignments to ``PrefixList`` and ``PrefixMap`` traits produced |
| 169 | + an unnecessarily nested exception. This has been fixed. (#1564) |
| 170 | +* An ``observe``-decorated listener method whose name has the special form |
| 171 | + ``"_traitname_changed"`` will no longer be triggered both as as result |
| 172 | + of the ``observe`` decorator *and* the special naming: it will only be |
| 173 | + triggered via the ``observe`` decorator. (#1560) |
| 174 | +* The ``delegate`` parameter was mistyped in the typing stubs for the |
| 175 | + ``Delegate`` trait type. This has been fixed. (#1556) |
| 176 | +* The ``Function`` and ``Method`` trait types will no longer fail when |
| 177 | + arguments are passed. Note that these trait types are already deprecated, and |
| 178 | + should not be used in new code. (#1543) |
| 179 | +* Inner traits of a ``Union`` trait are now validated properly. Previously, in |
| 180 | + trait declarations like ``foo = Union(List(Int), Str)``, the list entries |
| 181 | + would not be validated. (#1522, #1534) |
| 182 | +* Traits with a dynamic default that appear as inner traits of a ``Tuple`` |
| 183 | + trait are now validated properly. (#1521) |
| 184 | +* A potential race condition in ``ListenerHandler`` has been fixed. The |
| 185 | + race condition is hard to exercise and has not been witnessed in the wild. |
| 186 | + (#1495) |
| 187 | +* Use of ``add_class_trait`` to add a ``List`` trait was broken in the presence |
| 188 | + of subclasses. This has been fixed. (#1461) |
| 189 | +* A use of the (deprecated) ``distutils`` library has been replaced with |
| 190 | + ``sysconfig``. (#1452) |
| 191 | +* Dynamic default handing has been fixed in the ``_instance_handler_factory`` |
| 192 | + used by the TraitsUI ``TableEditor``. (#1446, #1450) |
| 193 | +* The trait descriptions (the "info" text) for the ``File`` and ``Directory`` |
| 194 | + traits have been fixed to avoid giving a misleading error message when |
| 195 | + ``exists=True``. (#1440) |
| 196 | +* Clones of ``BaseInstance`` traits didn't correctly respect the ``allow_none`` |
| 197 | + parameter. This is now fixed. (#1433) |
| 198 | +* An outdated reference to the "pyglet" Kiva backend has been removed. (#1431) |
| 199 | + |
| 200 | + |
| 201 | +Documentation |
| 202 | +~~~~~~~~~~~~~ |
| 203 | + |
| 204 | +* Brief installation docs have been added. (#1559) |
| 205 | +* Occurrences of ``Any(some_list)`` in docs have been replaced. (#1547) |
| 206 | +* The documentation for ``sync_trait`` has been updated to note that it only |
| 207 | + synchronises items for ``List`` traits, not for ``Dict`` and ``Set`` traits. |
| 208 | + (#1519) |
| 209 | +* A configuration file for Read the Docs has been added. (#1478) |
| 210 | +* A ``DeprecationWarning`` arising from an unnecessary override of the |
| 211 | + ``add_content`` method in the ``TraitDocumenter`` has been fixed. (#1475) |
| 212 | +* The Sphinx version was temporarily pinned to avoid build failures arising |
| 213 | + from bugs in Sphinx 4.0.1. That pin has since been reverted. |
| 214 | + (#1471, #1462) |
| 215 | +* Various docstring fixes have been applied. (#1468, #1465) |
| 216 | +* Various typo fixes have been applied. (#1458, #1442) |
| 217 | +* References to ``HasTraits.set`` have been replaced with |
| 218 | + ``HasTraits.trait_set``. (#1451) |
| 219 | +* Some issues with the tutorial CSS used in the ETS demo application have been |
| 220 | + fixed; the colour scheme has been changed to Enthought colours. (#1421, |
| 221 | + #1419) |
| 222 | + |
| 223 | + |
| 224 | +Cleanup and refactoring |
| 225 | +~~~~~~~~~~~~~~~~~~~~~~~ |
| 226 | + |
| 227 | +* All built-in TraitType subclasses now provide the default value type directly |
| 228 | + rather than inferring it. (#1555, #1536, #1531, #1539, #1532, #1540) |
| 229 | +* The ``trait_added`` and ``trait_modified`` traits on ``HasTraits`` now |
| 230 | + have proper trait type declarations. (#1552) |
| 231 | +* Redundant ``unittest.main blocks`` have been removed. (#1545) |
| 232 | +* Style fixes have been applied to ``trait_types.pyi``. (#1523) |
| 233 | +* ``ObserverExpression`` and other key observation classes now have more |
| 234 | + debug-friendly ``repr`` implementations. (#1514) |
| 235 | +* The ``observer`` parsing internals have been reworked to make |
| 236 | + ``ObserverGraph`` the key "compiled" object that the rest of Traits cares |
| 237 | + about, rather than ``ObserverExpression``. (#1512) |
| 238 | +* The grammar and parser for the observe mini-language have been simplified. |
| 239 | + (#1506) |
| 240 | +* Confusion between "any_trait" and "anytrait" in non-user-facing |
| 241 | + functions and classes has been cleaned up. (#1497) |
| 242 | +* Unnecessary ``noqa`` markers have been removed. (#1499) |
| 243 | +* A use of the ``property`` callable has been replaced with a ``property`` |
| 244 | + decorator. (#1470) |
| 245 | +* A bad observe-decorated listener signature in a test has been fixed. (#1530) |
| 246 | + |
| 247 | + |
| 248 | +Build and development workflow |
| 249 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 250 | + |
| 251 | +* Python 3.10 is supported and tested, and wheels are built for Python 3.10. |
| 252 | + (#1425, #1567, #1569, #1571) |
| 253 | +* Wheels are now built for Linux/aarch64. (#1567) |
| 254 | +* Universal wheels are now built for macOS, to support Apple Silicon. (#1567) |
| 255 | +* Cron jobs now send failure/success Slack notifications to Enthought's |
| 256 | + internal channel. (#1481) |
| 257 | +* All cron jobs now include a ``workflow_dispatch`` trigger. (#1480) |
| 258 | +* The main development branch is now called "main" rather than "master". |
| 259 | + (#1467) |
| 260 | +* Automated tests have been added for PyPI wheels. (#1417) |
| 261 | + |
| 262 | + |
4 | 263 | Release 6.2.0 |
5 | 264 | ------------- |
6 | 265 |
|
|
0 commit comments