Skip to content

Commit d1da3e6

Browse files
authored
Merge branch 'main' into add-sri-hash-to-cdn
2 parents 3185ed3 + 945c000 commit d1da3e6

File tree

1,485 files changed

+41190
-20706
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,485 files changed

+41190
-20706
lines changed

.circleci/config.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ commands:
5858
source .venv/bin/activate
5959
uv pip install .
6060
uv pip install -r ./test_requirements/requirements_optional.txt
61-
61+
6262
- when:
63-
condition:
63+
condition:
6464
not:
6565
equal:
6666
- <<parameters.pandas_version>>
@@ -347,6 +347,8 @@ jobs:
347347
name: Install dependencies
348348
command: |
349349
cd doc
350+
sudo apt-get update
351+
sudo apt-get install rename
350352
curl -LsSf https://astral.sh/uv/install.sh | sh
351353
uv venv
352354
source .venv/bin/activate

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@ doc/check-or-enforce-order.py
6262

6363
tests/percy/*.html
6464
tests/percy/pandas2/*.html
65+
test_path.png

CHANGELOG.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5-
## [6.1.0rc0] - 2025-05-01
5+
## [6.1.2] - 2025-05-27
6+
7+
### Fixed
8+
- Fix type checking and code highlighting for `graph_objects` classes [[#5199](https://github.com/plotly/plotly.py/pull/5199)]
9+
10+
11+
## [6.1.1] - 2025-05-20
12+
13+
### Fixed
14+
- Prevent swallowing of `ValueError` when creating a figure with subplots [[#3888](https://github.com/plotly/plotly.py/pull/3888)]
15+
- Fix issue causing `fig.write_image()` to not generate an image [[#5193](https://github.com/plotly/plotly.py/pull/5193)]
16+
17+
## [6.1.0] - 2025-05-15
618

719
### Updated
8-
- Add support for Kaleido>=v1.0.0 for image generation, and deprecate support for Kaleido<1 and Orca [[#5062](https://github.com/plotly/plotly.py/pull/5062)]
20+
- Add support for Kaleido>=v1.0.0 for image generation [[#5062](https://github.com/plotly/plotly.py/pull/5062), [#5177](https://github.com/plotly/plotly.py/pull/5177)]
921
- Reduce package bundle size by 18-24% via changes to code generation [[#4978](https://github.com/plotly/plotly.py/pull/4978)]
1022

1123
### Added

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ See the [Python documentation](https://plotly.com/python/) for more examples.
5555

5656
Built on top of [plotly.js](https://github.com/plotly/plotly.js), `plotly.py` is a high-level, declarative charting library. plotly.js ships with over 30 chart types, including scientific charts, 3D graphs, statistical charts, SVG maps, financial charts, and more.
5757

58-
`plotly.py` is [MIT Licensed](https://github.com/plotly/plotly.py/blob/main/LICENSE.txt). Plotly graphs can be viewed in Jupyter notebooks, standalone HTML files, or integrated into [Dash applications](https://dash.plotly.com/).
58+
`plotly.py` is [MIT Licensed](https://github.com/plotly/plotly.py/blob/main/LICENSE.txt). Plotly graphs can be viewed in [Jupyter notebooks](https://jupyter.org), other Python notebook software such as [marimo](https://marimo.io), as standalone HTML files, or integrated into [Dash applications](https://dash.plotly.com/).
5959

6060
[Contact us](https://plotly.com/consulting-and-oem/) for consulting, dashboard development, application integration, and feature additions.
6161

codegen/__init__.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -271,24 +271,36 @@ def perform_codegen(reformat=True):
271271
root_datatype_imports.append(f"._deprecations.{dep_clas}")
272272

273273
optional_figure_widget_import = f"""
274-
__all__.append("FigureWidget")
275-
orig_getattr = __getattr__
276-
def __getattr__(import_name):
277-
if import_name == "FigureWidget":
278-
try:
279-
import ipywidgets
280-
from packaging.version import Version
281-
282-
if Version(ipywidgets.__version__) >= Version("7.0.0"):
283-
from ..graph_objs._figurewidget import FigureWidget
274+
if sys.version_info < (3, 7) or TYPE_CHECKING:
275+
try:
276+
import ipywidgets as _ipywidgets
277+
from packaging.version import Version as _Version
278+
if _Version(_ipywidgets.__version__) >= _Version("7.0.0"):
279+
from ..graph_objs._figurewidget import FigureWidget
280+
else:
281+
raise ImportError()
282+
except Exception:
283+
from ..missing_anywidget import FigureWidget
284+
else:
285+
__all__.append("FigureWidget")
286+
orig_getattr = __getattr__
287+
def __getattr__(import_name):
288+
if import_name == "FigureWidget":
289+
try:
290+
import ipywidgets
291+
from packaging.version import Version
292+
if Version(ipywidgets.__version__) >= Version("7.0.0"):
293+
from ..graph_objs._figurewidget import FigureWidget
294+
return FigureWidget
295+
else:
296+
raise ImportError()
297+
except Exception:
298+
from ..missing_anywidget import FigureWidget
284299
return FigureWidget
285300
else:
286301
raise ImportError()
287-
except Exception:
288-
from ..missing_anywidget import FigureWidget
289-
return FigureWidget
290302
291-
return orig_getattr(import_name)
303+
return orig_getattr(import_name)
292304
"""
293305
# ### __all__ ###
294306
for path_parts, class_names in alls.items():

codegen/utils.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,16 @@ def build_from_imports_py(rel_modules=(), rel_classes=(), init_extra=""):
8282

8383
result = f"""\
8484
import sys
85-
from _plotly_utils.importers import relative_import
86-
__all__, __getattr__, __dir__ = relative_import(
87-
__name__,
88-
{repr(rel_modules)},
89-
{repr(rel_classes)}
90-
)
85+
from typing import TYPE_CHECKING
86+
if TYPE_CHECKING:
87+
{imports_str}
88+
else:
89+
from _plotly_utils.importers import relative_import
90+
__all__, __getattr__, __dir__ = relative_import(
91+
__name__,
92+
{repr(rel_modules)},
93+
{repr(rel_classes)}
94+
)
9195
9296
{init_extra}
9397
"""

doc/python/bar-charts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ import plotly.express as px
124124
df = px.data.gapminder().query("continent == 'Oceania'")
125125
fig = px.bar(df, x='year', y='pop',
126126
hover_data=['lifeExp', 'gdpPercap'], color='country',
127-
labels={'pop':'population of Canada'}, height=400)
127+
labels={'pop':'population of Oceania'}, height=400)
128128
fig.show()
129129
```
130130

doc/python/getting-started.md

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.16.1
9+
jupytext_version: 1.16.4
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.10.14
23+
version: 3.11.10
2424
plotly:
2525
description: Getting Started with Plotly for Python.
2626
has_thumbnail: false
@@ -41,7 +41,7 @@ The [`plotly` Python library](/python/) is an interactive, [open-source](/python
4141

4242
Built on top of the Plotly JavaScript library ([plotly.js](https://plotly.com/javascript/)), `plotly` enables Python users to create beautiful interactive web-based visualizations that can be displayed in Jupyter notebooks, saved to standalone HTML files, or served as part of pure Python-built web applications using Dash. The `plotly` Python library is sometimes referred to as "plotly.py" to differentiate it from the JavaScript library.
4343

44-
Thanks to deep integration with our [Kaleido](https://medium.com/plotly/introducing-kaleido-b03c4b7b1d81) image export utility, `plotly` also provides great support for non-web contexts including desktop editors (e.g. QtConsole, Spyder, PyCharm) and static document publishing (e.g. exporting notebooks to PDF with high-quality vector images).
44+
Thanks to deep integration with our [Kaleido](https://github.com/plotly/Kaleido) image export utility, `plotly` also provides great support for non-web contexts including desktop editors (e.g. QtConsole, Spyder, PyCharm) and static document publishing (e.g. exporting notebooks to PDF with high-quality vector images).
4545

4646
This Getting Started guide explains how to install `plotly` and related optional pages. Once you've installed, you can use our documentation in three main ways:
4747

@@ -183,17 +183,15 @@ See [_Displaying Figures in Python_](/python/renderers/) for more information on
183183
### Static Image Export
184184

185185
plotly.py supports [static image export](https://plotly.com/python/static-image-export/),
186-
using the either the [`kaleido`](https://github.com/plotly/Kaleido)
187-
package (recommended, supported as of `plotly` version 4.9) or the [orca](https://github.com/plotly/orca)
188-
command line utility (legacy as of `plotly` version 4.9).
186+
using the [`kaleido`](https://github.com/plotly/Kaleido) package. (Support for the legacy [`orca`](https://github.com/plotly/orca) image export utility is deprecated and will be removed after September 2025.)
189187

190188
#### Kaleido
191189

192190
The [`kaleido`](https://github.com/plotly/Kaleido) package has no dependencies and can be installed
193191
using pip...
194192

195193
```
196-
$ pip install -U kaleido
194+
$ pip install --upgrade kaleido
197195
```
198196

199197
or conda.
@@ -202,28 +200,6 @@ or conda.
202200
$ conda install -c plotly python-kaleido
203201
```
204202

205-
#### Orca
206-
207-
While Kaleido is now the recommended image export approach because it is easier to install
208-
and more widely compatible, [static image export](https://plotly.com/python/static-image-export/)
209-
can also be supported
210-
by the legacy [orca](https://github.com/plotly/orca) command line utility and the
211-
[`psutil`](https://github.com/giampaolo/psutil) Python package.
212-
213-
These dependencies can both be installed using conda:
214-
215-
```
216-
conda install -c plotly plotly-orca==1.3.1 psutil
217-
```
218-
219-
Or, `psutil` can be installed using pip...
220-
221-
```
222-
pip install psutil
223-
```
224-
225-
and orca can be installed according to the instructions in the [orca README](https://github.com/plotly/orca).
226-
227203
#### Extended Geo Support
228204

229205
Some plotly.py features rely on fairly large geographic shape files. The county

doc/python/orca-management.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
9-
jupytext_version: 1.1.6
8+
format_version: '1.3'
9+
jupytext_version: 1.16.4
1010
kernelspec:
11-
display_name: Python 3
11+
display_name: Python 3 (ipykernel)
1212
language: python
1313
name: python3
1414
language_info:
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.3
23+
version: 3.11.10
2424
plotly:
2525
description: This section covers the low-level details of how plotly.py uses orca
2626
to perform static image generation.
@@ -33,11 +33,11 @@ jupyter:
3333
thumbnail: thumbnail/orca-management.png
3434
---
3535

36+
> Orca support in Plotly.py is deprecated and will be removed after September 2025. See the [Static Image Export page](/python/static-image-export/) for details on using Kaleido for static image generation.
37+
3638
### Overview
3739
This section covers the lower-level details of how plotly.py can use orca to perform static image generation.
3840

39-
> As of `plotly` version 4.9, Orca is no longer the recommended way to do static image export. We now recommend Kaleido, as described in the [Static Image Export](/python/static-image-export/) section .
40-
4141
Please refer to the [Static Image Export](/python/static-image-export/) section for general information on creating static images from plotly.py figures.
4242

4343
### What is orca?
@@ -50,26 +50,26 @@ There are 3 general approaches to installing orca and its Python dependencies.
5050

5151
##### conda
5252
Using the [conda](https://conda.io/docs/) package manager, you can install these dependencies in a single command:
53-
```
53+
<!-- #raw -->
5454
$ conda install -c plotly plotly-orca==1.2.1 psutil requests
55-
```
55+
<!-- #endraw -->
5656

5757
**Note:** Even if you do not want to use conda to manage your Python dependencies, it is still useful as a cross platform tool for managing native libraries and command-line utilities (e.g. git, wget, graphviz, boost, gcc, nodejs, cairo, etc.). For this use-case, start with [Miniconda](https://conda.io/miniconda.html) (~60MB) and tell the installer to add itself to your system `PATH`. Then run `conda install plotly-orca==1.2.1` and the orca executable will be available system wide.
5858

5959
##### npm + pip
6060
You can use the [npm](https://www.npmjs.com/get-npm) package manager to install `orca` (and its `electron` dependency), and then use pip to install `psutil`:
6161

62-
```
62+
<!-- #raw -->
6363
$ npm install -g [email protected] orca
6464
$ pip install psutil requests
65-
```
65+
<!-- #endraw -->
6666

6767
##### Standalone Binaries + pip
6868
If you are unable to install conda or npm, you can install orca as a precompiled binary for your operating system. Follow the instructions in the orca [README](https://github.com/plotly/orca) to install orca and add it to your system `PATH`. Then use pip to install `psutil`.
6969

70-
```
70+
<!-- #raw -->
7171
$ pip install psutil requests
72-
```
72+
<!-- #endraw -->
7373

7474
<!-- #region -->
7575
### Install orca on Google Colab
@@ -263,4 +263,4 @@ In addition to the `executable` property, the `plotly.io.orca.config` object can
263263

264264

265265
### Saving Configuration Settings
266-
Configuration options can optionally be saved to the `~/.plotly/` directory by calling the `plotly.io.config.save()` method. Saved setting will be automatically loaded at the start of future sessions.
266+
Configuration options can optionally be saved to the `~/.plotly/` directory by calling the `plotly.io.config.save()` method. Saved setting will be automatically loaded at the start of future sessions.

0 commit comments

Comments
 (0)