Add optional
field to sharedPackages
in package.json
-> jupyterlab
#15151
Labels
optional
field to sharedPackages
in package.json
-> jupyterlab
#15151
Problem
Currently, there is no way to mark javascript dependencies in
package.json
->jupyterlab
->sharedPackages
as optional.Background:
I'm developing an extension that adds new functionality through toolbar buttons and widgets.
In an earlier release, I made
ipywidgets
a dependency because of the widgets. Now, I want to makeipywidgets
an optional dependency, so I removed it from thepyproject.toml
.When testing the package, I realized that removing
ipywidgets
broke it, and upon debugging, I noticed that the error came because the extension could not find the@jupyter-widgets/base
JS package. After some debugging, I noticed that mypackage.json
has ajupyterlab
section and asharedPackages
subsection (I created this project from the template).It seems like since I no longer have
ipywidgets
as a dependency,@jupyter-widgets/base
is never installed and the package breaks, because it's configured to share the@jupyter-widgets/base
package (viasharedPackages
)For now, I eliminated
ipywidgets
from thesharedPackages
section. This fixed the problem, but it isn't an ideal solution.Proposed Solution
Add an
optional
field tosharedPackages
inpackage.json
->jupyterlab
to indicate that some dependency is optional.Additional context
Jupyter forums question: https://discourse.jupyter.org/t/optional-dependency-for-jupyterlab-extension/21557
The text was updated successfully, but these errors were encountered: