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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

## [6.5.0] - 2025-11-17

### Updated
- Update plotly.js from version 3.2.0 to version 3.3.0. See the plotly.js [release notes](https://github.com/plotly/plotly.js/releases/tag/v3.3.0) for more information. [[#5421](https://github.com/plotly/plotly.py/pull/5421)]. Notable changes include:
- Add `hovertemplate` for `candlestick` and `ohlc` traces [[#7619](https://github.com/plotly/plotly.js/pull/7619)]

### Fixed
- Fix bug where numpy datetime contained in Python list was converted to integer [[#5415](https://github.com/plotly/plotly.py/pull/5415)]

## [6.4.0] - 2025-11-02

### Updated
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors:
- family-names: "Parmer"
given-names: "Chris"
title: "An interactive, open-source, and browser-based graphing library for Python"
version: 6.4.0
version: 6.5.0
doi: 10.5281/zenodo.14503524
date-released: 2025-11-02
date-released: 2025-11-17
url: "https://github.com/plotly/plotly.py"
18 changes: 16 additions & 2 deletions _plotly_utils/basevalidators.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ def fullmatch(regex, string, flags=0):
return re.match("(?:" + regex_string + r")\Z", string, flags=flags)


def to_non_numpy_type(np, v):
"""
Convert a numpy scalar value to a native Python type.
Calling .item() on a datetime64[ns] value returns an integer, since
Python datetimes only support microsecond precision. So we cast
datetime64[ns] to datetime64[us] to ensure it remains a datetime.

Should only be used in contexts where we already know `np` is defined.
"""
if hasattr(v, "dtype") and v.dtype == np.dtype("datetime64[ns]"):
return v.astype("datetime64[us]").item()
return v.item()


# Utility functions
# -----------------
def to_scalar_or_list(v):
Expand All @@ -35,12 +49,12 @@ def to_scalar_or_list(v):
np = get_module("numpy", should_load=False)
pd = get_module("pandas", should_load=False)
if np and np.isscalar(v) and hasattr(v, "item"):
return v.item()
return to_non_numpy_type(np, v)
if isinstance(v, (list, tuple)):
return [to_scalar_or_list(e) for e in v]
elif np and isinstance(v, np.ndarray):
if v.ndim == 0:
return v.item()
return to_non_numpy_type(np, v)
return [to_scalar_or_list(e) for e in v]
elif pd and isinstance(v, (pd.Series, pd.Index)):
return [to_scalar_or_list(e) for e in v]
Expand Down
40 changes: 38 additions & 2 deletions codegen/resources/plot-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -22186,12 +22186,30 @@
"valType": "boolean"
},
"split": {
"description": "Show hover information (open, close, high, low) in separate labels.",
"description": "Show hover information (open, close, high, low) in separate labels, rather than a single unified label. Default: *false*. When set to *true*, `hovertemplate` is ignored.",
"dflt": false,
"editType": "style",
"valType": "boolean"
}
},
"hovertemplate": {
"arrayOk": true,
"description": "Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, *xother* will be added to those with different x positions from the first point. An underscore before or after *(x|y)other* will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example \"Price: %{y:$.2f}\". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example \"Day: %{2019-01-01|%A}\". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. Variables that can't be found will be replaced with the specifier. For example, a template of \"data: %{x}, %{y}\" will result in a value of \"data: 1, %{y}\" if x is 1 and y is missing. Variables with an undefined value will be replaced with the fallback value. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, all attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. Finally, the template string has access to variables `open`, `high`, `low` and `close`. Anything contained in tag `<extra>` is displayed in the secondary box, for example `<extra>%{fullData.name}</extra>`. To hide the secondary box completely, use an empty tag `<extra></extra>`.",
"dflt": "",
"editType": "none",
"valType": "string"
},
"hovertemplatefallback": {
"description": "Fallback string that's displayed when a variable referenced in a template is missing. If the boolean value 'false' is passed in, the specifier with the missing variable will be displayed.",
"dflt": "-",
"editType": "none",
"valType": "any"
},
"hovertemplatesrc": {
"description": "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
"editType": "none",
"valType": "string"
},
"hovertext": {
"arrayOk": true,
"description": "Same as `text`.",
Expand Down Expand Up @@ -52888,12 +52906,30 @@
"valType": "boolean"
},
"split": {
"description": "Show hover information (open, close, high, low) in separate labels.",
"description": "Show hover information (open, close, high, low) in separate labels, rather than a single unified label. Default: *false*. When set to *true*, `hovertemplate` is ignored.",
"dflt": false,
"editType": "style",
"valType": "boolean"
}
},
"hovertemplate": {
"arrayOk": true,
"description": "Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, *xother* will be added to those with different x positions from the first point. An underscore before or after *(x|y)other* will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example \"Price: %{y:$.2f}\". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example \"Day: %{2019-01-01|%A}\". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. Variables that can't be found will be replaced with the specifier. For example, a template of \"data: %{x}, %{y}\" will result in a value of \"data: 1, %{y}\" if x is 1 and y is missing. Variables with an undefined value will be replaced with the fallback value. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, all attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. Finally, the template string has access to variables `open`, `high`, `low` and `close`. Anything contained in tag `<extra>` is displayed in the secondary box, for example `<extra>%{fullData.name}</extra>`. To hide the secondary box completely, use an empty tag `<extra></extra>`.",
"dflt": "",
"editType": "none",
"valType": "string"
},
"hovertemplatefallback": {
"description": "Fallback string that's displayed when a variable referenced in a template is missing. If the boolean value 'false' is passed in, the specifier with the missing variable will be displayed.",
"dflt": "-",
"editType": "none",
"valType": "any"
},
"hovertemplatesrc": {
"description": "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
"editType": "none",
"valType": "string"
},
"hovertext": {
"arrayOk": true,
"description": "Same as `text`.",
Expand Down
2 changes: 1 addition & 1 deletion doc/apidoc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# The short X.Y version
version = ""
# The full version, including alpha/beta/rc tags
release = "6.4.0"
release = "6.5.0"


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plotly==6.4.0
plotly==6.5.0
anywidget
cufflinks==0.17.3
dash-bio
Expand Down
Loading