-
Notifications
You must be signed in to change notification settings - Fork 310
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
Confusion between extension_name and module name when launching via entrypoints or launch_instance #222
Comments
Thanks for bringing this up, @echarles. I went back and forth on this issue. I had chosen to set a hard constraint that an extension's name == extension module name. I thought that would reduce some complexity in extensions. Seeing Lab's usecase, I agree we should relax this constraint. Here's the current complexity:
At the time, it seemed simpler to make the package_name and extension_name match to avoid multiple names for the same extension. To get around this, we'll need to:
|
So we would need to have user declarations for package (which is for me synonym to module) and extension name in both class that extends ExtensionApp and in the _jupyter_server_extension_paths? If this is the case, why do we need to duplicate those? PS: Maybe you can write sample snippets to be sure I understand it correctly. |
Technically, "module" and "package_name" are slightly different. "module" is supposed to be the full path to the So, technically, you should have "module" == "jupyterlab.labapp" and "package_name" == "jupyterlab" "package_name" is used to find the |
Brilliant! Thx for clarifying the nomenclature 🥇 I still feel a bit of duplication between all those declarations, but the snippets I would refer to may help to remove that feeling :) |
Some snippets to help explain... ExtensionApp becomes: class ExtensionApp:
extension_name = "" # "lab"
package_name = "" # "jupyterlab"
...
def initialize_server(self):
...
config = Config({
"ServerApp": {
# NOTE THE CHANGE TO PACKAGE_NAME HERE
"jpserver_extensions": {cls.package_name: True},
"open_browser": True,
"default_url": cls.extension_url
}
}) An example of a def _jupyter_server_extension_paths():
return [
{
"module": "path/to/_load_jupyter_server_extension",
"name": "lab",
"app": LabApp
}
] The "name" key is used by serverapp to store loaded extensions. The config file for enabling the extension becomes: {
"ServerApp": {
"jpserver_extension": {
"jupyterlab": true
}
}
} |
So in ServerApp.jpserver_extension you have to say which In _jupyter_server_extension_paths you have to say the |
Many server extensions are not apps. They are just |
Why the change from |
@blink1073 honestly, I don't have a good answer for that 😆. It was a change I made early on in the development of ExtensionApp's to avoid legacy path resolution, but (I think) I've since patched the places where that would be an issue. It probably makes sense to switch back... I'll bring it up in the Jupyter Server meeting. |
Unfortunately I had a conflict. I think we should sync up on the jupyter paths logic. |
Closing at this confusion has been managed in PRs prior to 1.0.0 release. |
* add a error modal in the UI when a kernel action is blocked * make the console log less aggressive * add initial test for kernelblock plugin * test ui element for exact match
The
extension_name
is used asjpserver_extensions
value when launching via entrypoint or launch_instancehttps://github.com/jupyter/jupyter_server/blob/6d909ca928f165fa4f2772b692f08c0a9de4812f/jupyter_server/extension/application.py#L311-L317
This gives issue if the
extension_name
is different from the module name where the extension resides. To replicate the issue, just change in the exampleextension_name = "simple_ext1"
toextension_name = "new_simple_ext1"
, launch viapython -m simple_ext1
orjupyter simple-ext1
and it will fail.Of course, if you launch via
jupyter server --ServerApp.jpserver_extensions="{'simple_ext1': True}"
this will succeed as thejpserver_extensions
is overriden via CLI.Could
_jupyter_server_extension_paths
be used to use the correct name which would be the module value? In that case, should we add a extension_name to the _jupyter_server_extension_paths dictionaries?@Zsailer
The text was updated successfully, but these errors were encountered: