traitlets
traitlets copied to clipboard
initialize_subcommand does not print help
IPython kernelspec is deprecated (ipapp.py) :
subcommands = dict(
...
kernelspec=('jupyter_client.kernelspecapp.KernelSpecApp',
"DEPRECATED: Manage Jupyter kernel specifications."
),
)
Initialize subcommand in traitlets though does not print it:
@catch_config_error
def initialize_subcommand(self, subc, argv=None):
"""Initialize a subcommand with argv."""
subapp, help = self.subcommands.get(subc) # help unused.
if isinstance(subapp, string_types):
subapp = import_item(subapp)
# clear existing instances
self.__class__.clear_instance()
# instantiate
self.subapp = subapp.instance(config=self.config)
# and initialize subapp
self.subapp.initialize(argv)
example
$ ipython kernelspec
No subcommand specified. Must specify one of: ['install-self', 'list', 'install']
Manage Jupyter kernel specifications.
Subcommands
-----------
Subcommands are launched as `jupyter kernelspec cmd [args]`. For information on
using subcommand 'cmd', do: `jupyter kernelspec cmd -h`.
install-self
[DEPRECATED] Install the IPython kernel spec directory for this Python.
list
List installed kernel specifications.
install
Install a kernel specification directory.
It default to the subapp description, which in itself is not deprecated, But its IPython alias is.
Does affect many subapp.
The string associated with a subcommand is what shows up in the parent's help output:
ipython -h
...
Subcommands
-----------
Subcommands are launched as `ipython cmd [args]`. For information on using
subcommand 'cmd', do: `ipython cmd -h`.
kernel
Start a kernel without an attached frontend.
nbconvert
DEPRECATED: Convert notebooks to/from other formats.
kernelspec
DEPRECATED: Manage Jupyter kernel specifications.
install-nbextension
DEPRECATED: Install Jupyter notebook extension files
profile
Create and manage IPython profiles.
console
DEPRECATED: Launch the Jupyter terminal-based Console.
notebook
DEPRECATED: Launch the Jupyter HTML Notebook Server.
qtconsole
DEPRECATED: Launch the Jupyter Qt Console.
locate
print the path to the IPython dir
trust
DEPRECATED: Sign notebooks to trust their potentially unsafe contents at load.
history
Manage the IPython history database.
If we want to show a message when dispatching to the deprecated subcommands, it's going to mean extra code to run prior to dispatching. Perhaps deprecated subcommands should be a separate collection?
If we want to show a message when dispatching to the deprecated subcommands, it's going to mean extra code to run prior to dispatching. Perhaps deprecated subcommands should be a separate collection?
Probably otherwise people dont' get a message when they actually use the subcommand (like on SO):
$ ipython kernelspec
No subcommand specified. Must specify one of: ['install', 'install-self', 'list']
Manage Jupyter kernel specifications.
Subcommands
-----------
Subcommands are launched as `jupyter kernelspec cmd [args]`. For information on
using subcommand 'cmd', do: `jupyter kernelspec cmd -h`.
install
Install a kernel specification directory.
install-self
[DEPRECATED] Install the IPython kernel spec directory for this Python.
list
List installed kernel specifications.
I see that the install-self is deprecated, but it would be nice to see that kernelspec itself is deprecated.
Actually we can just make a dummy wrapper around 'jupyter_client.kernelspecapp.KernelSpecApp' that log a stderr message when used, and change the alias to point to the deprecated wrapper.