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

Include federated extensions in extension manager from the api #9390

Merged
merged 11 commits into from Dec 17, 2020

Conversation

jasongrout
Copy link
Contributor

References

Fixes #9367

Code changes

Adds prebuilt (federated) extensions to the extension api

@echarles is planning to use this to upgrade the support for federated extensions in the extension manager, for example having uninstall instructions, etc.

Here is an example response from the extension api now, with jupyterlab_apod installed as a prebuilt extension and @jupyter-widgets/jupyterlab-manager installed as a source extension:

[
    {
        "name": "jupyterlab_apod",
        "description": "",
        "url": "",
        "enabled": true,
        "core": false,
        "latest_version": "0.1.0",
        "installed_version": "0.1.0",
        "status": "ok",
        "pkg_type": "federated",
        "install": {
            "packageManager": "python",
            "packageName": "jupyterlab_apod",
            "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_apod"
        }
    },
    {
        "name": "@jupyter-widgets/jupyterlab-manager",
        "description": "The JupyterLab extension providing Jupyter widgets.",
        "url": "https://github.com/jupyter-widgets/ipywidgets",
        "enabled": true,
        "core": false,
        "latest_version": "3.0.0-alpha.2",
        "installed_version": "3.0.0-alpha.2",
        "status": "ok",
        "pkg_type": "source"
    }
]

User-facing changes

Backwards-incompatible changes

@jasongrout jasongrout added this to the 3.0 milestone Nov 21, 2020
@jupyterlab-dev-mode
Copy link

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

@jasongrout
Copy link
Contributor Author

To make sure it's clear - I set this as draft because @echarles was going to work on the frontend part. @echarles, I think it's ready for you to work with - the prebuilt extension data should be returned in the api call this this change.

@echarles
Copy link
Contributor

echarles commented Dec 6, 2020

@jasongrout I am running your branch and receive an execption

[E 2020-12-06 10:28:42.408 ServerApp] Uncaught exception GET /lab/api/extensions?1607246922392 (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/lab/api/extensions?1607246922392', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "/Users/echarles/datalayer/opt/miniconda3/envs/datalayer/lib/python3.8/site-packages/tornado/web.py", line 1704, in _execute
        result = await result
      File "/Users/echarles/datalayer/opt/miniconda3/envs/datalayer/lib/python3.8/site-packages/tornado/gen.py", line 769, in run
        yielded = self.gen.throw(*exc_info)  # type: ignore
      File "/Users/echarles/datalayer/repos/jupyterlab/jupyterlab/handlers/extension_manager_handler.py", line 250, in get
        extensions = yield self.manager.list_extensions()
      File "/Users/echarles/datalayer/opt/miniconda3/envs/datalayer/lib/python3.8/site-packages/tornado/gen.py", line 762, in run
        value = future.result()
      File "/Users/echarles/datalayer/opt/miniconda3/envs/datalayer/lib/python3.8/site-packages/tornado/gen.py", line 234, in wrapper
        yielded = ctx_run(next, result)
      File "/Users/echarles/datalayer/repos/jupyterlab/jupyterlab/handlers/extension_manager_handler.py", line 111, in list_extensions
        install=data['install'],
    KeyError: 'install'

Minor comment: Should pkg_type='federated' should be pkg_type='prebuilt' based on latest nomenclature?

@echarles
Copy link
Contributor

echarles commented Dec 6, 2020

I am running with --extensions-in-dev-mode. Without --extensions-in-dev-mode the exception does not show up (I guess because no sourceextension are listed and that code block is not triggered.

Sorry, pkg_type='federated' should be pkg_type='source' , right?

Via CLI I have 2 extensions which are shown fine.

$ jupyter labextension list
JupyterLab v3.0.0rc10
/Users/echarles/datalayer/opt/miniconda3/envs/datalayer/share/jupyter/labextensions
        @datalayer-jupyter/jupyterlab-theme-winter v0.1.0 enabled OK
        @datalayer-jupyter/jupyterlab-theme-christmas v0.1.2 enabled OK

@jasongrout
Copy link
Contributor Author

Sorry, pkg_type='federated' should be pkg_type='source' , right?

actually, 'prebuilt' - I was waiting until you finished with this PR to make a sweep through the codebase changing the terms.

@echarles
Copy link
Contributor

echarles commented Dec 9, 2020

@jasongrout I will take this before Friday (also, can not make today weekly community call)

@echarles
Copy link
Contributor

@jasongrout I have pushed to your branch the UI part (and made minor fixes in the extension manager handler). This shows for now

Screenshot 2020-12-16 at 11 18 36

I have tried with a few sourceextensions (or from my local dev env, or the jupyterlab_apod install from pypi. The API call does not returns in all cases an empty "install": {} section. Maybe due to missing json file to indicate that? Could you have a look to the API or maybe publish a jupyterlab_apod which shows up the needed section like:

"install": {
            "packageManager": "python",
            "packageName": "jupyterlab_apod",
            "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_apod"
        }

[
  {
    "name": "jupyterlab_apod",
    "description": "",
    "url": "",
    "enabled": true,
    "core": false,
    "latest_version": "0.1.0",
    "installed_version": "0.1.0",
    "status": "ok",
    "pkg_type": "source",
    "install": {
      
    }
  },
  {
    "name": "@jupyterlab-examples/hello-world",
    "description": "",
    "url": "",
    "enabled": true,
    "core": false,
    "latest_version": "0.1.0",
    "installed_version": "0.1.0",
    "status": "ok",
    "pkg_type": "source",
    "install": {
      
    }
  },
  {
    "name": "@jupyter-widgets/jupyterlab-manager",
    "description": "",
    "url": "",
    "enabled": true,
    "core": false,
    "latest_version": "3.0.0-alpha.2",
    "installed_version": "3.0.0-alpha.2",
    "status": "ok",
    "pkg_type": "source",
    "install": {
      
    }
  },
  {
    "name": "@jupyterlab-examples/signals",
    "description": "minimal lab example",
    "url": "https://github.com/jupyterlab/extension-examples",
    "enabled": true,
    "core": false,
    "latest_version": "0.1.0",
    "installed_version": "0.1.0",
    "status": "warning",
    "pkg_type": "pre-built"
  }
]

@jtpio
Copy link
Member

jtpio commented Dec 16, 2020

The API call does not returns in all cases an empty "install": {} section. Maybe due to missing json file to indicate that? Could you have a look to the API or maybe publish a jupyterlab_apod which shows up the needed section like

@echarles as an alternative, there is also the jupyterlab-python-file extension available on PyPI, which includes the install.json metadata file: https://pypi.org/project/jupyterlab-python-file/

@echarles
Copy link
Contributor

Hello @jtpio. Thx a lot for the reviews and help. I have used your jupyterlab-python-fileextension that shows up the ìnstall` stanza and use it if it is available to display the instructions to the user.

Screenshot 2020-12-17 at 08 32 32

@jtpio
Copy link
Member

jtpio commented Dec 17, 2020

Nice, this looks good!

Based on the comments above, it looks like the terms Source and Prebuilt should be swapped?

@echarles
Copy link
Contributor

@jtpio I have now swapped the sourceand prebuilt terms.

@jtpio
Copy link
Member

jtpio commented Dec 17, 2020

Thanks!

Just pulled the latest from this branch locally, and this is what it looks like:

  • running with --extensions-in-dev-mode
  • one prebuilt extension has the install.json
  • the other one doesn't

extension-manager-prebuilt

It looks good and seems to cover the main concern of being able to show a useful message to the end users.

Do you think this is ready to go?

@echarles
Copy link
Contributor

Just pushed a latest change as @jtpio has suggested. @jasongrout can you review and undraft it?

@jtpio jtpio marked this pull request as ready for review December 17, 2020 13:20
@jtpio
Copy link
Member

jtpio commented Dec 17, 2020

Thanks @echarles and @jasongrout for working on this.

I marked it as ready for review since the frontend now shows the uninstall instructions to the user.

Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@blink1073 blink1073 merged commit 066c954 into jupyterlab:master Dec 17, 2020
1 check passed
@jasongrout
Copy link
Contributor Author

jasongrout commented Dec 17, 2020

I was just about to press the green button too, but @blink1073 beat me to it. Thanks again!

@github-actions github-actions bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Jun 16, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg:extensionmanager status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extension manager should be as helpful as labextension for prebuilt extensions
4 participants