Skip to content
Optional type-checking, data dependencies, and event notifications for Python
Python C Other
Branch: master
Clone or download
mdickinson Fix "who's" typo in docstrings (#502)
Replace "who's" with "whose".
Latest commit cf5f04b Jul 10, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Use napoleon instead of refactordoc. Jun 21, 2019
examples/tutorials Apply the 'black' code reformatting utility across the Traits codebase. Jan 9, 2019
traits Fix "who's" typo in docstrings (#502) Jul 10, 2019
.coveragerc DEV : update CI Dec 11, 2018
.gitignore DEV : update CI Dec 11, 2018
.travis.yml Merge pull request #479 from enthought/ci/travis-cron-job Jun 18, 2019
CHANGES.rst Forward port changelog updates from release branch. (#499) Jul 8, 2019
LICENSE.txt Update some dates and urls. Nov 1, 2016
MANIFEST.in Change extension on changelog, so that GitHub renders it nicely. Jan 30, 2019
README.rst Clean up unittest and mock imports, and uses of unittest.main(). Jan 31, 2019
appveyor-clean-cache.txt DEV : update CI Dec 11, 2018
appveyor.yml Don't restrict CI to PRs against the master branch. Apr 15, 2019
ci-doc-requirements.txt Use enthought-sphinx-theme from EDM Jun 21, 2019
ci-src-requirements.txt DEV : update CI Dec 11, 2018
etstool.py Use enthought-sphinx-theme from EDM Jun 21, 2019
image_LICENSE.txt fixed imports Apr 20, 2011
image_LICENSE_Eclipse.txt ENH: cleanup Oct 15, 2010
image_LICENSE_Nuvola.txt ENH: cleanup Oct 15, 2010
install-edm-linux.sh
install-edm-osx.sh DEV : update CI Dec 11, 2018
install-edm-windows.cmd DEV : update CI Dec 11, 2018
setup.py Bump version on master for continued development towards 5.2.0 Apr 15, 2019
tox.ini

README.rst

traits: explicitly typed attributes for Python

http://docs.enthought.com/traits

Build status Coverage status

The Traits project is at the center of all Enthought Tool Suite development and has changed the mental model used at Enthought for programming in the already extremely efficient Python programming language. We encourage everyone to join us in enjoying the productivity gains from using such a powerful approach.

The Traits project allows Python programmers to use a special kind of type definition called a trait, which gives object attributes some additional characteristics:

  • Initialization: A trait has a default value, which is automatically set as the initial value of an attribute before its first use in a program.
  • Validation: The type of a trait attribute is explicitly declared. The type is evident in the code, and only values that meet a programmer-specified set of criteria (i.e., the trait definition) can be assigned to that attribute.
  • Delegation: The value of a trait attribute can be contained either in the defining object or in another object delegated to by the trait.
  • Notification: Setting the value of a trait attribute can notify other parts of the program that the value has changed.
  • Visualization: User interfaces that allow a user to interactively modify the value of a trait attribute can be automatically constructed using the trait's definition. (This feature requires that a supported GUI toolkit be installed. If this feature is not used, the Traits project does not otherwise require GUI support.)

A class can freely mix trait-based attributes with normal Python attributes, or can opt to allow the use of only a fixed or open set of trait attributes within the class. Trait attributes defined by a class are automatically inherited by any subclass derived from the class.

Dependencies

Traits runs on both Python 2 and Python 3. It requires Python 2.7 or Python >= 3.4.

Traits has the following optional dependencies:

  • NumPy to support the trait types for arrays.
  • Traitsui to support Gui Views.

To build the full documentation one needs:

  • sphinx > 1.2.3
  • mock (for Python 2 only; optional if traitsui is not available)
  • enthought-sphinx-theme (a version of the documentation can be built without this, but some formatting may be incorrect)
You can’t perform that action at this time.