Traits

Latest version: v6.4.3

Safety actively analyzes 628924 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 5 of 8

6.1.1

-------------

A bugfix release to correct some critical issues with the TreeEditor.

Fixes
~~~~~
* Fix TreeNodeObject listener cache (558).
* Fix tree node insertion (561).

6.1

several major improvements.

Highlights of this release
~~~~~~~~~~~~~~~~~~~~~~~~~~

* A new :mod:`observation <traits.observation>` framework for observing traited
attributes and other observable objects has been introduced. This is intended
to provide a full replacement for the existing :func:`on_trait_change`
mechanism, and aims to fix a number of fundamental flaws and limitations of
that mechanism. See the :ref:`observe-notification` section of
the user manual for an introduction to this framework.

* New :class:`~traits.trait_list_object.TraitList`,
:class:`~traits.trait_dict_object.TraitDict` and
:class:`~traits.trait_set_object.TraitSet` classes have been added,
subclassing Python's built-in :class:`python:list`, :class:`python:dict` and
:class:`python:set` (respectively). Instances of these classes are observable
objects in their own right, and it's possible to attach observers to them
directly. These classes were primarily introduced to support the new
observation framework, and are not expected to be used directly. The API for
these objects and their notification system is provisional, and may change in
a future Traits release.

* A new :class:`.Union` trait type has been added. This is intended as a
simpler replacement for the existing :class:`.Either` trait type, which
will eventually be deprecated.

* New :class:`.PrefixList`, :class:`.PrefixMap` and :class:`.Map` trait types
have been added. These replace the existing :class:`.TraitPrefixList`,
:class:`.TraitPrefixMap` and :class:`.TraitMap` subclasses of
:class:`.TraitHandler`, which are deprecated.

* Typing stubs for the Traits library have been added in a
``traits-stubs`` package, which will be released separately to PyPI. This
should help support Traits-using projects that want to make use of type
annotations and type checkers like `mypy <http://mypy-lang.org/>`_.


Notes on upgrading
~~~~~~~~~~~~~~~~~~

As far as possible, Traits 6.1 is backwards compatible with Traits 6.0.
However, there are a few things to be aware of when upgrading.

* Traits 6.1 is not compatible with TraitsUI versions older than TraitsUI 7.0.
A combination of Traits 6.1 or later with TraitsUI 6.x or earlier will fail
to properly recognise :class:`~traitsui.view.View` class variables as
TraitsUI views, and an error will be raised if you attempt to create a
TraitsUI view.

* Traits now does no logging configuration at all, leaving all such
configuration to the application.

In more detail: trait notification handlers should not raise exceptions in
normal use, so an exception is logged whenever a trait notification handler
raises. This part of the behaviour has not changed. What *has* changed is the
way that logged exception is handled under default exception handling.

Previously, Traits added a :class:`~logging.StreamHandler` to the
top-level ``"traits"`` logger, so that trait notification exceptions would
always be visible. Traits also added a :class:`~logging.NullHandler` to that
logger. Both of those handlers have now been removed. We now rely on
Python's "handler of last resort", which will continue to make notification
exceptions to the user visible in the absence of any application-level
log configuration.

* When listening for changes to the items of a :class:`.List` trait, an index
or slice set operation no longer performs an equality check between the
replaced elements and the replacement elements when deciding whether to issue
a notification; instead, a notification is always issued if at least one
element was replaced. For example, consider the following class::

class Selection(HasTraits):
indices = List(Int)

on_trait_change("indices_items")
def report_change(self, event):
print("Indices changed: ", event)

When replacing the `8` with the same integer, we get this behavior::

>>> selection = Selection(indices=[2, 5, 8])
>>> selection.indices[2] = 8
Indices changed: TraitListEvent(index=2, removed=[8], added=[8])

Previously, no notification would have been issued.

* The :func:`.Color`, :func:`.RGBColor` and :func:`.Font` trait factories
have moved to TraitsUI, and should be imported from there rather than from
Traits. For backwards compatibility, the factories are still
available in Traits, but they are deprecated and will eventually
be removed.

* As a reminder, the :data:`.Unicode` and :data:`.Long` trait types are
deprecated since Traits 6.0. Please replace uses with :class:`.Str` and
:class:`.Int` respectively. To avoid excessive noise in Traits-using
projects, Traits does not yet issue deprecation warnings for existing uses of
:data:`.Unicode` and :data:`.Long`. Those warnings will be introduced in a
future Traits release, prior to the removal of these trait types.


Pending deprecations
~~~~~~~~~~~~~~~~~~~~

In addition to the deprecations listed in the changelog below, some parts of
the Traits library are not yet formally deprecated, but are likely to be
deprecated before Traits 7.0. Users should be aware of the following possible
future changes:

* The :class:`.Either` trait type will eventually be deprecated. Where
possible, use :class:`.Union` instead. When replacing uses of
:class:`.Either` with :class:`.Union`, note that there are some significant
API and behavioral differences between the two trait types, particularly with
respect to handling of defaults. See :ref:`migration_either_to_union` for
more details.

* The ``trait_modified`` event trait that's present on all :class:`.HasTraits`
subclasses will eventually be removed. Users should not rely on it being
present in an object's ``class_traits`` dictionary.

* Trait names starting with ``trait``, ``traits``, ``_trait`` or
``_traits`` may become reserved for use by ETS at some point in the future.
Avoid using these names for your own traits.

Detailed PR-by-PR changes
~~~~~~~~~~~~~~~~~~~~~~~~~

More than 160 PRs went into this release. The following people contributed
code changes for this release:

* Ieva Cernyte
* Kit Yan Choi
* Maxime Costalonga
* Mark Dickinson
* Matt Hancock
* Midhun Madhusoodanan
* Shoeb Mohammed
* Franklin Ventura
* Corran Webster

Features
~~~~~~~~

* Add ``os.PathLike`` support for ``Directory`` traits. (867)
* Add ``Union`` trait type. (779, 1103, 1107, 1116, 1115)
* Add ``PrefixList`` trait type. (871, 1142, 1144, 1147)
* Add ``allow_none`` flag for ``Callable`` trait. (885)
* Add support for type annotation. (904, 1064)
* Allow mutable values in ``Constant`` trait. (929)
* Add ``Map`` and ``PrefixMap`` trait types. (886, 953, 956, 970, 1139,
1189)
* Add ``TraitList`` as the base list object that can perform validation
and emit change notifications. (912, 981, 984, 989, 999, 1003, 1011,
1026, 1009, 1040, 1172, 1173)
* Add ``TraitDict`` as the base dict object that can perform validation and
emit change notifications. (913)
* Add ``TraitSet`` as the base set object that can perform validation and
emit change notifications. (922, 1043)
* Implement ``observe`` to supersede ``on_trait_change`` for observing trait
changes. (976, 1000, 1007, 1065, 1023, 1066, 1070, 1069, 1067,
1080, 1082, 1079, 1071, 1072, 1075, 1085, 1089, 1078, 1093, 1086,
1077, 1095, 1102, 1108, 1110, 1112, 1117, 1118, 1123, 1125, 1126,
1128, 1129, 1135, 1156)

Changes
~~~~~~~

* GUI applications using Traits 6.1 will require TraitsUI >= 7.0. (1134)
* ``TraitSetEvent`` and ``TraitDictEvent`` initialization arguments are now
keyword-only. (1036)
* ``TraitListObject`` will no longer skip notifications even if mutations
result in content that compares equally to the old values. (1026)
* ``TraitListEvent.index`` reported by mutations to a list is now normalized.
(1009)
* The default notification error handler for Traits no longer configures
logging, and the top-level ``NullHandler`` log handler has been removed.
(1161)

Fixes
~~~~~
* Allow assigning None to ``CTrait.post_setattr``. (833)
* Fix reference count error. (907)
* Improve ``HasTraits`` introspection with ``dir()``. (927)
* Fix the datetime-to-str converters used in ``DatetimeEditor``. (937)
* Raise ``TraitNotificationError`` on trailing comma in ``on_trait_change``.
(926)
* Fix exception swallowing by Trait attribute access. (959, 960)
* Allow collections in valid values for ``Enum`` trait. (889)
* Fix ``TraitError`` when mutating a list/dict/set inside another container.
(1018)
* Fix setting default values via dynamic default methods or overriding trait in
subclasses for mapped traits, used by ``Map``, ``Expression``, ``PrefixMap``.
(1091, 1188)
* Fix setting default values via dynamic default methods or overriding trait in
subclasses for ``Expression`` and ``AdaptsTo``. (1088, 1119, 1152)

Deprecations
~~~~~~~~~~~~

* ``traits.testing.nose_tools`` is deprecated. (880)
* ``SingletonHasTraits``, ``SingletonHasStrictTraits`` and
``SingletonHasPrivateTraits`` are deprecated. (887)
* ``TraitMap`` is deprecated, use ``Map`` instead. (974)
* ``TraitPrefixMap`` is deprecated, use ``PrefixMap`` instead. (974)
* ``TraitPrefixList`` is deprecated, use ``PrefixList``. (974)
* ``Color``, ``RBGColor`` and ``Font`` are now deprecated. Use the ones from
TraitsUI instead. (1022)

Removals
~~~~~~~~

* ``traits_super`` is removed. (1015)

Documentation
~~~~~~~~~~~~~

* Add details on creating custom trait properties. (387)
* Cross reference special handler signatures for listening to nested attributes
in list and dict. (894)
* Replace 'Traits 5' with 'Traits 6' in the documentation. (903)
* Use major.minor version in documentation. (1124)
* Add initial documentation on Traits internals. (958)
* Fix example class ``OddInt``. (973)
* Add Dos and Donts for writing change handlers. (1017)
* Clarify when default initializer is called and when handlers are registered.
(1019)
* Fix documentation rendering issues and front matter. (1039, 1053)
* Clarify when dynamic default values are considered to have existed. (1068)
* Expand user manual on container traits and objects. (1058)
* Add intersphinx support to configuration. (1136)
* Add user manual section on the new ``observe`` notification system. (1060,
1140, 1143)
* Add user manual section on the ``Union`` trait type and how to migrate from
``Either`` (779, 1153, 1162)
* Other minor cleanups and fixes. (949, 1141, 1178)

Test suite
~~~~~~~~~~

* Allow tests to be skipped if TraitsUI is not installed. (1038)
* Add ``extras_require`` entry for testing. (879)
* Add tests for parsing ``on_trait_change`` mini-language. (921)
* Fix a missing import to allow a test module to be run standalone. (961)
* Add a GUI test for ``Enum.create_editor``. (988)
* Fix some module-level ``DeprecationWarning`` messages. (1157)

Build and continuous integration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* CI no longer runs on Python 3.5 (1044)
* Add configobj dependency and remove remaining 3.5 references in
``etstool.py``. (1051)
* Codecov reports are no longer retrieved for pull requests. (1109)
* CI tests requiring a GUI are now run against PyQt5 rather than PyQt4.
(1127)
* Add Slack notifications for CI. (1074)
* Fix and improve various ``setup.py`` package metadata fields. (1185)

Maintenance and code organization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Refactor CHasTraits ``traits_inited`` method. (842)
* Add support for prerelease section in version. (864)
* Rename comparison mode integer constants in ``ctraits.c``. (862)
* Follow best practices when opening files. (872)
* Initialize ``cTrait`` ``getattr``, ``setattr`` handlers in ``tp_new``. (875)
* Check ``trait_change_notify`` early in ``call_notifiers``. (917)
* Refactor ``ctraits.c`` for calling trait and object notifiers. (918)
* ``BaseEnum`` and ``Enum`` fixes and cleanup. (968)
* Split ``ctraits`` property api to ``_set_property`` and ``_get_property``.
(967)
* Fix overcomplicated ``__deepcopy__`` implementation. (992)
* Add ``__repr__`` implementation for ``TraitListEvent``, ``TraitDictEvent``
and ``TraitSetEvent``. (1006, 1148, 1149)
* Remove caching of editor factories. (1032)
* Remove conditional traitsui imports. (1033)
* Remove code duplication in ``tutor.py``. (1034)
* Fix correctness in ``Enum`` default traitsui editor. (1012)
* Use ``NULL`` for zero-argument ``PyObject_CallMethod`` format. (1100)
* Miscellaneous other minor fixes, refactorings and cleanups. (874, 882,
915, 920, 923, 924, 935, 939, 944, 950, 964)

6.1.0

-------------

This is an incremental release without many new features, but with
significant improvements in the code base and numerous small bugfixes.
Probably the most significant change, but one not obvious to most users
is that we have moved away from using 2to3 for Python 3 support to using
a single codebase with the six library to patch over the differences.
This significantly enhances maintainability and development speed, and
gives a better path forward for future Python versions.

Additionally, this release introduces experimental support for PySide2
(also known as "Qt for Python"). Pyside2 was enabled as a potential
backend in 6.0.0 but there was no testing being performed. As of this
release PySide2 is now tested as part of the CI system with tests passing
on Linux and OS X using the 5.11 release. There are currently issues with
the 5.12 release which have yet to be fully investigated.

The one significant new feature that has been added to this release is the
ability to completely replace the rendering of TreeEditorNodes with custom
rendering code on Qt (due to the limitations of the Wx tree control, this
is unlikely to be extended to Wx). An example showing the drawing of
sparkline plots in TreeEditor cells has been added to the code demos.

There has been a long-standing issue with the way that the Qt TableEditor
handled selections, and this release fixes this, matching the behaviour of
the Wx backend and the documentation. It is possible that this may break
code that was written expecting the buggy behaviour.

Finally, there are a large number of minor bug fixes

Thanks to:

Martin Bergtholdt, Stefano Borini, Alex Chabot, Kit Choi, Mark Dickinson,
Kevin Duff, Matthew Evans, Matt Hancock, Robert Kern, Fede Miorelli,
Rahul Poruri, Jenni Portman, Prabhu Ramachandran, ransonr, Jonathan Rocher,
Roger Serwy, Ajeet Vivekanandan, Corran Webster, John Wiggins.

Enhancemenrs
~~~~~~~~~~~~
* Switch to using six instead of 2to3 (482, 484, 486, 498, 531).
* Experimental Pyside2 support (451, 500, 504).
* Allow arbitrary rendering of tree nodes in Qt backend (499, 502, 527).
* Use tooltip metadata on a trait instead of desc, if available (473).
* Enable scroll to column for TabularEditor (547)
* Add demo for tabular editor with context menu (460).
* Allow the use of extended trait names in TreeNodes where possible (500, 528).
* Allow drag move and drag copy modes on Qt TabularEditor (363).

Fixes
~~~~~
* Fixes to README (478).
* Documentation fixes (471, 508).
* Fixes to setup.py (549).
* Fix an attribute error on Qt TextRangeEditor (540).
* Use SimpleEditor for Qt TextEditor's "text" style (535).
* Fix handling of Range traits with a mix of constant and named bounds (533).
* Fix display selection on Wx backend (534).
* Fixes for Qt TableEditor selections (275).
* Fix deprecation warnings for inspect.getargspec (530).
* Fixes to etstool (526).
* Fix TreeEditor unhashable type errors (525).
* Fix crash when TabularEditor has no columns (521).
* Clone editor factories so they don't share traits (519).
* Avoid creation of dummy traits by springy items (515).
* Fix drag and drop crash in Python 3 (516).
* Fix Undo/Redo for readonly items and error handling (510).
* Fix source parsing in demo app (501).
* Fix signature of close() method of Qt modal dialog (506).
* Fix incorrect code in Wx ColorEditor (479).
* Fix incorrect code in Wx ProgressEditor (513).
* Remove uses of deprecated HasTraits.set() calls (457).
* Fix rendering of CheckboxColumn on OS X and Qt (456).

6.0

backward incompatible changes from its predecessor. Notable changes:

* Python 2.7 is no longer supported; Traits 6.0 requires Python 3.5 or later.
* Trait types related to Python 2 (for example ``Unicode`` and ``Long``) have
been deprecated in favour of their Python 3 equivalents (for example ``Str``
and ``Int``).
* Many little-used historical features of Traits have been deprecated, and
are scheduled for removal in Traits 7.0.
* Some historical features of Traits that had no evidence of external usage
were removed in Traits 6.0.
* Introspection of ``CTrait`` and ``HasTraits`` objects is greatly improved.
All of the internal state that was previously hidden within the C extension
is now accessible from Python.
* The Traits codebase has undergone some significant reorganizations,
reformattings and style cleanups to make it easier to work with, and
to improve the separation between Traits and TraitsUI.
* This release was focused mainly on cleanup and bugfixing. Nevertheless,
it contains a sprinkling of new features. There's a new ``Datetime``
trait type. The ``Enum`` trait type now supports Python enumerations.
The ``File`` trait type supports path-like objects.

More than 150 PRs went into this release. The following people contributed
code changes for this release:

* Kit Yan Choi
* Mark Dickinson
* Kevin Duff
* Robert Kern
* Midhun Madhusoodanan
* Shoeb Mohammed
* Sai Rahul Poruri
* Corran Webster
* John Wiggins

Porting guide
~~~~~~~~~~~~~

For the most part, existing code that works with Traits 5.2.0 should
continue to work with Traits 6.0.0 without changes. However, there
are some potentially breaking changes in Traits 6.0.0, and we recommend
applying caution when upgrading.

Here's a guide to dealing with some of the potentially breaking changes.

* The ``Unicode`` and ``CUnicode`` trait types are now simply synonyms for
``Str`` and ``CStr``. ``Unicode`` and ``CUnicode`` are considered deprecated.
For now, no deprecation warning is issued on use of these deprecated trait
types, but in Traits 6.1.0 and later, warnings may be issued, and in Traits
7.0.0 these trait types may be removed. It's recommended that users update
all uses of ``Unicode`` to ``Str`` and ``CUnicode`` to ``CStr`` to avoid
warnings or errors in the future.

* Similarly, ``Long`` and ``CLong`` are now synonyms for ``Int`` and ``CInt``.
The same recommendations apply as for the ``Unicode`` / ``Str`` trait types.

* Uses of ``NO_COMPARE``, ``OBJECT_IDENTITY_COMPARE`` and ``RICH_COMPARE``
should be replaced with the appropriate ``ComparisonMode`` enumeration
members.

* The validation for a ``Instance(ISomeInterface)`` trait type has changed,
where ``ISomeInterface`` is a subclass of ``Interface``. Previously, an
assignment to such a trait validated the type of the assigned value against
the interface, method by method. Now an ``isinstance`` check is performed
against the interface instead. Make sure that classes implementing a given
interface have the appropriate ``provides`` decorator.

One notable side-effect of the above change is that plain ``mock.Mock``
instances can no longer be assigned to ``Instance(ISomeInterface)`` traits.
To get around this, use ``spec=ISomeInterface`` when creating your mock
object.

This change does not affect ``Instance`` traits for non-interface classes.

* The format of ``TraitListEvents`` has changed: for list events generated from
a slice set or slice delete operation where that slice had a step other
than ``1``, the ``added`` and ``removed`` fields of the event had an extra
level of list wrapping (for example, ``added`` might be ``[[1, 2, 3]]``
instead of ``[1, 2, 3]``). In Traits 6.0, this extra wrapping has been
removed. There may be existing code that special-cased the extra wrapping.

* Many classes and functions have moved around within the Traits codebase.
If you have code that imports directly from Traits modules and subpackages
instead of from ``traits.api`` or the other subpackage ``api`` modules, some
of those imports may fail. To avoid potential for ``ImportError``s, you
should import from ``traits.api`` whenever possible. If you find yourself
needing some piece of Traits functionality that isn't exposed in
``traits.api``, and you think it should be, please open an issue on the
Traits bug tracker.

Features
~~~~~~~~

* Add new ``Datetime`` trait type. (737, 814, 813, 815, 848)
* Support Python Enums as value sets for the ``Enum`` trait. (685, 828, 855)
* Add ``Subclass`` alias for the ``Type`` trait type. (739)
* Add path-like support for the ``File`` trait. (736)
* Add new ``ComparisonMode`` enumeration type to replace the old
``NO_COMPARE``, ``OBJECT_IDENTITY_COMPARE`` and ``RICH_COMPARE``
constants. The old constants are deprecated. (830, 719, 680)
* Add fast validation for ``Callable`` trait type; introduce
new ``BaseCallable`` trait type for subclassing purposes.
(798, 795, 767)
* Add ``CTrait.comparison_mode`` property to allow inspection and
modification of a trait's comparison mode. (758, 735)
* Add ``as_ctrait`` converter function to ``traits.api``. This function
converts a trait-like object or type to a ``CTrait``, raising ``TypeError``
for objects that can't be interpreted as a ``CTrait``. It's intended
for use by users who want to create their own parameterised trait
types.

The ``as_ctrait`` feature comes with, and relies upon, a new informal
interface: objects that can be converted to something of type ``CTrait`` can
provide an zero-argument ``as_ctrait`` method that returns a new ``CTrait``.
Types can provide an ``instantiate_and_get_ctrait`` method, which when
called with no arguments provides a new ``CTrait`` for that type.
(783, 794)
* Add a new ``HasTraits._class_traits`` method for introspection of an
object's class traits. This parallels the existing
``HasTraits._instance_traits`` method. This method is intended for use in
debugging. It's not recommended for users to modify the returned dictionary.
(702)
* Add ``CTrait.set_default_value`` method for setting information about the
default of a ``CTrait``. This provides an alternative to the previous method
of using ``CTrait.default_value``. The use of ``CTrait.default_value`` to set
(rather than get) default information is deprecated. (620)
* Add new methods ``HasTraits._trait_notifications_enabled``,
``HasTraits._trait_notifications_vetoed`` to allow introspection of the
notifications states set by the existing methods
``HasTraits._trait_change_notify`` and ``HasTraits._trait_veto_notify``.
(704)
* Add ``TraitKind``, ``ValidateTrait`` and ``DefaultValue`` Python enumeration
types to replace previous uses of magic integers within the Traits codebase.
(680, 857)
* The various ``CTrait`` internal flags are now exposed to Python as
properties: ``CTrait.is_property`` (read-only), ``CTrait.modify_delegate``,
``CTrait.setattr_original_value``, ``CTrait.post_setattr_original_value``,
``CTrait.is_mapped``, and ``CTrait.comparison_mode``. (666, 693)

Changes
~~~~~~~

* When pickling a ``CTrait``, the ``py_post_setattr`` and ``py_validate``
fields are pickled directly. Previously, callables for those fields were
replaced with a ``-1`` sentinel on pickling. (780)
* A ``TraitListEvent`` is no longer emitted for a slice deletion which
doesn't change the contents of the list. (For example, `del obj.mylist[2:]`
on a list that only has 2 elements.) (740)
* The ``added`` and ``removed`` attributes on a ``TraitListEvent`` are now
always lists containing the added or removed elements. Previously, those
lists were nested inside another list in some cases. (771)
* Change ``Instance(ISomeInterface)`` to use an ``isinstance`` check on
trait set instead of using the dynamic interface checker. (630)
* Create an new ``AbstractViewElement`` abstract base class, and register
the TraitsUI ``ViewElement`` as implementing it. This paves the way for
removal of Traits UI imports from Traits. (617)
* ``ViewElements`` are now computed lazily, instead of at ``HasTraits``
subclass creation time. This removes a ``traitsui`` import from
the ``trait.has_traits`` module. (614)
* The ``traits.util.clean_filename`` utility now uses a different algorithm,
and should do a better job with accented and Unicode text. (589)
* Floating-point and integer checks are now more consistent between classes.
In particular, ``BaseInt`` validation now matches ``Int`` validation, and
``Range`` type checks now match those used in ``Int`` and ``Float``. (588)
* An exception other than ``TraitError`` raised during validation of a
compound trait will now be propagated. Previously, that exception would
be swallowed. (581)
* Traits no longer has a runtime dependency on the ``six`` package. (638)
* Use pickle protocol 3 instead of pickle protocol 1 when writing pickled
object state to a file in ``configure_traits``. (796)
* In ``traits.testing.optional_dependencies``, make sure ``traitsui.api`` is
available whenever ``traitsui`` is. (616)
* ``TraitInstance`` now inherits directly from ``TraitHandler`` instead of
(the now removed) ``ThisClass``. (761)

Fixes
~~~~~

* Fix a use of the unsupported ``ValidateTrait.int_range``. (805)
* Remove unnecessary ``copy`` method override from ``TraitSetObject``. (759)
* Fix ``TraitListObject.clear`` to issue the appropriate items event. (732)
* Fix confusing error message when ``[None]`` passed into
``List(This(allow_none=False))``. (734)
* Fix name-mangling of double-underscore private methods in classes whose
name begins with an underscore. (724)
* Fix ``bytes_editor`` and ``password_editor`` bugs, and add tests for
all editor factories. (660)
* Fix coercion fast validation type to do an exact type check instead of
an instance check. This ensures that instances of subclasses of the
target type are properly converted to the target type. For example,
if ``True`` is assigned to a trait of type ``CInt``, the resulting
value is now ``1``. Previously, it was ``True``. (647)
* Fix ``BaseRange`` to accept the same values as ``Range``. (583)
* Fix integer ``Range`` to accept integer-like objects. (582)
* Fix floating-point ``Range`` to accept float-like values. (579)
* Fix a missing import in the adaptation benchmark script. (575)
* Fix issues with the ``filename`` argument to ``configure_traits``. (572)
* Fix a possible segfault from careless field re-assignments in
``ctraits.c``. (844)

Deprecations
~~~~~~~~~~~~

* The ``NO_COMPARE``, ``OBJECT_IDENTITY_COMPARE`` and ``RICH_COMPARE``
constants are deprecated. Use the corresponding members of the
``ComparisonMode`` enumeration instead. (719)
* The ``Unicode``, ``CUnicode``, ``BaseUnicode`` and ``BaseCUnicode`` trait
types are deprecated. Use ``Str``, ``CStr``, ``BaseStr`` and ``BaseCStr``
instead. (648)
* The ``Long``, ``CLong``, ``BaseLong`` and ``BaseCLong`` trait types are
deprecated. Use ``Int``, ``CInt``, ``BaseInt`` and ``BaseCInt`` instead.
(645, 573)
* The ``AdaptedTo`` trait type is deprecated. Use ``Supports`` instead. (760)
* The following trait type aliases are deprecated. See the documentation for
recommended replacments. ``false``, ``true``, ``undefined``, ``ListInt``,
``ListFloat``, ``ListStr``, ``ListUnicode``, ``ListComplex``, ``ListBool``,
``ListFunction``, ``ListMethod``, ``ListThis``, ``DictStrAny``,
``DictStrStr``, ``DictStrInt``, ``DictStrFloat``, ``DictStrBool``,
``DictStrList``. (627)
* Use of the ``filename`` argument to ``configure_traits`` (for storing
state to or restoring state from pickle files) is deprecated. (792)
* The ``TraitTuple``, ``TraitList`` and ``TraitDict`` trait handlers
are deprecated. Use the ``Tuple``, ``List`` and ``Dict`` trait types instead.
(770)
* Use of ``CTrait.default_value`` for setting default value information is
deprecated. Use ``CTrait.set_default_value`` instead. (620)
* Use of the ``rich_compare`` trait metadata is deprecated. Use the
``comparison_mode`` metadata instead. (598)

Removals
~~~~~~~~

* Python 2 compatibility support code has been removed. (638, 644)
* Traits categories have been removed. (568)
* The following trait handlers have been removed: ``ThisClass``,
``TraitClass``, ``TraitExpression``, ``TraitCallable``, ``TraitString``,
``TraitRange``, ``TraitWeakRef``. (782, 711, 699, 698, 625, 593, 587,
640)
* ``CTrait.rich_compare`` has been removed. (598)
* The ``cTrait.cast`` method has been removed. (663)
* The magical ``TraitValue`` and associated machinery have been removed. (658)
* The ``Generic`` trait type has been removed. (657)
* The ``UStr`` trait type and ``HasUniqueStrings`` class have been removed.
(654)
* The ``str_find`` and ``str_rfind`` helper functions have been removed. (633)
* The global ``_trait_notification_handler`` has been removed. (619)
* ``BaseTraitHandler.repr`` has been removed. (599)
* ``HasTraits.trait_monitor`` was undocumented, untested, and broken, and
has been removed. (570)
* The ``TraitInstance`` trait handler (not to be confused
with the ``Instance`` trait type) no longer supports adaptation. (641)
* The ``DynamicView`` and ``HasDynamicViews`` classes have been removed
from Traits and moved to TraitsUI instead. (609)
* ``DictStrLong`` has been removed. (573)

Test suite
~~~~~~~~~~

* Fix various tests to be repeatable. (802, 729)
* Fix deprecation warnings in the test suite output. (820, 804, 716)
* Add machinery for testing unpickling of historical pickles. (787)
* Remove print statements from test suite. (752, 768)
* Fix a test to clean up the threads it creates. (731)
* Add tests for extended trait change issues 537 and 538 (543)
* Other minor test fixes. (700, 821)

Documentation
~~~~~~~~~~~~~

* Improve documentation of trait container objects. (810)
* Improve documentation for the ``traits.ctraits`` module. (826, 824,
659, 653, 829, 836)
* Fix badly formatted ``TraitHandler`` documentation. (817)
* Fix and improve badly formatted trait types documentation. (843)
* Fix broken module links in section titles in API documentation. (823)
* Additional class docstring fixes. (854)
* Add changelog to built documentation, and absorb old changelog into
the new one. (800, 799)
* Remove deprecated traits from the user manual. (656)
* Fix various Sphinx warnings (717)
* Use SVG badges in README (567)

Build and continuous integration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Enable C asserts in Travis CI runs. (791)
* Abort CI on compiler warnings in Travis CI runs. (769)
* Run a ``flake8`` check in both Travis CI and Appveyor runs. (753, 762)
* Checking copyright statements in Python files as part of CI runs. (749)
* Turn warnings into errors when building documentation in CI. (744)
* Add ``gnureadline`` as a development dependency on macOS and Linux. (607)
* Add an ``etstool.py`` option to run tests quietly. (606)
* Enable the coverage extension for the documentation build. (807)
* Remove mocking in documentation configuration, and fix a deprecated
configuration option. (696)

Maintenance and code organization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This release includes a lot of refactoring and many minor improvements
that will primarily benefit those working with the Traits codebase. These
changes should not affect user-visible functionality. Here's a summary
of the more significant changes.

* A major refactor has removed most of the circular dependencies between
modules. (730)
* The codebase is now mostly ``flake8`` clean. (786, 753, 747, 748, 746,
595)
* Copyright headers have been made consistent for all Python files. (754)
* ``ctraits.c`` has been run through ``clang-tidy`` and ``clang-format`` in
order to bring it closer to PEP 7 style. (715)
* Editor factories have been moved into a new ``traits.editor_factories``
module, to help compartmentalize code dependencies on TraitsUI. (661)
* Trait container object classes (``TraitDictObject``, ``TraitListObject``,
``TraitSetObject``) have each been moved into their own module, along
with their associated event type. (677)
* Miscellaneous other minor fixes, refactorings and cleanups.
(785, 777, 750, 726, 714, 712, 708, 701, 682, 665, 651,
652, 639, 636, 634, 626, 632, 611, 613, 612, 605, 603,
600, 597, 586, 585, 584, 580, 577, 578, 564, 806)

6.0.0

-------------

This release introduces preliminary support for Qt5 via PyQt5, thanks to the
work of Gregor Thalhammer which got the ball rolling. Qt5 support is
not yet robustly tested in deployed applications, so there may yet be bugs to
find. As part of this effort all occurences of old-style signals and slots
have been removed; and this has greatly improved stability under Qt.

This release also features a great deal of work at the API level to disentangle
the two-way dependencies between Pyface and TraitsUI. This has involved moving
a number of sub-packages between the two libraries, most notably the zipped
image resource support and a number of trait definitions. We have endeavored
to keep backwards compatibility via stub modules in the original locations,
but we can't guarantee that there will be no issues with third party code
caused by the change in locations. We haven't been able to remove all
dependencies, but as of this release on the dock and workbench submodules have
required dependencies on TraitsUI.

As part of the latter work, support for TraitsUI Themes have been removed. This
was a feature that was only available under WxPython, was slow, was never used
in production code, and was not supported for over a decade. Some of the
codebase remains as it is still used by the Pyface Dock infrastructure and
several editors, but ther long-term intention is to remove this completely.

Another long-desired feature was the ability to write toolkit backends for
Pyface and TraitsUI that are not part of the main codebase. This is now
possible by contributing new toolkit backends to the "traitsui.toolkit"
pkg_resources entry point in a setup.py. This work was accompanied by an
overhaul of the toolkit discovery and loading infrastructure; in particular
Pyface and TraitsUI now share the same code for performing these searches
and loading the backends.

The entire TraitsUI codebase has been run through the AutoPEP8, assisted with
some customized fixups and occasional drive-by cleanups of code, which means
that the codebase is generally easier to read and follows modern Python
conventions.

Finally, the testing infrastructure has been overhauled to provide a one-stop
location to run tests in self-contained environments using Enthought's EDM
package management tool. Tests can be run from any python environment with the
"edm" command available and the "click" library installed with the "etstool.py"
script at the top level of the repository. In particular::

python etstool.py test_all

will run all relevant tests for all available toolkits in all supported
python versions. The TravisCI and Appveyor continuous integration tools have
been updated to make use of these facilities as well.

Thanks to Martin Bergtholdt, Alex Chabot, Kit Choi, Mark Dickinson, Robin Dunn,
Pradyun Gedam, Robert Kern, Marika Murphy, Pankaj Pandey, Steve Peak,
Prabhu Ramachandran, Jonathan Rocher, John Thacker, Gregor Thalhammer,
Senganal Thirunavukkarasu, John Tyree, Ioannis Tziakos, Alona Varshal,
Corran Webster, John Wiggins

Enhancements
~~~~~~~~~~~~
* Support for Qt5 (347, 352, 350, 433)
* Remove TraitsUI Themes (342)
* Improve Toolkit selection and handling (425, 429)
* API Documentation (438)
* Adapter documentation (340)
* Support multi-selection in DataFrameEditor (413)
* DataFrameEditor demo (444)
* Common BasePanel class for toolkits (392)
* Labels honor enable_when values (401)
* Better error messages when toolkit doesn't implement methods (391)
* Improve TraitsUI Action handling (384)
* ListEditor UI improvements (338, 396, 395)
* Remove old style signals and slots for Qt backend (330, 346, 347, 403)
* Expose a "refresh" trait for the DataFrameEditor (288)
* Use Enthought Deployment Manager to automate CI and testing (321, 357)
* Continuous integration on OS X (322)
* Reduce circular dependencies of Pyface on TraitsUI (304)
* PEP8-compliant formatting of source (290)
* Add progress bar column for TableEditor (287)
* Add codecov coverage reports (285, 328)

Fixes
~~~~~
* Fix some issues for newer WxPython (418)
* Fix Wx simple FileEditor (426)
* Fixes for DataFrameEditor (415)
* Fixes for preferences state saving under Qt (410, 447)
* Fix panel state after setting preferences (253)
* Fix TableEditor ColorColumn (399)
* Prevent loopback from slider in Qt RangeEditor (400)
* Fix Action buttons under Qt (393, 394)
* Fix ValueEditor icons (386)
* Fix bug in update_object (379)
* Avoid reading Event trait values in sync_value (375)
* Fix raise_to_debug calls (362, 372)
* Fix errors during garbage collection (359)
* Remove unused argument in wx.hook_events (360)
* Fix button label updates (358)
* Fix TreeEditor label updates (335)
* Proper InstanceEditor dialog lifecycle (332)
* Don't explicitly destroy child widgets under Qt (283)
* Test fixes and improvements (329, 369, 371, 327)
* Fixes for demos and examples (320, 445)
* Fix CheckListEditor string comparison (318)
* Remove some spurious print statements (305)
* Documentation fixes (301, 326, 380, 438, 443)
* Fixes for Python 3 compatibility (295, 300, 165, 311, 410)
* Fix error with Qt table model mimetype (296)
* Fixes for continuous integration (299, 345, 365, 397, 420, 427)
* Fix offset issue when dragging from Qt TreeEditor (293)
* Fix Wx kill-focus event issues (291)
* Fix readthedocs build (281)

6.0.0rc0

----------------

Released: 2020-01-30

Release notes
~~~~~~~~~~~~~

Page 5 of 8

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.