Changes in Traitlets¶
4.1¶
Traitlets 4.1 introduces a totally new decorator-based API for configuring traitlets. Highlights:
- Decorators are used, rather than magic method names, for registering trait-related methods. See Using Traitlets and Migration from Traitlets 4.0 to Traitlets 4.1 for more info.
- Deprecate
Trait(config=True)
in favor ofTrait().tag(config=True)
. In general, metadata is added viatag
instead of the constructor.
Other changes:
- Trait attributes initialized with
read_only=True
can only be set with theset_trait
method. Attempts to directly modify a read-only trait attribute raises aTraitError
. - The directional link now takes an optional transform attribute allowing the modification of the value.
- Various fixes and improvements to config-file generation (fixed ordering, Undefined showing up, etc.)
- Warn on unrecognized traits that aren’t configurable, to avoid silently ignoring mistyped config.