-
Notifications
You must be signed in to change notification settings - Fork 70
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
Compatibility with ServerApp backend #65
Conversation
Thank you so much for this pull request! The I'm just a bit worried about forking the templates. Perhaps there is a better way. What do you think @unkcpz? |
Thanks @pdstack for the contribution! I have some questions and need some more details.
Which Can you describe a bit of your jupyter environment? Which backend you are using, jupyterLab or the notebook6, or
We didn't go this way yet since we think it is more straightforward to test on notebook7 when it is ready. It is under development as described in JEP https://jupyter.org/enhancement-proposals/79-notebook-v7/notebook-v7.html. It seems the |
Thanks for having a look at this pull request and your comments! I have been testing with the latest version of
edit I'm not actually sure how to tell which backend I'm running. I've been typically installing jupyter + jupyterlab, then launching the server using If the plan was to wait until notebook-v7 lands then I am happy to wait until then. As you say it probably makes more sense to try and support notebook-v7 development, rather than forking the notebook html templates, I'm just not sure how much work that would involve. This fork serves the purpose I need for now, including this version in builds will resolve the current compatibility issues as a temporary fix until notebook v7 is released. Did you want me to close the pull request? Or are there any parts you think it would make sense to merge in now, like the |
Thanks for the detail, can you try to run following code in a notebook you start? (FYI, find out if my code runs inside a notebook or jupyter lab)
In our AiiDAlab deployment, we need to set
If you can pin the jupyter-client version, I advise to do it for now so you can use the App mode without isuses. I'll come back with the test if it possible to using the jupyter-client v8 with using the notebook backend and running appmode without issue. |
I did a test which try to use minimal change to run the appmode in jupyter-client. You can find my change at #66, simply as you mentioned, using the flag to allow create the hidden file. |
… path on extension load, added hidden_temp_files configuration option
Thanks for your comment about the backend, while the psutil command didn't really tell me anything, the other link was quite informative. The terminal window running the jupyter command makes it easy to tell which backend is being used, the logging messages are prefixed with NotebookApp or ServerApp. As a result I realised what I am actually trying to acheive here is getting appmode to work with the ServerApp backend. While The issues with I had copied the notebook html templates because they are not available in the ServerApp templates, I managed to get them working by using I have also added another configuration option: hidden_temp_files, which adds/removes the I think this pull request is in a good spot now, and enabling ServerApp backend compatibility should make Appmode more usable generally going forward. In terms of the other pull request #66, I think it may eventually run into the same tornado/zmq issues as I was having before with |
…ad of __path__ for consistency
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.
@pdstack thanks a lot for further investigation. I think the changes look all good to me. I just have a minor request on the duplicate pattern for all await
clause changes. Let me know if it is possible to simplify in context manager. If it is to complex I am okay with the current change. I'll make a test after.
I am okay with this change, for the AiiDAlab, it is always easy to make changes on deployment options, so I don't have a preference. @oschuett can you double-check this PR? I think it is simplified a lot and okay to have a go. BTW, I don't have permission on this repository, please let me know if you need me to approve it or if it is possible to give me written permission to merge. |
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.
Thanks a lot for having a generic function for the await pattern @pdstack
Just one minor request and then I think it is good to go.
appmode/server_extension.py
Outdated
from tornado import web | ||
from traitlets.config import LoggingConfigurable | ||
from traitlets import Bool, Unicode | ||
|
||
|
||
async def ensure_async(obj): |
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.
The name is a bit confusing with the asyncio.ensure_future
. I would suggest call the function def await_if_awaitable(obj)
.
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've renamed it to await_if_awaitable. The name ensure_async was what jupyter_core used for the function, but I don't have any strong opinions on it.
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.
Okay, then I think they are all fine, since you already changed them, I won't ask you to change them back 😸 . Thanks!
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.
No worries, easy enough to change back if you think the other name was better, or you think of another one. Thanks for the quick reviews!
I test locally and it works neatly. 👍 |
Okay, merged. Thanks again @pdstack I plan to clean up the release flow and make a new release. Although it is backward compatible, maybe still good to make a minor version release to |
I think a minor release would make sense, there are 2 configuration flags added, as well as python 2 support being dropped. |
@unkcpz makes sense to me. |
edit I have realised this is actually a ServerApp backend compatibility issue. See later post in this thread for update.
Appmode doesn't work with newer versions of jupyter_client, this pull request attempts to resolve these issuses. A temp_dir option is also added to allow for custom app mode directories, within the current jupyter path.
There are a number of changes in this pull request that may require discussion or further work, happy to amend if there are better ways of doing this.
Compatibility changes:
jupyter notebook
is now causing tornado exceptions when interacting with widgets. This may be fixed in future, but it is preferable to work with thejupyter lab
command anyway, which doesn't have this problem. Thejupyter lab
command results in the notebook.html and page.html templates not being served and available for appmode to use, to get around this I have copied the latest version of these templates from nbclassic into the repo, with very small changes. This is an ugly way of fixing this problem, if anyone has a better idea on how to do this please let me know.