configure IPython %config Class[.trait=value] This magic exposes most of the IPython config system. Any Configurable class should be able to be configured with the simple line:: %config Class.trait=value Where `value` will be resolved in th
(self, s)
| 34 | |
| 35 | @line_magic |
| 36 | def config(self, s): |
| 37 | """configure IPython |
| 38 | |
| 39 | %config Class[.trait=value] |
| 40 | |
| 41 | This magic exposes most of the IPython config system. Any |
| 42 | Configurable class should be able to be configured with the simple |
| 43 | line:: |
| 44 | |
| 45 | %config Class.trait=value |
| 46 | |
| 47 | Where `value` will be resolved in the user's namespace, if it is an |
| 48 | expression or variable name. |
| 49 | |
| 50 | Examples |
| 51 | -------- |
| 52 | |
| 53 | To see what classes are available for config, pass no arguments:: |
| 54 | |
| 55 | In [1]: %config |
| 56 | Available objects for config: |
| 57 | AliasManager |
| 58 | DisplayFormatter |
| 59 | HistoryManager |
| 60 | IPCompleter |
| 61 | LoggingMagics |
| 62 | MagicsManager |
| 63 | OSMagics |
| 64 | PrefilterManager |
| 65 | ScriptMagics |
| 66 | TerminalInteractiveShell |
| 67 | |
| 68 | To view what is configurable on a given class, just pass the class |
| 69 | name:: |
| 70 | |
| 71 | In [2]: %config LoggingMagics |
| 72 | LoggingMagics(Magics) options |
| 73 | --------------------------- |
| 74 | LoggingMagics.quiet=<Bool> |
| 75 | Suppress output of log state when logging is enabled |
| 76 | Current: False |
| 77 | |
| 78 | but the real use is in setting values:: |
| 79 | |
| 80 | In [3]: %config LoggingMagics.quiet = True |
| 81 | |
| 82 | and these values are read from the user_ns if they are variables:: |
| 83 | |
| 84 | In [4]: feeling_quiet=False |
| 85 | |
| 86 | In [5]: %config LoggingMagics.quiet = feeling_quiet |
| 87 | |
| 88 | """ |
| 89 | from traitlets.config.loader import Config |
| 90 | # some IPython objects are Configurable, but do not yet have |
| 91 | # any configurable traits. Exclude them from the effects of |
| 92 | # this magic, as their presence is just noise: |
| 93 | configurables = sorted(set([ c for c in self.shell.configurables |
nothing calls this directly
no test coverage detected