Skip to content

Commit 4096595

Browse files
committed
Remove more references to jupyterlab-plotly
1 parent cb488ff commit 4096595

File tree

8 files changed

+18
-128
lines changed

8 files changed

+18
-128
lines changed

.circleci/config.yml

+6-12
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,9 @@ jobs:
342342
. venv/bin/activate
343343
pip install --upgrade pip wheel
344344
pip install -r ./test_requirements/requirements_38_core.txt black inflect
345-
pip install jupyterlab~=3.0
345+
pip install jupyterlab
346346
- run:
347-
name: Update jupyterlab-plotly and jupyter widget plotly.js version
347+
name: Update jupyter widget plotly.js version
348348
command: |
349349
cd packages/python/plotly
350350
. venv/bin/activate
@@ -398,7 +398,7 @@ jobs:
398398
conda config --remove channels defaults
399399
conda config --add channels conda-forge
400400
conda create -n env --yes python=3.9 conda-build=3.28.4 conda-verify
401-
conda install -n env -c conda-forge jupyterlab=3 nodejs=16
401+
conda install -n env -c conda-forge jupyterlab nodejs=16
402402
conda init bash
403403
mkdir output
404404
@@ -407,9 +407,8 @@ jobs:
407407
command: |
408408
eval "$(conda shell.bash hook)"
409409
conda activate env
410-
cd packages/javascript/jupyterlab-plotly
411-
npm ci
412-
npm run build:prod
410+
cd packages/python/plotly/js
411+
npm run build
413412
git status
414413
415414
- run:
@@ -437,12 +436,7 @@ jobs:
437436
command: |
438437
eval "$(conda shell.bash hook)"
439438
conda activate env
440-
cd packages/javascript/jupyterlab-plotly
441-
npm pack
442-
mv jupyterlab-plotly*.tgz ../../../output
443-
cd ../../python/plotly/js
444-
npm run build
445-
mv ../bundle.js ../../../../output
439+
mv packages/python/plotly/bundle.js ../../../../output
446440
447441
- run:
448442
name: Zip output

README.md

+4-9
Original file line numberDiff line numberDiff line change
@@ -111,26 +111,21 @@ conda install "jupyterlab>=3" "ipywidgets>=7.6"
111111

112112
The instructions above apply to JupyterLab 3.x. **For JupyterLab 2 or earlier**, run the following commands to install the required JupyterLab extensions (note that this will require [`node`](https://nodejs.org/) to be installed):
113113

114-
```
115-
# JupyterLab 2.x renderer support
116-
jupyter labextension install [email protected] @jupyter-widgets/jupyterlab-manager
117-
```
118-
119114
Please check out our [Troubleshooting guide](https://plotly.com/python/troubleshooting/) if you run into any problems with JupyterLab.
120115

121-
### Jupyter Notebook Support
116+
### Jupyter Widget Support
122117

123-
For use in the Jupyter Notebook, install the `notebook` and `ipywidgets`
118+
For use as a Jupyter widget, install `jupyter` and `anywidget`
124119
packages using `pip`:
125120

126121
```
127-
pip install "notebook>=5.3" "ipywidgets>=7.5"
122+
pip install jupyter anywidget
128123
```
129124

130125
or `conda`:
131126

132127
```
133-
conda install "notebook>=5.3" "ipywidgets>=7.5"
128+
conda install jupyter anywidget
134129
```
135130

136131
### Static Image Export

contributing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ make that pull request!
211211

212212

213213
## Update to a new version of Plotly.js
214-
First update the version of the `plotly.js` dependency in `packages/javascript/jupyterlab-plotly/package.json`.
214+
First update the version of the `plotly.js` dependency in `packages/python/plotly/js/package.json`.
215215

216216
Then run the `updateplotlyjs` command with:
217217

doc/python/getting-started.md

+3-12
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,16 @@ IFrame(snippet_url + 'getting-started', width='100%', height=1200)
9696

9797
#### JupyterLab Support
9898

99-
To use `plotly` in [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/), install the `jupyterlab` and `ipywidgets` packages in the same environment as you installed `plotly`, using `pip`:
99+
To use `plotly` in [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/), install the `jupyterlab` and `anywidget` packages in the same environment as you installed `plotly`, using `pip`:
100100

101101
```
102-
$ pip install "jupyterlab>=3" "ipywidgets>=7.6"
102+
$ pip install jupyterlab anywidget
103103
```
104104

105105
or `conda`:
106106

107107
```
108-
$ conda install "jupyterlab>=3" "ipywidgets>=7.6"
109-
```
110-
111-
The `plotly` jupyterlab extension is included when you install `plotly` using `pip` or `conda`. When you run Jupyter Lab, ensure you are running it in the same environment that you installed `plotly` in so it has access to the `plotly` jupyterlab extension.
112-
113-
**JupyterLab 2 or earlier** does not support the prebuilt extensions installed using `pip` and `conda`. If you are using JupyterLab 2, run the following command to install the required JupyterLab extensions (note that this will require [`node`](https://nodejs.org/) to be installed):
114-
115-
```
116-
# JupyterLab 2.x renderer support
117-
jupyter labextension install [email protected] @jupyter-widgets/jupyterlab-manager
108+
$ conda install jupyterlab anywidget
118109
```
119110

120111
Launch JupyterLab with:

doc/python/troubleshooting.md

-81
Original file line numberDiff line numberDiff line change
@@ -68,87 +68,6 @@ IFrame(snippet_url + 'renderers', width='100%', height=1200)
6868
<div style="font-size: 0.9em;"><div style="width: calc(100% - 30px); box-shadow: none; border: thin solid rgb(229, 229, 229);"><div style="padding: 5px;"><div><p><strong>Sign up for Dash Club</strong> → Free cheat sheets plus updates from Chris Parmer and Adam Schroeder delivered to your inbox every two months. Includes tips and tricks, community apps, and deep dives into the Dash architecture.
6969
<u><a href="https://go.plotly.com/dash-club?utm_source=Dash+Club+2022&utm_medium=graphing_libraries&utm_content=inline">Join now</a></u>.</p></div></div></div></div>
7070

71-
<!-- #region -->
72-
### JupyterLab Problems
73-
74-
In order to use `plotly` in JupyterLab, you *must have the `jupyterlab-plotly` extension installed* as detailed in the [Getting Started guide](/python/getting-started). When you install `plotly`, this extension is automatically made available to any JupyterLab 3.x installation in the same Python environment.
75-
76-
To list your current extensions, run the following command in a terminal shell **from the same environment as JupyterLab is launched**:
77-
78-
```bash
79-
# Check that jupyterlab-plotly is installed
80-
$ jupyter labextension list
81-
```
82-
83-
Please note that the *extension version matters*: the extension versions in the [Getting Started](/python/getting-started) guide match the version of `plotly` at the top of the guide and so they should be installed together. Note also that these extensions are meant to work with JupyterLab 1 or above but not 0.x.
84-
85-
If automatic installation of the extension is not working in your environment, or if you are using JupyterLab 1.x or 2.0, you may install it manually using the following command, which requires `node` to be installed.
86-
87-
```bash
88-
# Manually reinstall the extension
89-
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyterlab-plotly
90-
```
91-
92-
If you have [installed additional python environments](https://ipython.readthedocs.io/en/stable/install/kernel_install.html) (or kernels) to use with JupyterLab, or if you are using a centrally hosted JupyterLab installation, you need to make sure that the extensions are installed in the python environment used to launch JupyterLab (the "server" environment). If you accidentally installed the extensions (and run the command above) in one of the additional python environments ("processing" environments), then it is possible for the command above to list the correct extensions but for them to not be available in the JupyterLab front-end you have loaded in your browser. To check if this is the problem, you can [look at the active extension list through your browser via the JupyterLab Extension Manager](https://jupyterlab.readthedocs.io/en/stable/user/extensions.html#using-the-extension-manager), which will always list the extensions in the "server" environment. To summarize: if you use JupyterLab with multiple python environments, the extensions must be installed in the "server" environment, and the plotly python library must be installed in each "processing" environment that you intend to use.
93-
94-
> Note that version 4.14.3 of `plotly` or earlier needed two extensions (`jupyterlab-plotly` and `plotlywidget`) to be installed manually running, and that `plotlywidget` requires `@jupyter-widgets/jupyterlab-manager` to be installed:
95-
96-
```bash
97-
# Instructions for `plotly` 4.x
98-
$ jupyter labextension install jupyterlab-plotly plotlywidget @jupyter-widgets/jupyterlab-manager
99-
```
100-
101-
If you have the correct version(s) of the extension(s) installed and active in your active JupyterLab sessions and are still seeing problems, the issue may clear up if you rebuild JupyterLab. This shouldn't be required in principle but some users have resolved their issues this way. To rebuild JupyterLab, shut down JupyterLab and run the following command in a terminal shell **from the same environment as JupyterLab was launched**:
102-
103-
```bash
104-
# rebuilding JupyterLab
105-
$ jupyter lab build
106-
```
107-
108-
To uninstall your Plotly extensions prior to reinstalling them, run the following commands in a terminal shell before reinstalling them by following the instructions in the [Getting Started guide](/python/getting-started):
109-
110-
```bash
111-
# uninstalling extensions to reinstall
112-
$ jupyter labextension uninstall jupyterlab-plotly
113-
$ jupyter labextension uninstall plotlywidget
114-
```
115-
116-
If you run into "out of memory" problems while installing the extensions or building JupyterLab, try running these commands before running `jupyter labextension install`...
117-
118-
```bash
119-
# Avoid "JavaScript heap out of memory" errors during extension installation
120-
# (OS X/Linux)
121-
export NODE_OPTIONS=--max-old-space-size=4096
122-
# (Windows)
123-
set NODE_OPTIONS=--max-old-space-size=4096
124-
```
125-
126-
...and these commands afterwards.
127-
128-
```bash
129-
# Unset NODE_OPTIONS environment variable
130-
# (OS X/Linux)
131-
unset NODE_OPTIONS
132-
# (Windows)
133-
set NODE_OPTIONS=
134-
```
135-
136-
### Jupyter Classic Notebook Problems
137-
138-
The classic Jupyter Notebook (i.e. launched with `jupyter notebook`) sometimes suffers from a problem whereby if you close the window and reopen it, your plots render as blank spaces.
139-
140-
The easiest solution is to force the `notebook` renderer to reload by calling `fig.show("notebook")` instead of just `fig.show()`.
141-
142-
If this problem is recurrent, you may safely run the following code in a Notebook (not in JupyterLab!) at any time and it should restore your figures (for example, you may put it at the top of your notebook for easy access):
143-
144-
```python
145-
import plotly.io as pio
146-
pio.renderers.default='notebook'
147-
```
148-
149-
As a last resort, you can "Restart & Clear Output" from the Kernel menu and rerun your notebook.
150-
151-
<!-- #endregion -->
15271

15372
### VSCode Notebook, Nteract and Streamlit Problems
15473

packages/python/plotly/MANIFEST.in

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
include LICENSE.txt
22
include README.md
3-
include jupyterlab-plotly.json
43
include versioneer.py
54
include plotly/_version.py
65
include plotly/bundle.js

packages/python/plotly/js/widget.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Adapted from ../../../javascript/jupyterlab-plotly/src/Figure.ts for anywidget.
21
import type { DOMWidgetModel } from "@jupyter-widgets/base";
32
import _ from "lodash";
43
import Plotly from "plotly.js";

packages/python/plotly/setup.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
here = os.path.dirname(os.path.abspath(__file__))
2222
project_root = os.path.dirname(os.path.dirname(os.path.dirname(here)))
23-
node_root = os.path.join(project_root, "packages", "javascript", "jupyterlab-plotly")
23+
node_root = os.path.join(project_root, "packages", "python", "plotly", "js")
2424
is_repo = os.path.exists(os.path.join(project_root, ".git"))
2525

2626
npm_path = os.pathsep.join(
@@ -99,9 +99,7 @@ class NPM(Command):
9999
node_modules = os.path.join(node_root, "node_modules")
100100

101101
targets = [
102-
os.path.join(here, "jupyterlab_plotly", "nbextension", "extension.js"),
103-
os.path.join(here, "jupyterlab_plotly", "nbextension", "index.js"),
104-
os.path.join(here, "jupyterlab_plotly", "labextension", "package.json"),
102+
os.path.join(here, "bundle.js"),
105103
]
106104

107105
def initialize_options(self):
@@ -125,11 +123,6 @@ def has_npm(self):
125123
except:
126124
return False
127125

128-
def should_run_npm_install(self):
129-
package_json = os.path.join(node_root, "package.json")
130-
node_modules_exists = os.path.exists(self.node_modules)
131-
return self.has_npm()
132-
133126
def run(self):
134127
if skip_npm:
135128
log.info("Skipping npm-installation")
@@ -144,7 +137,7 @@ def run(self):
144137
env = os.environ.copy()
145138
env["PATH"] = npm_path
146139

147-
if self.should_run_npm_install():
140+
if self.has_npm():
148141
log.info(
149142
"Installing build dependencies with npm. This may take a while..."
150143
)
@@ -164,7 +157,7 @@ def run(self):
164157
stderr=sys.stderr,
165158
)
166159
check_call(
167-
[npmName, "run", "build:prod"],
160+
[npmName, "run", "build"],
168161
cwd=node_root,
169162
stdout=sys.stdout,
170163
stderr=sys.stderr,

0 commit comments

Comments
 (0)