8000 Refactor validators by bmaranville · Pull Request #5173 · plotly/plotly.py · GitHub
[go: up one dir, main page]

Skip to content

Refactor validators #5173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 82 commits into
base: release-6.1.0rc0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
8a787b5
Add deprecation notice for orca
LiamConnors Mar 25, 2025
9dd3330
Create static-image-generation-migration.md
LiamConnors Mar 25, 2025
97168bf
Add deprecation notice
LiamConnors Mar 25, 2025
ca80cdd
Add info on changes in Plotly.py 6.1
LiamConnors Mar 25, 2025
7c76ee3
Add draft of Kaleido updates
LiamConnors Mar 25, 2025
2e0b441
Add default settings info
LiamConnors Mar 27, 2025
577329d
Make small updates and add back Orca export settings
LiamConnors Mar 27, 2025
02b31f0
Update link
LiamConnors Mar 31, 2025
3281d99
Update static-image-export.md
LiamConnors Mar 31, 2025
2cbd63c
Update migration guide for Kaleido
LiamConnors Mar 31, 2025
9855b6a
remove orca section
LiamConnors Apr 1, 2025
28e7e19
Update static-image-export.md
LiamConnors Apr 1, 2025
e8149ae
Small updates
LiamConnors Apr 1, 2025
e45d56e
Merge branch 'main' into kaleido-docs-updates
LiamConnors Apr 1, 2025
0b79a17
Update static-image-generation-migration.md
LiamConnors Apr 1, 2025
f8cad81
Merge branch 'kaleido-docs-updates' of https://github.com/plotly/plot…
LiamConnors Apr 1, 2025
f5ac772
Update doc/python/static-image-export.md
LiamConnors Apr 2, 2025
10e8f20
Update doc/python/static-image-export.md
LiamConnors Apr 2, 2025
bbac70b
Update doc/python/static-image-export.md
LiamConnors Apr 2, 2025
9ad552e
Update doc/python/static-image-export.md
LiamConnors Apr 2, 2025
c290b5f
Update doc/python/static-image-export.md
LiamConnors Apr 2, 2025
7b8061b
Update static-image-generation-migration.md
LiamConnors Apr 3, 2025
07fd630
Merge branch 'kaleido-docs-updates' of https://github.com/plotly/plot…
LiamConnors Apr 3, 2025
6ba54f3
Update static-image-export.md
LiamConnors Apr 23, 2025
30cc778
Update doc/python/static-image-generation-migration.md
LiamConnors Apr 23, 2025
9b09504
Merge branch 'main' into kaleido-docs-updates
LiamConnors Apr 28, 2025
fded494
Merge branch 'kaleido-docs-updates' of https://github.com/plotly/plot…
LiamConnors Apr 29, 2025
077a356
Add note on browsers
LiamConnors Apr 29, 2025
2821776
Merge branch 'main' into kaleido-docs-updates
LiamConnors Apr 29, 2025
9f9262b
Update doc/python/static-image-generation-migration.md
LiamConnors Apr 30, 2025
551eaa6
update install commands
LiamConnors Apr 30, 2025
b9816bd
Merge branch 'kaleido-docs-updates' of https://github.com/plotly/plot…
LiamConnors Apr 30, 2025
8a8b052
Update doc/python/static-image-export.md
LiamConnors Apr 30, 2025
fc13f1d
Update doc/python/static-image-generation-migration.md
LiamConnors Apr 30, 2025
63229fc
Update doc/python/static-image-export.md
LiamConnors Apr 30, 2025
2eeac47
Update doc/python/static-image-export.md
LiamConnors Apr 30, 2025
b42185e
Update doc/python/static-image-generation-migration.md
LiamConnors Apr 30, 2025
e753b7b
Update doc/python/static-image-generation-migration.md
LiamConnors Apr 30, 2025
9fb73a1
Update doc/python/static-image-generation-migration.md
LiamConnors Apr 30, 2025
0284d5e
Update doc/python/static-image-export.md
LiamConnors Apr 30, 2025
ff62066
Update doc/python/static-image-export.md
LiamConnors Apr 30, 2025
41d72f0
Update doc/python/static-image-export.md
LiamConnors Apr 30, 2025
a27e2a9
Update static-image-export.md
LiamConnors May 1, 2025
8e62339
Update static-image-export.md
LiamConnors May 1, 2025
b8253c4
Update static-image-generation-migration.md
LiamConnors May 1, 2025
ba8ab39
Update static-image-export.md
LiamConnors May 1, 2025
2cc67f3
Update getting-started.md
LiamConnors May 1, 2025
9be1a49
Update static-image-generation-migration.md
LiamConnors May 1, 2025
70984fb
Update _kaleido.py
LiamConnors May 2, 2025
1965279
Merge pull request #5161 from plotly/release-6.1.0rc0
emilykl May 2, 2025
2f66bf1
Update plotly/io/_kaleido.py
LiamConnors May 6, 2025
815d975
Merge pull request #5164 from plotly/docstring-updates
LiamConnors May 6, 2025
d3ba372
Merge branch 'main' into kaleido-docs-updates
LiamConnors May 6, 2025
f70d8bf
Merge pull request #5111 from plotly/kaleido-docs-updates
LiamConnors May 7, 2025
5d29c69
removing old generated validators
bmaranville May 8, 2025
b359323
write single json instead of python files
bmaranville May 8, 2025
71be168
generate validator class instances from json data
bmaranville May 8, 2025
f3b546c
use validators from ValidatorCache
bmaranville May 8, 2025
646b4b6
use validators from ValidatorCache
bmaranville May 8, 2025
03100b4
use DataValidator from ValidatorCache
bmaranville May 8, 2025
0f6040b
trace validator should be instance not class of DataValidator
bmaranville May 8, 2025
2fb4670
use validators from ValidatorCache
bmaranville May 8, 2025
ae2ad4d
use template validator from ValidatorCache
bmaranville May 8, 2025
e92cf30
allow overlaying args on derived classes
bmaranville May 8, 2025
b46cb01
add DataValidator to autogenerated instances provided by ValidatorCac…
bmaranville May 8, 2025
9f20fd9
add DataValidator to autogenerated instances provided by ValidatorCac…
bmaranville May 8, 2025
c4df7e3
add DataValidator to autogenerated instances provided by ValidatorCac…
bmaranville May 8, 2025
bc2118a
use a copy of the DataValidator in BaseFigure, with local set_uid att…
bmaranville May 8, 2025
09e0140
Merge branch 'plotly:main' into refactor-validators
bmaranville May 8, 2025
d48cbe1
update validator params store
bmaranville May 8, 2025
d3c5f92
removing _data.py in validators, DataValidator is generated from Base…
bmaranville May 8, 2025
2f26c48
Merge branch 'refactor-validators' of github.com:bmaranville/plotly.p…
bmaranville May 8, 2025
00a8d1d
DataValidator is an instance already, and is not callable
bmaranville May 8, 2025
5607de0
use heatmap colorscale validator
bmaranville May 8, 2025
a23e0b7
update documentation example to use validator from ValidatorCache
bmaranville May 8, 2025
1b72556
cleanup
bmaranville May 9, 2025
689fa16
black formatting
bmaranville May 9, 2025
d893537
black formatting
bmaranville May 9, 2025
9e033b6
revert this file - it is auto-generated
bmaranville May 9, 2025
809ccc4
cleanup
bmaranville May 9, 2025
c191427
use ValidatorCache for generated Layout validators
bmaranville May 9, 2025
c301c4a
black formatting
bmaranville May 9, 2025
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
34 changes: 5 additions & 29 deletions doc/python/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.16.1
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand All @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.10.14
version: 3.11.10
plotly:
description: Getting Started with Plotly for Python.
has_thumbnail: false
Expand All @@ -41,7 +41,7 @@ The [`plotly` Python library](/python/) is an interactive, [open-source](/python

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.

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).
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).

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:

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

plotly.py supports [static image export](https://plotly.com/python/static-image-export/),
using the either the [`kaleido`](https://github.com/plotly/Kaleido)
package (recommended, supported as of `plotly` version 4.9) or the [orca](https://github.com/plotly/orca)
command line utility (legacy as of `plotly` version 4.9).
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.)

#### Kaleido

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

```
$ pip install -U kaleido
$ pip install --upgrade kaleido
```

or conda.
Expand All @@ -202,28 +200,6 @@ or conda.
$ conda install -c plotly python-kaleido
```

#### Orca

While Kaleido is now the recommended image export approach because it is easier to install
and more widely compatible, [static image export](https://plotly.com/python/static-image-export/)
can also be supported
by the legacy [orca](https://github.com/plotly/orca) command line utility and the
[`psutil`](https://github.com/giampaolo/psutil) Python package.

These dependencies can both be installed using conda:

```
conda install -c plotly plotly-orca==1.3.1 psutil
```

Or, `psutil` can be installed using pip...

```
pip install psutil
```

and orca can be installed according to the instructions in the [orca README](https://github.com/plotly/orca).

#### Extended Geo Support

Some plotly.py features rely on fairly large geographic shape files. The county
Expand Down
26 changes: 13 additions & 13 deletions doc/python/orca-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ jupyter:
text_representation:
extension: .md
format_name: markdown
format_version: '1.1'
jupytext_version: 1.1.6
format_version: '1.3'
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3
display_name: Python 3 (ipykernel)
language: python
name: python3
language_info:
Expand All @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.7.3
version: 3.11.10
plotly:
description: This section covers the low-level details of how plotly.py uses orca
to perform static image generation.
Expand All @@ -33,11 +33,11 @@ jupyter:
thumbnail: thumbnail/orca-management.png
---

> 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.

### Overview
This section covers the lower-level details of how plotly.py can use orca to perform static image generation.

> 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 .

Please refer to the [Static Image Export](/python/static-image-export/) section for general information on creating static images from plotly.py figures.

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

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

**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.

##### npm + pip
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`:

```
<!-- #raw -->
$ npm install -g electron@1.8.4 orca
$ pip install psutil requests
```
<!-- #endraw -->

##### Standalone Binaries + pip
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`.

```
<!-- #raw -->
$ pip install psutil requests
```
<!-- #endraw -->

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


### Saving Configuration Settings
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.
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.
Loading
0