Changes in Traitlets¶
4.2¶
JSONFileConfigLoadercan be used as a context manager for updating configuration.- If a value in config does not map onto a configurable trait, a message is displayed that the value will have no effect.
- Unused arguments are passed to
super()inHasTraits.__init__, improving support for multiple inheritance. - Various bugfixes and improvements in the new API introduced in 4.1.
- Application subclasses may specify
raise_config_file_errors = Trueto exit on failure to load config files, instead of the default of logging the failures.
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 viataginstead of the constructor.
Other changes:
- Trait attributes initialized with
read_only=Truecan only be set with theset_traitmethod. 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.