diff --git a/docs/client.rst b/docs/client.rst index ee82f6b6..ef29f5f1 100644 --- a/docs/client.rst +++ b/docs/client.rst @@ -173,23 +173,23 @@ Using a command-line interface This section will illustrate how to run notebooks from your terminal. It supports the most basic use case. For more sophisticated execution options, consider the `papermill `_ library. -This library's command line tool is available by running `jupyter execute`. It expects notebooks as input arguments and accepts optional flags to modify the default behavior. +This library's command line tool is available by running `jupyter run`. It expects notebooks as input arguments and accepts optional flags to modify the default behavior. Running a notebook is this easy.:: - jupyter execute notebook.ipynb + jupyter run notebook.ipynb You can pass more than one notebook as well.:: - jupyter execute notebook.ipynb notebook2.ipynb + jupyter run notebook.ipynb notebook2.ipynb By default, notebook errors will be raised and printed into the terminal. You can suppress them by passing the ``--allow-errors`` flag.:: - jupyter execute notebook.ipynb --allow-errors + jupyter run notebook.ipynb --allow-errors Other options allow you to modify the timeout length and dictate the kernel in use. A full set of options is available via the help command.:: - jupyter execute --help + jupyter run --help An application used to execute notebook files (*.ipynb) diff --git a/nbclient/cli.py b/nbclient/cli.py index 02b3d20f..18f265c7 100644 --- a/nbclient/cli.py +++ b/nbclient/cli.py @@ -36,7 +36,7 @@ class NbClientApp(JupyterApp): """ version = __version__ - name = 'jupyter-execute' + name = 'jupyter-run' aliases = nbclient_aliases flags = nbclient_flags @@ -106,7 +106,7 @@ def initialize(self, argv=None): # If there are none, throw an error if not self.notebooks: - print("jupyter-execute: error: expected path to notebook") + print(f"{self.name}: error: expected path to notebook") sys.exit(-1) # Loop and run them one by one @@ -154,4 +154,17 @@ def run_notebook(self, notebook_path): client.execute() -main = NbClientApp.launch_instance +class NbClientAlias(NbClientApp): + """ + An alias to the run command. + """ + name = 'jupyter-execute' + + @catch_config_error + def initialize(self, argv=None): + print("This alias to `jupyter run` may be deprecated in the future. Please switch to using `run`.") + super().initialize(argv) + + +run = NbClientApp.launch_instance +execute = NbClientAlias.launch_instance diff --git a/setup.py b/setup.py index dcf2824c..c575e045 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,8 @@ def read_reqs(fname): extras_require=extras_require, entry_points={ 'console_scripts': [ - 'jupyter-execute = nbclient.cli:main', + 'jupyter-run = nbclient.cli:run', + 'jupyter-execute = nbclient.cli:execute', ], }, project_urls={