-
Notifications
You must be signed in to change notification settings - Fork 306
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
[MRG] Configurable server extension applications #48
[MRG] Configurable server extension applications #48
Conversation
This looks great! I pushed a bit of docs cleanup. |
So you want to stick with the term "extension"? Fine with me. I guess calling it "server app" would be somewhat misleading, because the extension point (plug-in point?) is meant for front-ends. |
This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there: https://discourse.jupyter.org/t/rename-this-category-to-jupyter-server/1130/6 |
@rolweber I definitely designed this class with front-end applications in mind, but it's valuable to any extension that might want to use traitlet's configurability APIs. In my head, the ServerApp is the core object with a defined set of endpoints+REST API (kernels, kernelspec, sessions, contents, etc.), and other endpoints added by notebook, lab, gateway, etc. "extend" the core server. That's my original reason for naming it "ExtensionApp". Though perhaps extension is a loaded term... Do you have something else in mind? |
Maybe call the base class |
@blink1073 Using Instead, the |
+1 on |
I think the issue is that the term |
d02a0d7
to
9217cf9
Compare
Great discussion. Names are hard, but important. Question. If you were to run ExtensionApp directly, do you get the same functionality as running ServerApp directly? (I expect so.) Since |
Since this class is meant to be subclassed, but isn't used as a base class inside the package, I like How about avoiding "extension" as a noun?
|
👍 for |
FWIW, I don't really care for the used of I feel like when one reads |
Good point. Too bad we cannot use braces in classnames... I'm OK with |
|
Okay, great! I'm on board with Before we merge this, I'd like to get this mostly working with the Notebook front-end, JupyterLab, nteract_on_jupyter, and (maybe) voila. These projects cover a wide range of use-cases the |
Oh, great, you had to bring that up! 😃 I suppose if we apply the same transformation to I'm okay either way - or other suggestions as well. |
Ok, the old notebook server and jupyter server are out-of-sync enough to make testing this PR on a notebook extension a pain. I've got it working, but I had to port pieces of jupyter server to make it work. The jupyter server is just too far behind the notebook right now. So... I'd really like to update jupyter server to changes in notebook. Anyone opposed to this? I'm happy to tackle this myself, but if someone has more experience doing this, it might go faster. |
@SylvainCorlay did the initial porting, and it required re-mapping directories by hand iirc. I see two options, both requiring Sylvain to give some pointers:
|
AIUI, Apps need to be extensions, because only one app is launched at a time. But the app can have as many handlers as needed, and those are just handlers, not extensions of another handler?
I prefer the first suggestion :-) |
@rolweber - well, when you say it like that, I guess I retract my suggestion and I apologize for the detour. |
Hmm, thinking of my Zen of Python (re: namespacing). We're already in a module named |
No Zen-expert, but I agree. Python has namespaces, no need to repeat them in class names. |
Great, rolling back to the original names! |
If the purpose of these is to act as base classes then shouldn't that be part of their name. I thought that was a convention. If so, I'd prefer it be the suffix. |
We have a JupyterApp that is the base class of all of the Jupyter applications. I think it is fair to say that an ExtensionApp is a thing, and I subclass that to a more specific one. |
Understood. Thanks. |
ac586bf
to
9915490
Compare
@Zsailer sorry for not coming here earlier. This is looking pretty good to me. Any reason why this is still marked as |
@SylvainCorlay I think this is ready for merge (and iteration). I'll work on documentation in a following PR. |
In case anyone is interested, I applied this new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Yeah! |
Thanks, @rolweber ! |
* try just modifying the build file * clean up build config * get check manifest from pip * update * cleanup * whoops * figure out where cache is * clean up and add caching * add conda cache * do not cache conda
This is an initial implementation of a "Jupyter server extension application" class. Pinging @SylvainCorlay @takluyver @kevin-bates @lresende @rolweber @maartenbreddels for review.
What?
This PR introduces the
ExtensionApp
to the Jupyter server, a base class for creating configurable, front-end client applications as extensions of the jupyter server.Details
ExtensionApp
subclassesJupyterApp
fromjupyter_core
. Extensions that subclass this class can be:jupyter <extension_name> ...
jupyter_<extension_name>_config.py
.When an extension application is launched, it
self.load_jupyter_server_extension()
method./static/<extension_name>/
endpoint where it serves static files (i.e. js, css, etc.).Why?
There are various frontends that depend on the classic Notebook Server (i.e. notebook, nteract, lab, and voila). However, the Notebook frontend is deeply coupled with the Notebook server, forcing other clients to work around it. Jupyter Server separates out the server from the notebook, so all front-end applications are first-class citizens to the server.
This PR makes it much easier to write client applications that depend on the Jupyter Server.
How?
Subclass the
ExtensionApp
. Set the following traits:extension_name
: name of the extension.static_paths
: path to static files directorytemplate_paths
: path to templates directory.and define (optional) the following methods:
initialize_handlers()
: append handlers toself.handlers
.initialize_templates()
: setup your html templating options.initialize_settings()
: add extensions settings to the webapp usingself.settings
.Example
Define handlers by subclassing the
ExtensionHandler
.Example
Point Jupyter server to the extension. We need to define two things:
_jupyter_server_extension_paths()
: a function defining what module to load the extension from.load_jupyter_server_extension()
: point there server to the extension's loading function mechansim.Example
Add the following configuration to your jupyter configuration directory to enable the extension.
Add entry point in
setup.py
.