Skip to main content

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 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)

Metadata

Release files for traits 4.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distributions (sdists)

Source distribution for traits 4.6.0
File Size Uploaded
traits-4.6.0.zip 546.3 kB Details
traits-4.6.0.tar.gz 434.9 kB Details
traits-4.6.0.tar.bz2 354.3 kB Details

Release files / traits-4.6.0.zip

Download URL traits-4.6.0.zip
Size 546.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0e56495f42f377facacc5e9daa6647b5b285c301331486094a993c1e891b1f19
BLAKE2b-256 checksum
How to use checksums
479f2ab54c0a83ada18d4084b1bc53a7201cd3eefbfdf36d9bb242e644ff4f80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / traits-4.6.0.tar.gz

Download URL traits-4.6.0.tar.gz
Size 434.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5d82345e0a34b88e394964eea1be47419530027aef7f0b20ad315b6ec6c68370
BLAKE2b-256 checksum
How to use checksums
a66996560692c9329f7290ae46e828a328538cd139b75a176fdca2c53361f431
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / traits-4.6.0.tar.bz2

Download URL traits-4.6.0.tar.bz2
Size 354.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c71c3165526e5375f74358968fd70a258a65d6c8768210ee4e4f88347a4ab853
BLAKE2b-256 checksum
How to use checksums
564703f50e82e1ff1e8a602c5f2cf12f08675f79a7169629fe4ce521e59d265f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

7.2.0

49 release files

7.1.0

49 release files

7.0.2

49 release files

7.0.1

49 release files

7.0.0

13 release files

6.4.1

59 release files

6.4.0

34 release files

6.3.2

34 release files

6.3.1

34 release files

6.2.0

21 release files

6.1.1

1 release file

6.1.0

1 release file

6.0.0

1 release file

5.2.0

1 release file

5.1.2

1 release file

5.1.1

1 release file

5.1.0

1 release file

5.0.0

1 release file

This release

4.6.0 This release

3 release files

4.5.0

1 release file

4.4.0

1 release file

4.3.0

4.2.0

4.1.0

4.0.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page