Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename duplicate entrypoints #138

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@
"\n",
"A `pip` user that wants their configuration stored in their home directory would type the following command:\n",
"```shell\n",
"jupyter serverextension enable --py helpful_package\n",
"jupyter nbclassic-serverextension enable --py helpful_package\n",
"```\n",
"\n",
"Alternatively, a `virtualenv` or `conda` user can pass `--sys-prefix` which keeps their environment isolated and reproducible. For example:\n",
"```shell\n",
"# Make sure that your virtualenv or conda environment is activated\n",
"[source] activate my-environment\n",
"\n",
"jupyter serverextension enable --py helpful_package --sys-prefix\n",
"jupyter nbclassic-serverextension enable --py helpful_package --sys-prefix\n",
"```"
]
},
Expand All @@ -97,7 +97,7 @@
"source": [
"If a package also has an nbextension with frontend assets that must be available (but not neccessarily enabled by default), install these assets with the following command:\n",
"```shell\n",
"jupyter nbextension install --py helpful_package # or --sys-prefix if using virtualenv or conda\n",
"jupyter nbclassic-extension install --py helpful_package # or --sys-prefix if using virtualenv or conda\n",
"```"
]
},
Expand All @@ -108,7 +108,7 @@
"### Enable nbextension assets\n",
"If a package has assets that should be loaded every time a Jupyter app (e.g. lab, notebook, dashboard, terminal) is loaded in the browser, the following command can be used to enable the nbextension:\n",
"```shell\n",
"jupyter nbextension enable --py helpful_package # or --sys-prefix if using virtualenv or conda\n",
"jupyter nbclassic-extension enable --py helpful_package # or --sys-prefix if using virtualenv or conda\n",
"```"
]
},
Expand All @@ -120,9 +120,9 @@
"After running one or more extension installation steps, you can list what is presently known about nbextensions, server extensions, or bundler extensions. The following commands will list which extensions are available, whether they are enabled, and other extension details:\n",
"\n",
"```shell\n",
"jupyter nbextension list\n",
"jupyter serverextension list\n",
"jupyter bundlerextension list\n",
"jupyter nbclassic-extension list\n",
"jupyter nbclassic-serverextension list\n",
"jupyter nbclassic-bundlerextension list\n",
"```"
]
},
Expand Down Expand Up @@ -191,7 +191,7 @@
"### Install and enable the server extension\n",
"Which a user can install with:\n",
"```\n",
"jupyter serverextension enable --py my_module [--sys-prefix]\n",
"jupyter nbclassic-serverextension enable --py my_module [--sys-prefix]\n",
"```"
]
},
Expand Down Expand Up @@ -260,9 +260,9 @@
"\n",
"The user can install and enable the extensions with the following set of commands:\n",
"```\n",
"jupyter nbextension install --py my_fancy_module [--sys-prefix|--user]\n",
"jupyter nbextension enable --py my_fancy_module [--sys-prefix|--system]\n",
"jupyter serverextension enable --py my_fancy_module [--sys-prefix|--system]\n",
"jupyter nbclassic-extension install --py my_fancy_module [--sys-prefix|--user]\n",
"jupyter nbclassic-extension enable --py my_fancy_module [--sys-prefix|--system]\n",
"jupyter nbclassic-serverextension enable --py my_fancy_module [--sys-prefix|--system]\n",
"```"
]
},
Expand Down Expand Up @@ -337,15 +337,15 @@
" ...\n",
" include_package_data=True,\n",
" data_files=[\n",
" # like `jupyter nbextension install --sys-prefix`\n",
" # like `jupyter nbclassic-extension install --sys-prefix`\n",
" (\"share/jupyter/nbextensions/my_fancy_module\", [\n",
" \"my_fancy_module/static/index.js\",\n",
" ]),\n",
" # like `jupyter nbextension enable --sys-prefix`\n",
" # like `jupyter nbclassic-extension enable --sys-prefix`\n",
" (\"etc/jupyter/nbconfig/notebook.d\", [\n",
" \"jupyter-config/nbconfig/notebook.d/my_fancy_module.json\"\n",
" ]),\n",
" # like `jupyter serverextension enable --sys-prefix`\n",
" # like `jupyter nbclassic-serverextension enable --sys-prefix`\n",
" (\"etc/jupyter/jupyter_notebook_config.d\", [\n",
" \"jupyter-config/jupyter_notebook_config.d/my_fancy_module.json\"\n",
" ])\n",
Expand Down Expand Up @@ -375,9 +375,9 @@
"source": [
"As most package managers will only modify their environment, the eventual configuration will be as if the user had typed:\n",
"```\n",
"jupyter nbextension install --py my_fancy_module --sys-prefix\n",
"jupyter nbextension enable --py my_fancy_module --sys-prefix\n",
"jupyter serverextension enable --py my_fancy_module --sys-prefix\n",
"jupyter nbclassic-extension install --py my_fancy_module --sys-prefix\n",
"jupyter nbclassic-extension enable --py my_fancy_module --sys-prefix\n",
"jupyter nbclassic-serverextension enable --py my_fancy_module --sys-prefix\n",
"```\n",
"\n",
"If a user manually `disable`s an extension, that configuration will override the bundled package configuration."
Expand Down
10 changes: 5 additions & 5 deletions docs/source/extending/bundler_extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ following:

.. code:: bash

jupyter bundlerextension enable --py mypackage.hello_bundler --sys-prefix
jupyter nbclassic-bundlerextension enable --py mypackage.hello_bundler --sys-prefix

The above updates the notebook configuration file in the current
conda/virtualenv environment (`--sys-prefix`) with the metadata returned by
Expand All @@ -136,13 +136,13 @@ following:

.. code:: bash

jupyter bundlerextension disable --py mypackage.hello_bundler --sys-prefix
jupyter nbclassic-bundlerextension disable --py mypackage.hello_bundler --sys-prefix

For more help using the `bundlerextension` subcommand, run the following.

.. code:: bash

jupyter bundlerextension --help
jupyter nbclassic-bundlerextension --help

The output describes options for listing enabled bundlers, configuring
bundlers for single users, configuring bundlers system-wide, etc.
Expand All @@ -157,8 +157,8 @@ You can enable them to try them like so:

.. code:: bash

jupyter bundlerextension enable --py notebook.bundler.zip_bundler --sys-prefix
jupyter bundlerextension enable --py notebook.bundler.tarball_bundler --sys-prefix
jupyter nbclassic-bundlerextension enable --py notebook.bundler.zip_bundler --sys-prefix
jupyter nbclassic-bundlerextension enable --py notebook.bundler.tarball_bundler --sys-prefix

.. _bundler-details:

Expand Down
4 changes: 2 additions & 2 deletions docs/source/extending/frontend_extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ Installing and enabling extensions

You can install your nbextension with the command::

jupyter nbextension install path/to/my_extension/ [--user|--sys-prefix]
jupyter nbclassic-extension install path/to/my_extension/ [--user|--sys-prefix]

The default installation is system-wide. You can use ``--user`` to do a
per-user installation, or ``--sys-prefix`` to install to Python's prefix (e.g.
Expand All @@ -219,7 +219,7 @@ rather than copying it, so there's no need to reinstall after changes.
To use your extension, you'll also need to **enable** it, which tells the
notebook interface to load it. You can do that with another command::

jupyter nbextension enable my_extension/main [--sys-prefix][--section='common']
jupyter nbclassic-extension enable my_extension/main [--sys-prefix][--section='common']

The argument refers to the Javascript module containing your
``load_ipython_extension`` function, which is ``my_extension/main.js`` in this
Expand Down
22 changes: 11 additions & 11 deletions nbclassic/bundler/bundlerextensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def disable_bundler_python(module, user=True, sys_prefix=False, logger=None):

class ToggleBundlerExtensionApp(BaseExtensionApp):
"""A base class for apps that enable/disable bundlerextensions"""
name = "jupyter bundlerextension enable/disable"
name = "jupyter nbclassic-bundlerextension enable/disable"
version = __version__
description = "Enable/disable a bundlerextension in configuration."

Expand Down Expand Up @@ -214,30 +214,30 @@ def start(self):

class EnableBundlerExtensionApp(ToggleBundlerExtensionApp):
"""An App that enables bundlerextensions"""
name = "jupyter bundlerextension enable"
name = "jupyter nbclassic-bundlerextension enable"
description = """
Enable a bundlerextension in frontend configuration.

Usage
jupyter bundlerextension enable [--system|--sys-prefix]
jupyter nbclassic-bundlerextension enable [--system|--sys-prefix]
"""
_toggle_value = True

class DisableBundlerExtensionApp(ToggleBundlerExtensionApp):
"""An App that disables bundlerextensions"""
name = "jupyter bundlerextension disable"
name = "jupyter nbclassic-bundlerextension disable"
description = """
Disable a bundlerextension in frontend configuration.

Usage
jupyter bundlerextension disable [--system|--sys-prefix]
jupyter nbclassic-bundlerextension disable [--system|--sys-prefix]
"""
_toggle_value = None


class ListBundlerExtensionApp(BaseExtensionApp):
"""An App that lists and validates nbextensions"""
name = "jupyter nbextension list"
name = "jupyter nbclassic-extension list"
version = __version__
description = "List all nbextensions known by the configuration system"

Expand Down Expand Up @@ -276,14 +276,14 @@ def start(self):


class BundlerExtensionApp(BaseExtensionApp):
"""Base jupyter bundlerextension command entry point"""
name = "jupyter bundlerextension"
"""Base jupyter nbclassic-bundlerextension command entry point"""
name = "jupyter nbclassic-bundlerextension"
version = __version__
description = "Work with Jupyter bundler extensions"
examples = """
jupyter bundlerextension list # list all configured bundlers
jupyter bundlerextension enable --py <packagename> # enable all bundlers in a Python package
jupyter bundlerextension disable --py <packagename> # disable all bundlers in a Python package
jupyter nbclassic-bundlerextension list # list all configured bundlers
jupyter nbclassic-bundlerextension enable --py <packagename> # enable all bundlers in a Python package
jupyter nbclassic-bundlerextension disable --py <packagename> # disable all bundlers in a Python package
"""

subcommands = dict(
Expand Down
44 changes: 22 additions & 22 deletions nbclassic/nbextensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,17 +632,17 @@ class InstallNBExtensionApp(BaseExtensionApp):

Usage

jupyter nbextension install path|url [--user|--sys-prefix]
jupyter nbclassic-extension install path|url [--user|--sys-prefix]

This copies a file or a folder into the Jupyter nbextensions directory.
This copies a file or a folder into the jupyter nbclassic-extensions directory.
If a URL is given, it will be downloaded.
If an archive is given, it will be extracted into nbextensions.
If the requested files are already up to date, no action is taken
unless --overwrite is specified.
"""

examples = """
jupyter nbextension install /path/to/myextension
jupyter nbclassic-extension install /path/to/myextension
"""
aliases = aliases
flags = flags
Expand Down Expand Up @@ -687,7 +687,7 @@ def install_extensions(self):
self.log.info(
f"\nTo initialize this nbextension in the browser every time"
f" the notebook (or other app) loads:\n\n"
f" jupyter nbextension enable {self.extra_args[0] if self.python else '<the entry point>'}"
f" jupyter nbclassic-extension enable {self.extra_args[0] if self.python else '<the entry point>'}"
f"{' --user' if self.user else ''}"
f"{' --py' if self.python else ''}"
f"{' --sys-prefix' if self.sys_prefix else ''}\n"
Expand All @@ -711,8 +711,8 @@ class UninstallNBExtensionApp(BaseExtensionApp):

Usage

jupyter nbextension uninstall path/url path/url/entrypoint
jupyter nbextension uninstall --py pythonPackageName
jupyter nbclassic-extension uninstall path/url path/url/entrypoint
jupyter nbclassic-extension uninstall --py pythonPackageName

This uninstalls an nbextension. By default, it uninstalls from the
first directory on the search path where it finds the extension, but you can
Expand All @@ -722,16 +722,16 @@ class UninstallNBExtensionApp(BaseExtensionApp):
If you specify the --require option, the named extension will be disabled,
e.g.::

jupyter nbextension uninstall myext --require myext/main
jupyter nbclassic-extension uninstall myext --require myext/main

If you use the --py or --python flag, the name should be a Python module.
It will uninstall nbextensions listed in that module, but not the module
itself (which you should uninstall using a package manager such as pip).
"""

examples = """
jupyter nbextension uninstall dest/dir dest/dir/extensionjs
jupyter nbextension uninstall --py extensionPyPackage
jupyter nbclassic-extension uninstall dest/dir dest/dir/extensionjs
jupyter nbclassic-extension uninstall --py extensionPyPackage
"""

aliases = {
Expand Down Expand Up @@ -821,7 +821,7 @@ def start(self):

class ToggleNBExtensionApp(BaseExtensionApp):
"""A base class for apps that enable/disable extensions"""
name = "jupyter nbextension enable/disable"
name = "jupyter nbclassic-extension enable/disable"
version = __version__
description = "Enable/disable an nbextension in configuration."

Expand Down Expand Up @@ -886,31 +886,31 @@ def start(self):

class EnableNBExtensionApp(ToggleNBExtensionApp):
"""An App that enables nbextensions"""
name = "jupyter nbextension enable"
name = "jupyter nbclassic-extension enable"
description = """
Enable an nbextension in frontend configuration.

Usage
jupyter nbextension enable [--system|--sys-prefix]
jupyter nbclassic-extension enable [--system|--sys-prefix]
"""
_toggle_value = True


class DisableNBExtensionApp(ToggleNBExtensionApp):
"""An App that disables nbextensions"""
name = "jupyter nbextension disable"
name = "jupyter nbclassic-extension disable"
description = """
Disable an nbextension in frontend configuration.

Usage
jupyter nbextension disable [--system|--sys-prefix]
jupyter nbclassic-extension disable [--system|--sys-prefix]
"""
_toggle_value = None


class ListNBExtensionsApp(BaseExtensionApp):
"""An App that lists and validates nbextensions"""
name = "jupyter nbextension list"
name = "jupyter nbclassic-extension list"
version = __version__
description = "List all nbextensions known by the configuration system"

Expand Down Expand Up @@ -945,16 +945,16 @@ def start(self):


_examples = """
jupyter nbextension list # list all configured nbextensions
jupyter nbextension install --py <packagename> # install an nbextension from a Python package
jupyter nbextension enable --py <packagename> # enable all nbextensions in a Python package
jupyter nbextension disable --py <packagename> # disable all nbextensions in a Python package
jupyter nbextension uninstall --py <packagename> # uninstall an nbextension in a Python package
jupyter nbclassic-extension list # list all configured nbextensions
jupyter nbclassic-extension install --py <packagename> # install an nbextension from a Python package
jupyter nbclassic-extension enable --py <packagename> # enable all nbextensions in a Python package
jupyter nbclassic-extension disable --py <packagename> # disable all nbextensions in a Python package
jupyter nbclassic-extension uninstall --py <packagename> # uninstall an nbextension in a Python package
"""

class NBExtensionApp(BaseExtensionApp):
"""Base jupyter nbextension command entry point"""
name = "jupyter nbextension"
"""Base jupyter nbclassic-extension command entry point"""
name = "jupyter nbclassic-extension"
version = __version__
description = "Work with Jupyter notebook extensions"
examples = _examples
Expand Down
Loading