Skip to content

Commit 7f2eb35

Browse files
authored
Merge pull request #5608 from plotly/cam/update-plotly.js-3.6.0
chore: Update plotly.js to v3.6.0
2 parents f0755e5 + f57cf96 commit 7f2eb35

12 files changed

Lines changed: 338 additions & 246 deletions

File tree

CONTRIBUTING.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,21 @@ python commands.py updateplotlyjs
274274

275275
This downloads new versions of `plot-schema.json` and `plotly.min.js` from the `plotly/plotly.js` GitHub repository
276276
and places them in `plotly/package_data`.
277-
It then regenerates all of the `graph_objs` classes based on the new schema.
277+
It then regenerates all of the `graph_objs` classes based on the new schema,
278+
and finally runs `npm install` in `js/` to refresh `js/package-lock.json` against the new `plotly.js`.
279+
Commit the updated `js/package-lock.json` along with the regenerated files.
280+
281+
The JupyterLab extension and FigureWidget bundles in `plotly/labextension` and `plotly/package_data/widgetbundle.js`
282+
are rebuilt as part of the release flow (see [RELEASE.md](RELEASE.md)) rather than on every plotly.js bump.
283+
284+
If you need to skip the `npm install` step entirely (e.g. `npm` isn't available),
285+
set the `SKIP_NPM=1` environment variable:
286+
287+
```bash
288+
SKIP_NPM=1 python commands.py updateplotlyjs
289+
```
290+
291+
If you do skip it, you'll need to run `npm install` in `js/` yourself before committing so the lockfile stays in sync.
278292

279293
### Using a Development Branch of Plotly.js
280294

@@ -319,6 +333,6 @@ Usage: `python commands.py <subcommand> <args>`
319333
| `codegen [--noformat]` | Regenerate Python files according to `plot-schema.json`.`--noformat` skips formatter step. |
320334
| `lint` | Lint all Python code in `plotly/`. |
321335
| `format` | Format all Python code in `plotly/`. |
322-
| `updateplotlyjs` | Update `plotly.min.js` and `plot-schema.json` to match the `plotly.js` version specified in `js/package.json`. Then, run codegen to regenerate the Python files. |
336+
| `updateplotlyjs` | Update `plotly.min.js` and `plot-schema.json` to match the `plotly.js` version specified in `js/package.json`, run codegen to regenerate the Python files, then run `npm install` in `js/` to refresh `js/package-lock.json`. Set `SKIP_NPM=1` to skip the npm step. |
323337
| `updateplotlyjsdev [--devrepo REPONAME --devbranch BRANCHNAME] \| [--local PATH]` | Update `plot-schema.json` and `plotly.min.js` to match the version in the provided plotly.js repo name and branch name, OR local path. Then, run codegen to regenerate the Python files. |
324338
| `bumpversion X.Y.Z` | Update the plotly.py version number to X.Y.Z across all files where it needs to be updated. |

codegen/resources/plot-schema.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3063,6 +3063,17 @@
30633063
"y unified"
30643064
]
30653065
},
3066+
"hoversort": {
3067+
"description": "Determines the order of items shown in unified hover labels. If *trace*, items are sorted by trace index. If *value descending*, items are sorted by value from largest to smallest. If *value ascending*, items are sorted by value from smallest to largest. Only applies when `hovermode` is *x unified* or *y unified*.",
3068+
"dflt": "trace",
3069+
"editType": "none",
3070+
"valType": "enumerated",
3071+
"values": [
3072+
"trace",
3073+
"value descending",
3074+
"value ascending"
3075+
]
3076+
},
30663077
"hoversubplots": {
30673078
"description": "Determines expansion of hover effects to other subplots If *single* just the axis pair of the primary point is included without overlaying subplots. If *overlaying* all subplots using the main axis and occupying the same space are included. If *axis*, also include stacked subplots using the same axis when `hovermode` is set to *x*, *x unified*, *y* or *y unified*.",
30683079
"dflt": "overlaying",
@@ -56775,11 +56786,17 @@
5677556786
}
5677656787
},
5677756788
"legendrank": {
56778-
"description": "Sets the legend rank for this trace. Items and groups with smaller ranks are presented on top/left side while with *reversed* `legend.traceorder` they are on bottom/right side. The default legendrank is 1000, so that you can use ranks less than 1000 to place certain items before all unranked items, and ranks greater than 1000 to go after all unranked items. When having unranked or equal rank items shapes would be displayed after traces i.e. according to their order in data and layout.",
56789+
"arrayOk": true,
56790+
"description": "Sets the legend rank for this pie. If passed as an array, this will set the legend rank of the individual pie slices. Items and groups with smaller ranks are presented on top/left side while with *reversed* `legend.traceorder` they are on bottom/right side. The default legendrank is 1000, so that you can use ranks less than 1000 to place certain items before all unranked items, and ranks greater than 1000 to go after all unranked items. When having unranked or equal rank items shapes would be displayed after traces i.e. according to their order in data and layout.",
5677956791
"dflt": 1000,
5678056792
"editType": "style",
5678156793
"valType": "number"
5678256794
},
56795+
"legendranksrc": {
56796+
"description": "Sets the source reference on Chart Studio Cloud for `legendrank`.",
56797+
"editType": "none",
56798+
"valType": "string"
56799+
},
5678356800
"legendsrc": {
5678456801
"description": "Sets the source reference on Chart Studio Cloud for `legend`.",
5678556802
"editType": "none",

commands.py

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,15 @@ def plotly_js_version():
4444
return version
4545

4646

47-
def install_js_deps(local):
48-
"""Install package.json dependencies using npm."""
47+
def install_js_deps(local, build=True):
48+
"""Install package.json dependencies using npm.
49+
50+
When ``build`` is True (the default), also runs ``npm run build`` to
51+
rebuild the JupyterLab extension and FigureWidget bundles and verifies
52+
that the widget bundle exists. Pass ``build=False`` when you only need
53+
to refresh ``node_modules`` / ``package-lock.json`` (e.g. after a
54+
plotly.js version bump) and don't need the bundles rebuilt.
55+
"""
4956

5057
npmName = "npm"
5158
if platform.system() == "Windows":
@@ -86,18 +93,20 @@ def install_js_deps(local):
8693
stdout=sys.stdout,
8794
stderr=sys.stderr,
8895
)
89-
check_call(
90-
[npmName, "run", "build"],
91-
cwd=NODE_ROOT,
92-
stdout=sys.stdout,
93-
stderr=sys.stderr,
94-
)
96+
if build:
97+
check_call(
98+
[npmName, "run", "build"],
99+
cwd=NODE_ROOT,
100+
stdout=sys.stdout,
101+
stderr=sys.stderr,
102+
)
95103
os.utime(NODE_MODULES, None)
96104

97-
for target in WIDGET_TARGETS:
98-
if not os.path.exists(target):
99-
msg = "Missing file: %s" % target
100-
raise ValueError(msg)
105+
if build:
106+
for target in WIDGET_TARGETS:
107+
if not os.path.exists(target):
108+
msg = "Missing file: %s" % target
109+
raise ValueError(msg)
101110

102111

103112
def overwrite_schema_local(uri):
@@ -215,6 +224,7 @@ def update_plotlyjs(plotly_js_version, outdir):
215224
update_bundle(plotly_js_version)
216225
update_schema(plotly_js_version)
217226
perform_codegen(outdir)
227+
install_js_deps(local=None, build=False)
218228

219229

220230
# FIXME: switch to argparse

js/package-lock.json

Lines changed: 4 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"dependencies": {
2121
"lodash-es": "^4.17.21",
22-
"plotly.js": "3.5.0",
22+
"plotly.js": "3.6.0",
2323
"@lumino/widgets": "~2.4.0"
2424
},
2525
"devDependencies": {

plotly/graph_objs/_figure.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12671,6 +12671,7 @@ def add_pie(
1267112671
legendgroup=None,
1267212672
legendgrouptitle=None,
1267312673
legendrank=None,
12674+
legendranksrc=None,
1267412675
legendsrc=None,
1267512676
legendwidth=None,
1267612677
marker=None,
@@ -12850,16 +12851,20 @@ def add_pie(
1285012851
:class:`plotly.graph_objects.pie.Legendgrouptitle`
1285112852
instance or dict with compatible properties
1285212853
legendrank
12853-
Sets the legend rank for this trace. Items and groups
12854-
with smaller ranks are presented on top/left side while
12855-
with "reversed" `legend.traceorder` they are on
12856-
bottom/right side. The default legendrank is 1000, so
12857-
that you can use ranks less than 1000 to place certain
12858-
items before all unranked items, and ranks greater than
12859-
1000 to go after all unranked items. When having
12860-
unranked or equal rank items shapes would be displayed
12861-
after traces i.e. according to their order in data and
12862-
layout.
12854+
Sets the legend rank for this pie. If passed as an
12855+
array, this will set the legend rank of the individual
12856+
pie slices. Items and groups with smaller ranks are
12857+
presented on top/left side while with "reversed"
12858+
`legend.traceorder` they are on bottom/right side. The
12859+
default legendrank is 1000, so that you can use ranks
12860+
less than 1000 to place certain items before all
12861+
unranked items, and ranks greater than 1000 to go after
12862+
all unranked items. When having unranked or equal rank
12863+
items shapes would be displayed after traces i.e.
12864+
according to their order in data and layout.
12865+
legendranksrc
12866+
Sets the source reference on Chart Studio Cloud for
12867+
`legendrank`.
1286312868
legendsrc
1286412869
Sets the source reference on Chart Studio Cloud for
1286512870
`legend`.
@@ -13052,6 +13057,7 @@ def add_pie(
1305213057
legendgroup=legendgroup,
1305313058
legendgrouptitle=legendgrouptitle,
1305413059
legendrank=legendrank,
13060+
legendranksrc=legendranksrc,
1305513061
legendsrc=legendsrc,
1305613062
legendwidth=legendwidth,
1305713063
marker=marker,

plotly/graph_objs/_figurewidget.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12673,6 +12673,7 @@ def add_pie(
1267312673
legendgroup=None,
1267412674
legendgrouptitle=None,
1267512675
legendrank=None,
12676+
legendranksrc=None,
1267612677
legendsrc=None,
1267712678
legendwidth=None,
1267812679
marker=None,
@@ -12852,16 +12853,20 @@ def add_pie(
1285212853
:class:`plotly.graph_objects.pie.Legendgrouptitle`
1285312854
instance or dict with compatible properties
1285412855
legendrank
12855-
Sets the legend rank for this trace. Items and groups
12856-
with smaller ranks are presented on top/left side while
12857-
with "reversed" `legend.traceorder` they are on
12858-
bottom/right side. The default legendrank is 1000, so
12859-
that you can use ranks less than 1000 to place certain
12860-
items before all unranked items, and ranks greater than
12861-
1000 to go after all unranked items. When having
12862-
unranked or equal rank items shapes would be displayed
12863-
after traces i.e. according to their order in data and
12864-
layout.
12856+
Sets the legend rank for this pie. If passed as an
12857+
array, this will set the legend rank of the individual
12858+
pie slices. Items and groups with smaller ranks are
12859+
presented on top/left side while with "reversed"
12860+
`legend.traceorder` they are on bottom/right side. The
12861+
default legendrank is 1000, so that you can use ranks
12862+
less than 1000 to place certain items before all
12863+
unranked items, and ranks greater than 1000 to go after
12864+
all unranked items. When having unranked or equal rank
12865+
items shapes would be displayed after traces i.e.
12866+
according to their order in data and layout.
12867+
legendranksrc
12868+
Sets the source reference on Chart Studio Cloud for
12869+
`legendrank`.
1286512870
legendsrc
1286612871
Sets the source reference on Chart Studio Cloud for
1286712872
`legend`.
@@ -13054,6 +13059,7 @@ def add_pie(
1305413059
legendgroup=legendgroup,
1305513060
legendgrouptitle=legendgrouptitle,
1305613061
legendrank=legendrank,
13062+
legendranksrc=legendranksrc,
1305713063
legendsrc=legendsrc,
1305813064
legendwidth=legendwidth,
1305913065
marker=marker,

0 commit comments

Comments
 (0)