traitlets API reference
116 public APIs from traitlets (ipython/traitlets) — 48 classes, 19 functions, 49 methods. Signatures extracted by static analysis of the actual source.
Repository: ipython/traitlets
| Kind | Count |
|---|---|
| Classes | 48 |
| Functions | 19 |
| Methods | 49 |
API list
class
traitlets.config.application.ApplicationA singleton application with full configuration support.
method
traitlets.config.application.Application.emit_alias_help() -> t.Generator[str, None, None]Yield the lines for alias part of the help.
method
traitlets.config.application.Application.emit_description() -> t.Generator[str, None, None]Yield lines with the application description.
method
traitlets.config.application.Application.emit_examples() -> t.Generator[str, None, None]Yield lines with the usage and examples.
method
traitlets.config.application.Application.emit_flag_help() -> t.Generator[str, None, None]Yield the lines for the flag part of the help.
method
traitlets.config.application.Application.emit_help_epilogue(classes:bool) -> t.Generator[str, None, None]Yield the very bottom lines of the help message.
method
traitlets.config.application.Application.generate_config_file(classes:ClassesType | None=None) -> strgenerate default config file from Configurables
method
traitlets.config.application.Application.get_default_logging_config() -> StrDictReturn the base logging configuration.
method
traitlets.config.application.Application.initialize(argv:ArgvType=None) -> NoneDo the basic steps to configure me.
method
traitlets.config.application.Application.initialize_subcommand(subc:str, argv:ArgvType=None) -> NoneInitialize a subcommand with argv.
method
traitlets.config.application.Application.load_config_environ() -> NoneLoad config files by environment.
method
traitlets.config.application.Application.load_config_file(filename:str, path:str | t.Sequence[str | None] | None=None) -> NoneLoad config files by filename and path.
method
traitlets.config.application.Application.loaded_config_files() -> list[str]Currently loaded configuration files
method
traitlets.config.application.Application.parse_command_line(argv:ArgvType=None) -> NoneParse the command line arguments.
method
traitlets.config.application.Application.print_alias_help() -> NonePrint the alias parts of the help.
method
traitlets.config.application.Application.print_description() -> NonePrint the application description.
method
traitlets.config.application.Application.print_examples() -> NonePrint usage and examples (see `emit_examples()`).
method
traitlets.config.application.Application.print_flag_help() -> NonePrint the flag part of the help.
method
traitlets.config.application.Application.print_help(classes:bool=False) -> NonePrint the help for each Configurable class in self.classes.
method
traitlets.config.application.Application.print_options() -> NonePrint the options part of the help.
method
traitlets.config.application.Application.print_subcommands() -> NonePrint the subcommand part of the help.
method
traitlets.config.application.Application.print_version() -> NonePrint the version string.
method
traitlets.config.application.Application.start() -> NoneStart the app mainloop.
method
traitlets.config.application.Application.start_show_config() -> Nonestart function used when show_config is True
func
traitlets.config.application.boolean_flag(name:str, configurable:str, set_help:str='', unset_help:str='') -> StrDictHelper for building basic --trait, --no-trait flags.
func
traitlets.config.configurable.Configurable.c(s:str) -> strreturn a commented, wrapped block.
method
traitlets.config.configurable.Configurable.class_config_section(classes:t.Sequence[type[HasTraits]] | None=None) -> strGet the config section for this class.
method
traitlets.config.configurable.Configurable.class_get_help(inst:HasTraits | None=None) -> strGet the help string for this class in ReST format.
method
traitlets.config.configurable.Configurable.class_get_trait_help(trait:TraitType[t.Any, t.Any], inst:HasTraits | None=None, helptext:str | None=None) -> strGet the helptext string for a single trait.
method
traitlets.config.configurable.Configurable.class_print_help(inst:HasTraits | None=None) -> NoneGet the help string for a single trait and print it.
func
traitlets.config.configurable.Configurable.notice_config_override(change:Bunch) -> NoneRecord traits set by both config and kwargs.
method
traitlets.config.configurable.Configurable.section_names() -> list[str]return section names as a list
method
traitlets.config.configurable.Configurable.update_config(config:Config) -> NoneUpdate config and load the new values
class
traitlets.config.configurable.LoggingConfigurableA parent class for Configurables that log.
class
traitlets.config.configurable.SingletonConfigurableA configurable that only allows one instance.
method
traitlets.config.configurable.SingletonConfigurable.initialized() -> boolHas an instance been created?
method
traitlets.config.configurable.SingletonConfigurable.instance(*args:t.Any, **kwargs:t.Any) -> SelfReturns a global instance of this class.
class
traitlets.config.loader.CommandLineConfigLoaderA config loader for command line arguments.
class
traitlets.config.loader.ConfigAn attribute-based dict that can do smart merges.
method
traitlets.config.loader.Config.collisions(other:Config) -> dict[str, t.Any]Check for collisions between two config objects.
method
traitlets.config.loader.Config.merge(other:t.Any) -> Nonemerge another config object into this one
class
traitlets.config.loader.ConfigLoaderA object for loading configurations from just about anywhere.
class
traitlets.config.loader.DeferredConfigClass for deferred-evaluation of config from CLI
class
traitlets.config.loader.FileConfigLoaderA base class for file based configurations.
class
traitlets.config.loader.KeyValueConfigLoaderDeprecated in traitlets 5.0 Use KVArgParseConfigLoader
class
traitlets.config.loader.PyFileConfigLoaderA config loader for pure python files.
method
traitlets.config.loader.PyFileConfigLoader.load_subconfig(fname:str, path:str | None=None) -> NoneInjected into config file namespace as load_subconfig
func
traitlets.config.manager.recursive_update(target:dict[Any, Any], new:dict[Any, Any]) -> NoneRecursively update one dictionary using another.
func
traitlets.log.get_logger() -> logging.Logger | logging.LoggerAdapter[Any]Grab the global logger instance.
class
traitlets.traitlets.AnyA trait which allows any value.
class
traitlets.traitlets.BoolA boolean (True, False) trait.
method
traitlets.traitlets.Bool.argcompleter(**kwargs:t.Any) -> list[str]Completion hints for argcomplete
class
traitlets.traitlets.BytesA trait for byte strings.
class
traitlets.traitlets.CBoolA casting version of the boolean trait.
class
traitlets.traitlets.CBytesA casting version of the byte string trait.
class
traitlets.traitlets.CComplexA casting version of the complex number trait.
class
traitlets.traitlets.CFloatA casting version of the float trait.
class
traitlets.traitlets.CIntA casting version of the int trait.
class
traitlets.traitlets.CLongA deprecated alias for :class:`CInt`.
class
traitlets.traitlets.CRegExpA casting compiled regular expression trait.
class
traitlets.traitlets.CUnicodeA casting version of the unicode trait.
class
traitlets.traitlets.CallableA trait which is callable.
class
traitlets.traitlets.CaselessStrEnumAn enum of strings where the case should be ignored.
class
traitlets.traitlets.ComplexA trait for complex numbers.
method
traitlets.traitlets.Container.from_string(s:str) -> T | NoneLoad value from a single string
class
traitlets.traitlets.DictAn instance of a Python dict.
method
traitlets.traitlets.Dict.from_string(s:str) -> dict[K, V] | NoneLoad value from a single string
method
traitlets.traitlets.Dict.from_string_list(s_list:list[str]) -> t.AnyReturn a dict from a list of config strings.
method
traitlets.traitlets.Dict.item_from_string(s:str) -> dict[K, V]Cast a single-key dict from a string.
class
traitlets.traitlets.EnumAn enum whose value must be in a given sequence.
method
traitlets.traitlets.Enum.argcompleter(**kwargs:t.Any) -> list[str]Completion hints for argcomplete
class
traitlets.traitlets.FloatA float trait.
class
traitlets.traitlets.ForwardDeclaredInstanceForward-declared version of Instance.
class
traitlets.traitlets.ForwardDeclaredMixinMixin for forward-declared versions of Instance and Type.
class
traitlets.traitlets.ForwardDeclaredTypeForward-declared version of Type.
class
traitlets.traitlets.HasDescriptorsThe base class for all classes that have descriptors.
method
traitlets.traitlets.HasDescriptors.setup_instance(*args:t.Any, **kwargs:t.Any) -> NoneThis is called **before** self.__init__ is called.
func
traitlets.traitlets.HasTraits.compress(past_changes:list[Bunch] | None, change:Bunch) -> list[Bunch]Merges the provided change with the last if possible.
class
traitlets.traitlets.InstanceA trait whose value must be an instance of a specified class.
class
traitlets.traitlets.IntAn integer trait.
class
traitlets.traitlets.ListAn instance of a Python list.
class
traitlets.traitlets.LongA deprecated alias for :class:`Integer`.
class
traitlets.traitlets.MetaHasDescriptorsA metaclass for HasDescriptors.
class
traitlets.traitlets.MetaHasTraitsA metaclass for HasTraits.
class
traitlets.traitlets.PathA trait for filesystem paths.
class
traitlets.traitlets.SetAn instance of a Python set.
class
traitlets.traitlets.TCPAddressA trait for an (ip, port) tuple.
class
traitlets.traitlets.ThisA trait for instances of the class containing this trait.
class
traitlets.traitlets.TraitTypeA base class for all trait types.
method
traitlets.traitlets.TraitType.get_metadata(key:str, default:t.Any=None) -> t.AnyDEPRECATED: Get a metadata value.
method
traitlets.traitlets.TraitType.init_default_value(obj:t.Any) -> G | NoneDEPRECATED: Set the static default value for the trait type.
method
traitlets.traitlets.TraitType.set_metadata(key:str, value:t.Any) -> NoneDEPRECATED: Set a metadata key/value.
method
traitlets.traitlets.TraitType.tag(**metadata:t.Any) -> SelfSets metadata and returns self.
class
traitlets.traitlets.TupleAn instance of a Python tuple.
class
traitlets.traitlets.TypeA trait whose value must be a subclass of a specified class.
method
traitlets.traitlets.Type.info() -> strReturns a description of the trait.
method
traitlets.traitlets.Type.validate(obj:t.Any, value:t.Any) -> GValidates that the value is a valid object instance.
class
traitlets.traitlets.UnicodeA trait for unicode strings.
class
traitlets.traitlets.UnionA trait type representing a Union type.
class
traitlets.traitlets.UseEnumUse a Enum class as model for the data type description.
method
traitlets.traitlets.UseEnum.select_by_name(value:str, default:t.Any=Undefined) -> t.AnySelects enum-value by using its name or scoped-name.
method
traitlets.traitlets.UseEnum.select_by_number(value:int, default:t.Any=Undefined) -> t.AnySelects enum-value by using its number-constant.
func
traitlets.traitlets.is_trait(t:t.Any) -> boolReturns whether the given value is an instance or subclass of TraitType.
func
traitlets.traitlets.observe(*type:str='change', *names:Sentinel | str) -> ObserveHandlerA decorator which can be used to observe Traits on a class.
func
traitlets.traitlets.parse_notifier_name(names:Sentinel | str | t.Collection[Sentinel | str]) -> t.Iterable[t.Any]Convert the name argument to a list of names.
class
traitlets.utils.bunch.BunchA dict with attribute-access
func
traitlets.utils.descriptions.add_article(name:str, definite:bool=False, capital:bool=False) -> strReturns the string with a prepended article.
func
traitlets.utils.descriptions.class_of(value:Any) -> AnyReturns a string of the value's type with an indefinite article.
func
traitlets.utils.filefind(filename:str, path_dirs:Sequence[str] | None=None) -> strFind a file by looking through a sequence of paths.
func
traitlets.utils.getargspec.getargspec(func:Any) -> inspect.FullArgSpecLike inspect.getargspec but supports functools.partial as well.
func
traitlets.utils.importstring.import_item(name:str) -> AnyImport and return ``bar`` given the string ``foo.bar``.
func
traitlets.utils.nested_update.nested_update(this:dict[Any, Any], that:dict[Any, Any]) -> dict[Any, Any]Merge two nested dictionaries.
func
traitlets.utils.text.wrap_paragraphs(text:str, ncols:int=80) -> list[str]Wrap multiple paragraphs to fit a specified width.
func
traitlets.utils.warnings.deprecated_method(method:t.Any, cls:t.Any, method_name:str, msg:str) -> NoneShow deprecation warning about a magic method definition.
func
traitlets.utils.warnings.should_warn(key:t.Any) -> boolAdd our own checks for too many deprecation warnings.
func
traitlets.utils.warnings.warn(msg:str, category:t.Any, *stacklevel:int, *source:t.Any=None) -> NoneLike warnings.warn(), but category and stacklevel are required.
About this data
These signatures were extracted from the public source of ipython/traitlets
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.