Skip to content

Commit

Permalink
Backport bugfix PRs to the 6.1.x release branch (#1251)
Browse files Browse the repository at this point in the history
* Fix end-year in copyright statement (#1198)

(cherry picked from commit 21e2a99)

* Fix trait-documenter extension tests for Sphinx 3.1 (#1206)

(cherry picked from commit aeaf72f)

* DOC/FIX: User manual mentioning a nonexisting feature in metadata filter (#1207)

* Fix user manual erroneously mentioning a nonexisting feature

* Fix grammar

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
(cherry picked from commit 3e78a41)

* Spelling and grammar. (#1210)

(cherry picked from commit 24c4d76)

* Fix description in README to match the one in the setup script (#1219)

(cherry picked from commit a5dc3f2)

* Fix some missing stubs (#1204)

* Add a couple of missing imports to api.pyi

* Remove mis-spelled stubs file

* Add missing api.pyi stubs for the has_traits module

* Add CTrait

* Add imports for BaseTraitHandler and TraitHandler

* Add constants

(cherry picked from commit 47806c8)

* Standardize copyright years (#1227)

* Standardize copyright years

* Use hard-coded year in conf.py, for ease of later search-and-replace. Also normalise punctuation.

* More punctuation OCD

* More consistency fixes

* Remove unused import

* Remove the _right_ unused import

* Yet one more consistency fix

(cherry picked from commit aa63531)

* Don't mutate global state at import time in a test module (#1222)

(cherry picked from commit 24345a1)

* Fix typo in optional_dependencies (#1235)

Fix a comment that mistakenly refers to traits.api, when it means traitsui.api.

(cherry picked from commit a48ede5)

* Update PyPI links and capitalization in README.rst (#1250)

* Update PyPI links and capitalization in README.rst

This PR:
- updates incorrect and inconsistent capitalization in the README
- adds a PyPI link for Sphinx
- adds a PyPI link for the Enthought Sphinx Theme (the previous link was to GitHub)

* Clarify that later versions  of Sphinx are fine

* Update README.rst

(cherry picked from commit 8d03955)

* Update changelog

Co-authored-by: Kit Choi <kitchoi@users.noreply.github.com>
  • Loading branch information
mdickinson and kitchoi authored Jul 21, 2020
1 parent 48bf587 commit 76ecb14
Show file tree
Hide file tree
Showing 27 changed files with 162 additions and 63 deletions.
27 changes: 27 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
Traits CHANGELOG
================

Release 6.1.1
-------------

Released: XXXX-XX-XX

Traits 6.1.1 is a bugfix release fixing a handful of minor documentation and
test-related issues with the Traits 6.1.0 release. There are no API-breaking
changes in this release. It's recommended that all users of Traits 6.1.0
upgrade to Traits 6.1.1.

Fixes
~~~~~

* Don't mutate global state at import time in a test module. (#1222)
* Standardize and fix copyright years in source files. (#1227, #1198)
* Fix trait-documenter extension tests for Sphinx 3.1. (#1206)

Documentation fixes
~~~~~~~~~~~~~~~~~~~

* Fix some spelling and grammar errors in the user manual. (#1210)
* Fix description in README to match the one in the setup script. (#1219)
* Update PyPI links and capitalization in README.rst. (#1250)
* Fix user manual mentioning a nonexisting feature in metadata filter. (#1207)
* Fix typo in comment in optional_dependencies. (#1235)


Release 6.1.0
-------------

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This software is OSI Certified Open Source Software.
OSI Certified is a certification mark of the Open Source Initiative.

Copyright (c) 2006-2016, Enthought, Inc.
(C) Copyright 2005-2020 Enthought, Inc., Austin, TX
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
17 changes: 8 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
==============================================
traits: explicitly typed attributes for Python
==============================================
======================================================
Traits: observable typed attributes for Python classes
======================================================

http://docs.enthought.com/traits

Expand Down Expand Up @@ -54,13 +54,12 @@ Traits has the following optional dependencies:

* `NumPy <http://pypi.python.org/pypi/numpy>`_ to support the trait types
for arrays.
* `Traitsui <https://pypi.python.org/pypi/traitsui>`_ to support Gui
* `TraitsUI <https://pypi.python.org/pypi/traitsui>`_ to support GUI
Views.

To build the full documentation one needs:

* sphinx >= 1.8
* `enthought-sphinx-theme
<https://github.com/enthought/enthought-sphinx-theme>`_
(a version of the documentation can be built without this, but
some formatting may be incorrect)
* `Sphinx <https://pypi.org/project/Sphinx>`_ version 1.8 or later.
* The `Enthought Sphinx Theme <https://pypi.org/project/enthought-sphinx-theme>`_.
(A version of the documentation can be built without this, but
some formatting may be incorrect.)
8 changes: 5 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#
# All configuration values have a default value; values that are commented out
# serve to show the default value.
import datetime

import os
import sys

Expand Down Expand Up @@ -60,8 +60,10 @@

# General substitutions.
project = "traits"
copyright = "2008-{date.year}, Enthought Inc".format(
date=datetime.date.today())
copyright = """\
(C) Copyright 2005-2020 Enthought, Inc., Austin, TX
All rights reserved.
"""

# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
Expand Down
3 changes: 2 additions & 1 deletion docs/source/traits_user_manual/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Traits |version| User Manual
============================

:Authors: David C. Morrill, Janet M. Swisher, and Enthought developers
:Copyright: 2005-2020 Enthought, Inc. All Rights Reserved.
:Copyright: | (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
| All rights reserved.
Contents
========
Expand Down
23 changes: 11 additions & 12 deletions docs/source/traits_user_manual/notification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ See :ref:`on-trait-change-notification` for details on this older API.
Requesting trait attribute change notifications can be done in these
ways:

* Via class defintion: By decorating methods on the class with the |@observe|
* Via class definition: By decorating methods on the class with the |@observe|
decorator to indicate that they handle notification for specified attributes.
* Via instance method: By calling |HasTraits.observe| instance method to establish (or remove) change
notification handlers.
Expand Down Expand Up @@ -51,7 +51,7 @@ Via instance method
-------------------

The |HasTraits.observe| method on |HasTraits| is useful for adding or removing
change handler on a per instance basis. The example above can be rewritten like
change handlers on a per instance basis. The example above can be rewritten like
this:

.. literalinclude:: /../../examples/tutorials/doc_examples/examples/observe_method.py
Expand Down Expand Up @@ -90,7 +90,7 @@ Traits Mini Language is a domain specific language which provides a convenient
and concise way to specify observation rules via a single text. It supports
most of the use cases commonly encountered by users.

.. rubric:: Sementics of Traits DSL
.. rubric:: Semantics of Traits DSL

.. list-table::
:widths: 15 25
Expand Down Expand Up @@ -128,7 +128,7 @@ most of the use cases commonly encountered by users.
*updated*. Changes on those traits and changes on *foo* will trigger
notifications.
* - ``"foo,bar"``
- Matches trait named *foo* or *bar* on the current object. Changes on
- Matches traits named *foo* or *bar* on the current object. Changes on
*foo* or *bar* will trigger notifications.
* - ``"foo:[bar,baz]"``
- Matches *foo.bar* or *foo.baz* on the current object. Changes on
Expand Down Expand Up @@ -165,8 +165,7 @@ functions from the |observation.api| module.
* - |trait|
- For observing a specific named trait.
* - |metadata|
- For observing multiple traits with a specific metadata. Support further
filtering on the metadata value.
- For observing multiple traits with specific metadata.
* - |dict_items|
- For observing items in a dict.
* - |list_items|
Expand Down Expand Up @@ -208,15 +207,15 @@ notifications should be fired for changes.
*updated*. Changes on those traits will trigger notifications.

* ``trait("foo") | trait("bar")``
Matches trait named *foo* or *bar* on the current object. Changes on
Matches traits named *foo* or *bar* on the current object. Changes on
*foo* or *bar* will trigger notifications.

* ``trait("foo").then(trait("bar") | trait("baz"))``
Matches *foo.bar* or *foo.baz* on the current object. Changes on *foo*,
*foo.bar* or *foo.baz* will trigger notifications.

* ``trait("foo").match(lambda n, t: True)``
Matches any traits on *foo* on the current object. Changes on *foo* or
Matches all traits on *foo* on the current object. Changes on *foo* or
the nested attributes will trigger notifications.

.. rubric:: Extend an expression in text
Expand All @@ -235,13 +234,13 @@ Notification Handler
--------------------

By default, the **handler** is invoked immediately after the change has
occured. The **dispatch** parameter in |@observe| can be set such that the
occurred. The **dispatch** parameter in |@observe| can be set such that the
handler is dispatched elsewhere to be invoked later (e.g. on a GUI event loop).

The following expectations apply to any change handler:

* It must accept one argument: the **event** parameter (see below)
* It is called **after** a change has occured
* It is called **after** a change has occurred
* No assumptions should be made about the order of which handlers are called
for a given change event. A change event can have many change handlers.
* No exceptions should be raised from a change handler. Any unexpected
Expand Down Expand Up @@ -596,8 +595,8 @@ Syntax "-" is not supported
```````````````````````````

With |@on_trait_change|, the syntax *"-metadata_name"* is used to notify
for changes on traits that do NOT have a metadata with the give name. This
usage can be replaced by |match|::
for changes on traits that do NOT have a metadata attribute with the given
name. This usage can be replaced by |match|::

match(lambda name, trait: trait.metadata_name is None)

Expand Down
2 changes: 1 addition & 1 deletion traits-stubs/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This software is OSI Certified Open Source Software.
OSI Certified is a certification mark of the Open Source Initiative.

Copyright (c) 2006-2020, Enthought, Inc.
(C) Copyright 2020 Enthought, Inc., Austin, TX
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion traits-stubs/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# (C) Copyright 2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand Down
37 changes: 35 additions & 2 deletions traits-stubs/traits-stubs/api.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# (C) Copyright 2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand All @@ -8,7 +8,16 @@
#
# Thanks for using Enthought open source!

from .trait_type import TraitType as TraitType
from .constants import (
ComparisonMode as ComparisonMode,
DefaultValue as DefaultValue,
TraitKind as TraitKind,
ValidateTrait as ValidateTrait,
NO_COMPARE as NO_COMPARE,
OBJECT_IDENTITY_COMPARE as OBJECT_IDENTITY_COMPARE,
RICH_COMPARE as RICH_COMPARE,
)

from .traits import (
Color as Color,
Default as Default,
Expand All @@ -18,9 +27,30 @@ from .traits import (
Trait as Trait
)

from .ctrait import CTrait as CTrait

from .has_traits import (
ABCHasStrictTraits as ABCHasStrictTraits,
ABCHasTraits as ABCHasTraits,
ABCMetaHasTraits as ABCMetaHasTraits,
AbstractViewElement as AbstractViewElement,
HasTraits as HasTraits,
HasStrictTraits as HasStrictTraits,
HasPrivateTraits as HasPrivateTraits,
HasRequiredTraits as HasRequiredTraits,
Interface as Interface,
SingletonHasTraits as SingletonHasTraits,
SingletonHasStrictTraits as SingletonHasStrictTraits,
SingletonHasPrivateTraits as SingletonHasPrivateTraits,
MetaHasTraits as MetaHasTraits,
Vetoable as Vetoable,
VetoableEvent as VetoableEvent,
observe as observe,
on_trait_change as on_trait_change,
cached_property as cached_property,
property_depends_on as property_depends_on,
provides as provides,
isinterface as isinterface,
)

from .trait_types import (
Expand Down Expand Up @@ -146,6 +176,9 @@ from .trait_types import (
ValidatedTuple as ValidatedTuple
)

from .base_trait_handler import BaseTraitHandler as BaseTraitHandler
from .trait_handler import TraitHandler as TraitHandler
from .trait_type import TraitType as TraitType
from .trait_handlers import (
TraitCoerceType as TraitCoerceType,
TraitCastType as TraitCastType,
Expand Down
13 changes: 0 additions & 13 deletions traits-stubs/traits-stubs/base_trait_hander.pyi

This file was deleted.

2 changes: 1 addition & 1 deletion traits-stubs/traits-stubs/base_trait_handler.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# (C) Copyright 2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand Down
2 changes: 1 addition & 1 deletion traits-stubs/traits-stubs/constants.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# (C) Copyright 2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand Down
2 changes: 1 addition & 1 deletion traits-stubs/traits-stubs/ctrait.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# (C) Copyright 2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand Down
2 changes: 1 addition & 1 deletion traits-stubs/traits-stubs/editor_factories.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# (C) Copyright 2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand Down
2 changes: 1 addition & 1 deletion traits-stubs/traits-stubs/has_traits.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# (C) Copyright 2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand Down
6 changes: 3 additions & 3 deletions traits-stubs/traits-stubs/trait_handler.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# (C) Copyright 2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand All @@ -8,8 +8,8 @@
#
# Thanks for using Enthought open source!

from .base_trait_hander import BaseTraitHandler
from .base_trait_handler import BaseTraitHandler


class TraitHandler(BaseTraitHandler):
...
...
2 changes: 1 addition & 1 deletion traits-stubs/traits-stubs/trait_handlers.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# (C) Copyright 2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand Down
2 changes: 1 addition & 1 deletion traits-stubs/traits-stubs/trait_type.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# (C) Copyright 2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand Down
2 changes: 1 addition & 1 deletion traits-stubs/traits-stubs/trait_types.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# (C) Copyright 2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand Down
2 changes: 1 addition & 1 deletion traits-stubs/traits-stubs/traits.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2005-2020 Enthought, Inc., Austin, TX
# (C) Copyright 2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
Expand Down
17 changes: 17 additions & 0 deletions traits-stubs/traits_stubs_tests/examples/HasStrictTraits.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from traits.api import Event, HasStrictTraits, observe


class Person(HasStrictTraits):
conductor = Event()

@observe("conductor")
def talk(self, event):
pass


def sing(event):
pass


person = Person()
person.observe(sing, "conductor")
15 changes: 15 additions & 0 deletions traits-stubs/traits_stubs_tests/examples/Interface.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from traits.api import Float, HasTraits, Interface, provides, Str, Tuple


class IHasName(Interface):
name = Str()


@provides(IHasName)
class NamedColor(HasTraits):
name = Str()

rgb = Tuple(Float, Float, Float)


named_color = NamedColor(name="green", rgb=(0.0, 1.0, 0.0))
Loading

0 comments on commit 76ecb14

Please sign in to comment.