ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

Improve error message if a frontend version is not valid

Open jtpio opened this issue 1 year ago • 0 comments
trafficstars

Problem

Currently, the widget manager for JupyterLab displays an error message when there is version mismatch (added in https://github.com/jupyter-widgets/ipywidgets/pull/3185), which is useful as it is also displayed in the output cell:

https://github.com/jupyter-widgets/ipywidgets/blob/b78de43e12ff26e4aa16e6e4c6844a7c82a8ee1c/python/jupyterlab_widgets/src/manager.ts#L208-L216

The semver cache checks the maxSatisfying version here:

https://github.com/jupyter-widgets/ipywidgets/blob/b78de43e12ff26e4aa16e6e4c6844a7c82a8ee1c/python/jupyterlab_widgets/src/semvercache.ts#L24

But it does not check if the provided version is valid.

One possible source of confusion would be if the frontend version is not set properly. For example a value of 1.8.0a0 is not valid according to the valid function from the semver package:

image

This is reproducible with the (now deprecated) Jupyter Widget cookiecutter, by creating a new widget and changing the version to 0.1.0a0:

image

Error: Module jupyter-widget-example, version ^0.1.0a0 is not registered, however,         0.1.0a0 is

Proposed Solution

Additional context

Maybe we could first check if the provided version is valid, and update the error message so it's less confusing to users when the issue is about a malformed version?

cc @ohrely

jtpio avatar May 01 '24 17:05 jtpio