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

jupyter-archive integration #251

Closed
hadim opened this issue Jun 28, 2020 · 3 comments
Closed

jupyter-archive integration #251

hadim opened this issue Jun 28, 2020 · 3 comments

Comments

@hadim
Copy link

hadim commented Jun 28, 2020

I would like to integrate jupyter-archive into Jupyter Server/Lab.

See jupyterlab-contrib/jupyter-archive#2 for context.

The UI side is a JLab extension. POC PR: jupyterlab/jupyterlab#7294 (but it must be refactored to the latest code on jupyter-archive).

The backend side was submitted as a notebook PR but got closed because of the feature freeze: jupyter/notebook#4945

This is why I would like to do the integration in jupyter_server.

After a quick chat with @echarles on Gitter it seems that jupyter_server is not totally ready for this kind of things to be integrated. I was initially looking for a way to start jupyter lab using jupyter_server (in order to make my PR).

From my understanding, those two PRs must be merged first: jupyterlab/jupyterlab#7416 and jupyterlab/jupyterlab_server#79

@Zsailer
Copy link
Member

Zsailer commented Jun 29, 2020

Thanks, @hadim. I really appreciate your patience here. We (Jupyter) are in an unusual transition phase, splitting our server and frontend to make things more flexible for Jupyter's future. This transition makes things particularly difficult for projects like jupyter-archive, where you're trying to coordinate changes on both ends. Once Jupyter Server stabilizes, these changes won't be so cumbersome—but for now, this takes some extra effort.

Now, addressing the proposal here. jupyter-archive is great really great work!

A couple of things to consider here moving forward... The main reason we split Jupyter Server from notebook is to provide a Jupyter-based server that can be used by any arbitrary frontend. It strives to offer a REST API that any client can tap into and leverage how they please. It should never depend on a client application.

This means the only piece of jupyter-archive that we can consider for Jupyter Server is the Python server extension.

This raises the following questions:

  • Are these goals of endpoints general and secure enough to incorporate as a server extension?
  • Can this extension exists separate from its frontend counterparts?
  • Can these endpoints be RESTful?

If the answer to these questions is "YES!", then this becomes a proposal to extend Jupyter Server's REST API, and we should discuss this issue at that level. If the answer is "No.", then it makes sense to keep jupyter-archive as a Jupyter Server+Frontend Extension.

All that said, I think there is some great potential for this to become part of the Jupyter Server REST API. You can submit a PR to Jupyter Server today (without needing the JupyterLab/Notebook frontend to work) with a solid REST API for archiving+downloading directories.

@hadim
Copy link
Author

hadim commented Jun 29, 2020

Thanks for the detailed explanation.

The server extension is totally independent of the frontend one and I am pretty sure it's not dependant on any frontend implementation (pure REST API server extension). But maybe someone can actually confirm that looking at the code below used to register the extension on the server-side:

from notebook.utils import url_path_join
from .handlers import DownloadArchiveHandler
from .handlers import ExtractArchiveHandler


# Jupyter Extension points
def _jupyter_server_extension_paths():
    return [{"module": "jupyter_archive"}]


def load_jupyter_server_extension(nbapp):

    # Add download handler.
    base_url = url_path_join(nbapp.web_app.settings["base_url"], r"/directories/(.*)")
    handlers = [(base_url, DownloadArchiveHandler)]
    nbapp.web_app.add_handlers(".*", handlers)

    # Add extract handler.
    base_url = url_path_join(nbapp.web_app.settings["base_url"], r"/extract-archive/(.*)")
    handlers = [(base_url, ExtractArchiveHandler)]
    nbapp.web_app.add_handlers(".*", handlers)

    nbapp.log.info("jupyter_archive is enabled.")

from https://github.com/hadim/jupyter-archive/blob/master/jupyter_archive/__init__.py

I really think this feature should be shipped by default in Jupyter and that's why I have been looking to integrate it into Jupyter from day one.

If you guys tell me you're ok with that then I'll make a PR so we can discuss the implementation (which is pretty simple at the end).

I'll address the JLab part once the jupyter_server side implementation is done.

@hadim
Copy link
Author

hadim commented Jun 29, 2020

I have pushed a POC of the implementation: #252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants