Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,21 @@ python commands.py updateplotlyjs

This downloads new versions of `plot-schema.json` and `plotly.min.js` from the `plotly/plotly.js` GitHub repository
and places them in `plotly/package_data`.
It then regenerates all of the `graph_objs` classes based on the new schema.
It then regenerates all of the `graph_objs` classes based on the new schema,
and finally runs `npm install` in `js/` to refresh `js/package-lock.json` against the new `plotly.js`.
Commit the updated `js/package-lock.json` along with the regenerated files.

The JupyterLab extension and FigureWidget bundles in `plotly/labextension` and `plotly/package_data/widgetbundle.js`
are rebuilt as part of the release flow (see [RELEASE.md](RELEASE.md)) rather than on every plotly.js bump.

If you need to skip the `npm install` step entirely (e.g. `npm` isn't available),
set the `SKIP_NPM=1` environment variable:

```bash
SKIP_NPM=1 python commands.py updateplotlyjs
```

If you do skip it, you'll need to run `npm install` in `js/` yourself before committing so the lockfile stays in sync.

### Using a Development Branch of Plotly.js

Expand Down Expand Up @@ -319,6 +333,6 @@ Usage: `python commands.py <subcommand> <args>`
| `codegen [--noformat]` | Regenerate Python files according to `plot-schema.json`.`--noformat` skips formatter step. |
| `lint` | Lint all Python code in `plotly/`. |
| `format` | Format all Python code in `plotly/`. |
| `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. |
| `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. |
| `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. |
| `bumpversion X.Y.Z` | Update the plotly.py version number to X.Y.Z across all files where it needs to be updated. |
19 changes: 18 additions & 1 deletion codegen/resources/plot-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3063,6 +3063,17 @@
"y unified"
]
},
"hoversort": {
"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*.",
"dflt": "trace",
"editType": "none",
"valType": "enumerated",
"values": [
"trace",
"value descending",
"value ascending"
]
},
"hoversubplots": {
"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*.",
"dflt": "overlaying",
Expand Down Expand Up @@ -56775,11 +56786,17 @@
}
},
"legendrank": {
"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.",
"arrayOk": true,
"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.",
"dflt": 1000,
"editType": "style",
"valType": "number"
},
"legendranksrc": {
"description": "Sets the source reference on Chart Studio Cloud for `legendrank`.",
"editType": "none",
"valType": "string"
},
"legendsrc": {
"description": "Sets the source reference on Chart Studio Cloud for `legend`.",
"editType": "none",
Expand Down
34 changes: 22 additions & 12 deletions commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,15 @@ def plotly_js_version():
return version


def install_js_deps(local):
"""Install package.json dependencies using npm."""
def install_js_deps(local, build=True):
"""Install package.json dependencies using npm.

When ``build`` is True (the default), also runs ``npm run build`` to
rebuild the JupyterLab extension and FigureWidget bundles and verifies
that the widget bundle exists. Pass ``build=False`` when you only need
to refresh ``node_modules`` / ``package-lock.json`` (e.g. after a
plotly.js version bump) and don't need the bundles rebuilt.
"""

npmName = "npm"
if platform.system() == "Windows":
Expand Down Expand Up @@ -86,18 +93,20 @@ def install_js_deps(local):
stdout=sys.stdout,
stderr=sys.stderr,
)
check_call(
[npmName, "run", "build"],
cwd=NODE_ROOT,
stdout=sys.stdout,
stderr=sys.stderr,
)
if build:
check_call(
[npmName, "run", "build"],
cwd=NODE_ROOT,
stdout=sys.stdout,
stderr=sys.stderr,
)
os.utime(NODE_MODULES, None)

for target in WIDGET_TARGETS:
if not os.path.exists(target):
msg = "Missing file: %s" % target
raise ValueError(msg)
if build:
for target in WIDGET_TARGETS:
if not os.path.exists(target):
msg = "Missing file: %s" % target
raise ValueError(msg)


def overwrite_schema_local(uri):
Expand Down Expand Up @@ -215,6 +224,7 @@ def update_plotlyjs(plotly_js_version, outdir):
update_bundle(plotly_js_version)
update_schema(plotly_js_version)
perform_codegen(outdir)
install_js_deps(local=None, build=False)


# FIXME: switch to argparse
Expand Down
66 changes: 4 additions & 62 deletions js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"lodash-es": "^4.17.21",
"plotly.js": "3.5.0",
"plotly.js": "3.6.0",
"@lumino/widgets": "~2.4.0"
},
"devDependencies": {
Expand Down
26 changes: 16 additions & 10 deletions plotly/graph_objs/_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -12671,6 +12671,7 @@ def add_pie(
legendgroup=None,
legendgrouptitle=None,
legendrank=None,
legendranksrc=None,
legendsrc=None,
legendwidth=None,
marker=None,
Expand Down Expand Up @@ -12850,16 +12851,20 @@ def add_pie(
:class:`plotly.graph_objects.pie.Legendgrouptitle`
instance or dict with compatible properties
legendrank
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.
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.
legendranksrc
Sets the source reference on Chart Studio Cloud for
`legendrank`.
legendsrc
Sets the source reference on Chart Studio Cloud for
`legend`.
Expand Down Expand Up @@ -13052,6 +13057,7 @@ def add_pie(
legendgroup=legendgroup,
legendgrouptitle=legendgrouptitle,
legendrank=legendrank,
legendranksrc=legendranksrc,
legendsrc=legendsrc,
legendwidth=legendwidth,
marker=marker,
Expand Down
26 changes: 16 additions & 10 deletions plotly/graph_objs/_figurewidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -12673,6 +12673,7 @@ def add_pie(
legendgroup=None,
legendgrouptitle=None,
legendrank=None,
legendranksrc=None,
legendsrc=None,
legendwidth=None,
marker=None,
Expand Down Expand Up @@ -12852,16 +12853,20 @@ def add_pie(
:class:`plotly.graph_objects.pie.Legendgrouptitle`
instance or dict with compatible properties
legendrank
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.
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.
legendranksrc
Sets the source reference on Chart Studio Cloud for
`legendrank`.
legendsrc
Sets the source reference on Chart Studio Cloud for
`legend`.
Expand Down Expand Up @@ -13054,6 +13059,7 @@ def add_pie(
legendgroup=legendgroup,
legendgrouptitle=legendgrouptitle,
legendrank=legendrank,
legendranksrc=legendranksrc,
legendsrc=legendsrc,
legendwidth=legendwidth,
marker=marker,
Expand Down
Loading