Skip to main content

explicitly typed attributes for Python

Project description

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 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 (optional if traitsui is not available)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

traits-4.6.0.zip (546.3 kB view details)

Uploaded Source

traits-4.6.0.tar.gz (434.9 kB view details)

Uploaded Source

traits-4.6.0.tar.bz2 (354.3 kB view details)

Uploaded Source

File details

Details for the file traits-4.6.0.zip.

File metadata

  • Download URL: traits-4.6.0.zip
  • Upload date:
  • Size: 546.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for traits-4.6.0.zip
Algorithm Hash digest
SHA256 0e56495f42f377facacc5e9daa6647b5b285c301331486094a993c1e891b1f19
MD5 4671b50c634c29e96ec6a82d7aeb7082
BLAKE2b-256 479f2ab54c0a83ada18d4084b1bc53a7201cd3eefbfdf36d9bb242e644ff4f80

See more details on using hashes here.

File details

Details for the file traits-4.6.0.tar.gz.

File metadata

  • Download URL: traits-4.6.0.tar.gz
  • Upload date:
  • Size: 434.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for traits-4.6.0.tar.gz
Algorithm Hash digest
SHA256 5d82345e0a34b88e394964eea1be47419530027aef7f0b20ad315b6ec6c68370
MD5 7af6d2f9dfa9f5c0b7a6ac8d3c9fca17
BLAKE2b-256 a66996560692c9329f7290ae46e828a328538cd139b75a176fdca2c53361f431

See more details on using hashes here.

File details

Details for the file traits-4.6.0.tar.bz2.

File metadata

  • Download URL: traits-4.6.0.tar.bz2
  • Upload date:
  • Size: 354.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for traits-4.6.0.tar.bz2
Algorithm Hash digest
SHA256 c71c3165526e5375f74358968fd70a258a65d6c8768210ee4e4f88347a4ab853
MD5 49964def21c38e8e67b59e1a2ab4e79b
BLAKE2b-256 564703f50e82e1ff1e8a602c5f2cf12f08675f79a7169629fe4ce521e59d265f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page