-
Notifications
You must be signed in to change notification settings - Fork 62
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
NotebookApp shim layer #7
Conversation
Posting some important documentation here. The order in which CLI arguments are loaded and passed to their respective classes matters when working with ExtensionApp. Listing the current steps here.
|
there's redundant traits. | ||
2. Pass trait to `NotebookApp`. | ||
- If the argument is a trait of just `ServerApp` only | ||
(i.e. the trait moved from `NotebookApp` to `ServerApp`): |
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.
Just to clarify, take this construed example:
- If I start nbclassic, I want the server to serve it from port 8888
- I want all other jupyter servers to serve from port 9001
How would I configure this?
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.
I think you would want to launch two separate servers. Launch nbclassic like so:
jupyter nbclassic --ServerApp.port=8888
then start a second server with
jupyter server --ServerApp.port=9001 --ServerApp.jpserver_extensions=[...]
Aliases can be used in both examples to shorten the CLI. You can also point each server to separate config files with these options set there too.
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.
Ah, so basically the answer is "this is not possible via the config system, please use command arguments". Sure.
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.
Oh, I see. I thought you were asking about running two servers at the same time.
Right—if you have redundant config, the "last write wins". Currently, extensions are sorted alphabetically before they are loaded. So if two extensions configure the server, the last one in the list will override all others.
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.
Oh, I see. I thought you were asking about running two servers at the same time.
I was, but without using command line arguments :)
I've run into a challenging issue with moving traits from an extension to the ServerApp. There is a circular loading issue that makes shimming traits to ServerApp difficult. The |
I've found a way around this, but it will require changes to Jupyter Server. I'll open a PR there soon. |
jupyter-server/jupyter_server#180 enables the ServerApp to discover config in extensions before creating instances of WebApplication and HTTPServer. This enables the shim layer defined here to intercept this config and update traits appropriately. This shim layer should be working now. Now on to writing tests! 😎 |
Working a bit more with this branch, I spot a strange behavior with the jlab examples. The template dir is taken into account but the template is no more found. Maybe something to fix on jlab side, but still this is a notable change in the behavior. |
Merging this, as tests are stable. I'll iterate in future PRs. |
Summary
This PR adds a simple class for shimming traits for apps that are transitioning from
NotebookApp
(notebook package) toServerApp
(jupyter_server package)Some traits have moved, so their prefix in jupyter's CLI and config files have changed—e.g.
NotebookApp.port
has moved toServerApp.port
.Some traits have duplicated, but no longer inherit their values—e.g.
NotebookApp.default_url
is different thanServerApp.default_url
. Previously, these traits were equal. Now, users must configure their traits separately.Below, we give a detailed description of what happens when traits are intercepted by this shim layer. The goal is that projects can use this shim layer during an intermediate "transition" period after switching to Jupyter Server. Then, after a short cycle of "deprecation warnings", they can drop this shim layer without any interruption.
Detailed Explanation.
A detailed explanation of how traits are handled:
ServerApp
,pass this trait to
ServerApp
.NotebookApp
,NotebookApp
andServerApp
:there's redundant traits.
NotebookApp
.ServerApp
only(i.e. the trait moved from
NotebookApp
toServerApp
):ServerApp
.NotebookApp
only, pass traitto
NotebookApp
."Trait not found."
error.ExtensionApp
:ExtensionApp
,NotebookApp
, andServerApp
,ExtensionApp
andNotebookApp
,ExtensionApp
andServerApp
,ExtensionApp
.NotebookApp
but notExtensionApp
,ServerApp
but notExtensionApp
,