Skip to main content
`Ctrl`+`K`

# Traitlets

Release:

  5.14.3

Date:

  Jan 26, 2026

home:

  ipython/traitlets

pypi-repo:

  https://pypi.org/project/traitlets/

docs:

  https://traitlets.readthedocs.io/

license:

  Modified BSD License

Traitlets is a framework that lets Python classes have attributes with type checking, dynamically calculated default values, and ‘on change’ callbacks.

The package also includes a mechanism to use traitlets for configuration, loading values from files or from command line arguments. This is a distinct layer on top of traitlets, so you can use traitlets in your code without using the configuration machinery.

- Using Traitlets
  - Default values, and checking type and value
  - observe
  - Validation and Coercion
  - Custom Events
- Trait Types
  - `TraitType`
  - Numbers
  - Strings
  - Containers
  - Classes and instances
  - Miscellaneous
- Defining new trait types
  - `MyTrait`
- Traitlets API reference
  - `HasTraits`
  - Dynamic default values
  - Callbacks when trait attributes change
  - Validating proposed changes
- Configurable objects with traitlets.config
  - The main concepts
  - Configuration objects and files
  - Configuration files inheritance
  - Class based configuration inheritance
  - Command-line arguments
  - Design requirements
- Traitlets config API reference
  - `Configurable`
  - `SingletonConfigurable`
  - `LoggingConfigurable`
  - `JSONFileConfigLoader`
  - `Application`
  - `Config`
  - `LazyConfigValue`
  - `KVArgParseConfigLoader`
- Utils
  - `import_item()`
  - `signature_has_traits()`
  - Links
- Migration from Traitlets 4.0 to Traitlets 4.1
  - Separation of metadata and keyword arguments in `TraitType` constructors
  - Deprecation of `on_trait_change`
  - The new `@observe` decorator
  - dynamic defaults generation with decorators
  - Deprecation of magic method for cross-validation
  - Backward-compatible upgrades
- Changes in Traitlets
  - 5.14.3
  - 5.14.2
  - 5.14.1
  - 5.14.0
  - 5.13.0
  - 5.12.0
  - 5.11.2
  - 5.11.1
  - 5.11.0
  - 5.10.1
  - 5.10.0
  - 5.9.0
  - 5.8.1
  - 5.8.0
  - 5.7.1
  - 5.7.0
  - 5.6.0
  - 5.5.0
  - 5.4.0
  - 5.3.0
  - 5.2.2
  - 5.2.1
  - 5.2.0
  - 5.1.1
  - 5.1.0
  - 5.0.5
  - 5.0.4
  - 5.0.3
  - 5.0.2
  - 5.0.0
  - 4.3
  - 4.3.2
  - 4.3.1
  - 4.3.0
  - 4.2
  - 4.2.2 - 2016-07-01
  - 4.2.1 - 2016-03-14
  - 4.2.0 - 2016-03-14
  - 4.1 - 2016-01-15
  - 4.0 - 2015-06-19