Skip to content

Commit 72dad4d

Browse files
authored
Merge branch 'master' into patch-1
2 parents 660efec + 93fcdb2 commit 72dad4d

File tree

14,683 files changed

+322803
-59304
lines changed

Some content is hidden

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

14,683 files changed

+322803
-59304
lines changed

.circleci/config.yml

+305-94
Large diffs are not rendered by default.

.flake8

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 88

.github/ISSUE_TEMPLATE.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
Thanks for your interest in plotly.py!!
1+
Thanks for your interest in Plotly.py!
22

3-
Before opening an issue, please search for existing and closed issues. If your problem or idea is not addressed yet, [please open a new issue](https://github.com/plotly/plotly.py/issues/new).
3+
Before opening an issue, please search for existing and closed issues :)
44

5-
Bug reports **must** be accompanied with a reproducible example. Please use the [latest version](https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md) of plotly.py in your report unless not applicable and specify if you're plotting [online](https://plot.ly/python/getting-started/#initialization-for-online-plotting) or [offline](https://plot.ly/python/getting-started/#initialization-for-offline-plotting).
5+
**Please** accompany bug reports with a reproducible example. Please use the [latest version](https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md) of plotly.py in your report unless not applicable.
66

7-
Note that GitHub issues are reserved for bug reports and feature requests only. Implementation questions should be asked on community.plot.ly (tagged [`python`](https://community.plot.ly/c/api/python)) or on Stack Overflow (tagged [`plotly`](https://stackoverflow.com/questions/tagged/plotly)).
8-
9-
Comments on GitHub issues or pull requests should add content to the discussions. Approbation comments such as *+1* or *I would like this feature to be implemented as well* will be deleted by the maintainers. Please use [GitHub reactions](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) instead.
7+
Note that GitHub Issues are meant to be used for bug reports and feature requests only. Implementation or usage questions should be asked on [community.plotly.com](https://community.plotly.com/c/graphing-libraries/python/10) or on Stack Overflow (tagged [`plotly`](https://stackoverflow.com/questions/tagged/plotly)).

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
0
2+
0.html
3+
iframe_figures/
4+
packages/python/plotly/plotly/tests/test_orca/images/linux/failed/
5+
16
*.egg-info
27

38
*.pyc
@@ -6,6 +11,8 @@
611

712
*~
813

14+
doc/python/raw.githubusercontent.com/
15+
916
# Don't ignore dataset files
1017
!*.csv.gz
1118

@@ -52,3 +59,6 @@ doc/check-or-enforce-order.py
5259
packages/javascript/jupyterlab-plotly/lib/
5360
packages/python/plotly/jupyterlab_plotly/labextension/
5461
packages/python/plotly/jupyterlab_plotly/nbextension/index.js*
62+
63+
test/percy/*.html
64+
test/percy/pandas2/*.html

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
2-
- repo: https://github.com/ambv/black
3-
rev: 19.10b0
2+
- repo: https://github.com/ambv/black
3+
rev: 22.3.0
44
hooks:
5-
- id: black
6-
language_version: python
5+
- id: black
6+
language_version: python

CHANGELOG.md

+325
Large diffs are not rendered by default.

README.md

+31-46
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<tr>
1212
<td>User forum</td>
1313
<td>
14-
<a href="https://community.plot.ly"/>
14+
<a href="https://community.plotly.com/"/>
1515
<img src="https://img.shields.io/badge/help_forum-discourse-blue.svg"/>
1616
</td>
1717
</tr>
@@ -31,53 +31,52 @@
3131
</tr>
3232
</table>
3333

34-
## Data Science Workspaces
34+
<div align="center">
35+
<a href="https://dash.plotly.com/project-maintenance">
36+
<img src="https://dash.plotly.com/assets/images/maintained-by-plotly.png" width="400px" alt="Maintained by Plotly">
37+
</a>
38+
</div>
3539

36-
Our recommended IDE for Plotly’s Python graphing library is Dash Enterprise’s [Data Science Workspaces](https://plotly.com/dash/workspaces/), which has both Jupyter notebook and Python code file support.
3740

3841
## Quickstart
3942

40-
`pip install plotly==5.2.2`
43+
`pip install plotly==5.23.0`
4144

4245
Inside [Jupyter](https://jupyter.org/install) (installable with `pip install "jupyterlab>=3" "ipywidgets>=7.6"`):
4346

4447
```python
45-
import plotly.graph_objects as go
46-
fig = go.Figure()
47-
fig.add_trace(go.Scatter(y=[2, 1, 4, 3]))
48-
fig.add_trace(go.Bar(y=[1, 4, 3, 2]))
49-
fig.update_layout(title = 'Hello Figure')
48+
import plotly.express as px
49+
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
5050
fig.show()
5151
```
5252

53-
See the [Python documentation](https://plot.ly/python/) for more examples.
53+
See the [Python documentation](https://plotly.com/python/) for more examples.
5454

55-
Read about what's new in [plotly.py v4](https://medium.com/plotly/plotly-py-4-0-is-here-offline-only-express-first-displayable-anywhere-fc444e5659ee)
5655

5756
## Overview
5857

59-
[plotly.py](https://plot.ly/python) is an interactive, open-source, and browser-based graphing library for Python :sparkles:
58+
[plotly.py](https://plotly.com/python/) is an interactive, open-source, and browser-based graphing library for Python :sparkles:
6059

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

63-
`plotly.py` is [MIT Licensed](packages/python/chart-studio/LICENSE.txt). Plotly graphs can be viewed in Jupyter notebooks, standalone HTML files, or hosted online using [Chart Studio Cloud](https://chart-studio.plot.ly/feed/).
62+
`plotly.py` is [MIT Licensed](https://github.com/plotly/plotly.py/blob/master/LICENSE.txt). Plotly graphs can be viewed in Jupyter notebooks, standalone HTML files, or integrated into [Dash applications](https://dash.plotly.com/).
6463

65-
[Contact us](https://plot.ly/products/consulting-and-oem/) for consulting, dashboard development, application integration, and feature additions.
64+
[Contact us](https://plotly.com/consulting-and-oem/) for consulting, dashboard development, application integration, and feature additions.
6665

6766
<p align="center">
68-
<a href="https://plot.ly/python" target="_blank">
67+
<a href="https://plotly.com/python/" target="_blank">
6968
<img src="https://raw.githubusercontent.com/cldougl/plot_images/add_r_img/plotly_2017.png">
7069
</a></p>
7170

7271
---
7372

74-
- [Online Documentation](https://plot.ly/python)
75-
- [Contributing to plotly](contributing.md)
76-
- [Changelog](CHANGELOG.md)
77-
- [Code of Conduct](CODE_OF_CONDUCT.md)
78-
- [Version 4 Migration Guide](https://plot.ly/python/next/v4-migration/)
73+
- [Online Documentation](https://plotly.com/python/)
74+
- [Contributing to plotly](https://github.com/plotly/plotly.py/blob/master/contributing.md)
75+
- [Changelog](https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md)
76+
- [Code of Conduct](https://github.com/plotly/plotly.py/blob/master/CODE_OF_CONDUCT.md)
77+
- [Version 4 Migration Guide](https://plotly.com/python/v4-migration/)
7978
- [New! Announcing Dash 1.0](https://medium.com/plotly/welcoming-dash-1-0-0-f3af4b84bae)
80-
- [Community forum](https://community.plot.ly/c/api/python)
79+
- [Community forum](https://community.plotly.com)
8180

8281
---
8382

@@ -86,13 +85,13 @@ Built on top of [plotly.js](https://github.com/plotly/plotly.js), `plotly.py` is
8685
plotly.py may be installed using pip...
8786

8887
```
89-
pip install plotly==5.2.2
88+
pip install plotly==5.23.0
9089
```
9190

9291
or conda.
9392

9493
```
95-
conda install -c plotly plotly=5.2.2
94+
conda install -c plotly plotly=5.23.0
9695
```
9796

9897
### JupyterLab Support
@@ -101,20 +100,20 @@ For use in [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/), install t
101100
packages using `pip`:
102101

103102
```
104-
$ pip install "jupyterlab>=3" "ipywidgets>=7.6"
103+
pip install "jupyterlab>=3" "ipywidgets>=7.6"
105104
```
106105

107106
or `conda`:
108107

109108
```
110-
$ conda install "jupyterlab>=3" "ipywidgets>=7.6"
109+
conda install "jupyterlab>=3" "ipywidgets>=7.6"
111110
```
112111

113112
The instructions above apply to JupyterLab 3.x. **For JupyterLab 2 or earlier**, run the following commands to install the required JupyterLab extensions (note that this will require [`node`](https://nodejs.org/) to be installed):
114113

115114
```
116115
# JupyterLab 2.x renderer support
117-
jupyter labextension install jupyterlab-plotly@5.3.0 @jupyter-widgets/jupyterlab-manager
116+
jupyter labextension install jupyterlab-plotly@5.23.0 @jupyter-widgets/jupyterlab-manager
118117
```
119118

120119
Please check out our [Troubleshooting guide](https://plotly.com/python/troubleshooting/) if you run into any problems with JupyterLab.
@@ -147,13 +146,13 @@ The [`kaleido`](https://github.com/plotly/Kaleido) package has no dependencies a
147146
using pip...
148147

149148
```
150-
$ pip install -U kaleido
149+
pip install -U kaleido
151150
```
152151

153152
or conda.
154153

155154
```
156-
$ conda install -c conda-forge python-kaleido
155+
conda install -c conda-forge python-kaleido
157156
```
158157

159158
#### Orca
@@ -195,31 +194,17 @@ or conda
195194
conda install -c plotly plotly-geo=1.0.0
196195
```
197196

198-
### Chart Studio support
199-
200-
The `chart-studio` package can be used to upload plotly figures to Plotly's Chart
201-
Studio Cloud or On-Prem service. This package can be installed using pip...
202-
203-
```
204-
pip install chart-studio==1.1.0
205-
```
206-
207-
or conda
208-
209-
```
210-
conda install -c plotly chart-studio=1.1.0
211-
```
212-
213197
## Migration
214198

215-
If you're migrating from plotly.py v3 to v4, please check out the [Version 4 migration guide](https://plot.ly/python/next/v4-migration/)
199+
If you're migrating from plotly.py v3 to v4, please check out the [Version 4 migration guide](https://plotly.com/python/v4-migration/)
216200

217-
If you're migrating from plotly.py v2 to v3, please check out the [Version 3 migration guide](migration-guide.md)
201+
If you're migrating from plotly.py v2 to v3, please check out the [Version 3 migration guide](https://github.com/plotly/plotly.py/blob/master/migration-guide.md)
218202

219203
## Copyright and Licenses
220204

221205
Code and documentation copyright 2019 Plotly, Inc.
222206

223-
Code released under the [MIT license](packages/python/chart-studio/LICENSE.txt).
207+
Code released under the [MIT license](https://github.com/plotly/plotly.py/blob/master/LICENSE.txt).
224208

225209
Docs released under the [Creative Commons license](https://github.com/plotly/documentation/blob/source/LICENSE).
210+

SECURITY.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 5.x | :white_check_mark: |
8+
| < 5.0 | :x: |
9+
10+
## Reporting a Vulnerability
11+
12+
Please email [email protected] with any concerns about security.

binder/requirements.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
jupytext
2-
plotly==5.3.0
2+
plotly==5.23.0
33
jupyter
44
notebook
5-
pandas==1.0.3
6-
statsmodels==0.11.1
5+
pandas==2.2.2
6+
statsmodels==0.14.2
77
scipy
8-
patsy==0.5.1
8+
patsy==0.5.6
99
numpy
1010
plotly-geo
1111
psutil

contributing.md

+38-13
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ contribution.
99

1010
## Code of Conduct
1111

12-
Please check out the [Code of Conduct](CODE_OF_CONDUCT.md). Don't tl:dr; it,
12+
Please check out the [Code of Conduct](CODE_OF_CONDUCT.md). Don't skip it,
1313
but the general idea is to be nice.
1414

1515
## What are the different ways to contribute?
1616

17-
There are many ways to contribute to plotly.py. It helps to understand first
18-
the structure of the code and of the repository.
17+
There are many ways to contribute to plotly.py. To contribute effectively, it is important to first gain an understanding of the structure of the code and of the repository.
1918

2019
- [the `plotly.graph_objects` module](https://plotly.com/python/graph-objects/) (usually imported as `go`)
2120
is [generated from the Plotly.js schema](https://plotly.com/python/figure-structure/),
@@ -24,7 +23,7 @@ the structure of the code and of the repository.
2423
in `packages/python/plotly/codegen`. Most of the codegen code concerns the generation of docstrings from
2524
the schema JSON in Plotly.js. Traces and
2625
Layout classes have a direct correspondence with their Javascript
27-
counterpart. Higher-level methods that work on on figures regardless of the current schema (e.g., `BaseFigure.for_each_trace`) are defined in `packages/python/plotly/plotly/basedatatypes.py`. Additional helper methods are defined there for the `Figure` object, such as
26+
counterpart. Higher-level methods that work on figures regardless of the current schema (e.g., `BaseFigure.for_each_trace`) are defined in `packages/python/plotly/plotly/basedatatypes.py`. Additional helper methods are defined there for the `Figure` object, such as
2827
`update_layout`, `add_trace`, etc.
2928

3029
- [the `plotly.express` module](https://plotly.com/python/plotly-express/) (usually imported as `px`) is a high-level
@@ -126,13 +125,16 @@ learn and become confident about git, like http://try.github.io/.
126125

127126
### Create a virtual environment for plotly development
128127

129-
You can use either [conda][conda-env] or [virtualenv][virtualenv] to create a virtual environment for plotly development, e.g.
128+
You can use either [conda][conda-env] or [virtualenv][virtualenv] to create a virtual environment for plotly development, e.g.:
130129

131130
```bash
132-
conda create -n plotly-dev python
131+
conda create -n plotly-dev python=3.11
133132
conda activate plotly-dev
134133
```
135134

135+
As of May 2024 our dependencies have been tested against Python versions 3.8 to 3.11.
136+
We will support Python 3.12 and higher versions soon.
137+
136138
[conda-env]: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands
137139
[virtualenv]: http://docs.python-guide.org/en/latest/dev/virtualenvs/
138140

@@ -225,7 +227,30 @@ the `plotly/plotly.js` GitHub repository (and place them in
225227
`plotly/package_data`). It will then regenerate all of the `graph_objs`
226228
classes based on the new schema.
227229

228-
For dev branches, it is also possible to use `updateplotlyjsdev --devrepo reponame --devbranch branchname` to update to development versions of `plotly.js`. This will fetch the `plotly.js` in the CircleCI artifact of the branch `branchname` of the repo `reponame`. If `--devrepo` or `--devbranch` are omitted, `updateplotlyjsdev` defaults using `plotly/plotly.js` and `master` respectively.
230+
For dev branches, it is also possible to use `updateplotlyjsdev` in two configurations:
231+
232+
### CircleCI Release
233+
234+
If your devbranch is part of the official plotly.js repository, you can use
235+
```bash
236+
python setup.py updateplotlyjsdev --devrepo reponame --devbranch branchname
237+
```
238+
to update to development versions of `plotly.js`. This will fetch the `plotly.js` in the CircleCI artifact of the branch `branchname` of the repo `reponame`. If `--devrepo` or `--devbranch` are omitted, `updateplotlyjsdev` defaults using `plotly/plotly.js` and `master` respectively.
239+
240+
### Local Repository
241+
242+
If you have a local repository of `plotly.js` you'd like to try, you can run:
243+
244+
```bash
245+
# In your plotly.js/ directory, prepare the package:
246+
247+
$ npm run build
248+
$ npm pack
249+
$ mv plotly.js-*.tgz plotly.js.tgz
250+
251+
# In your plotly.py/packages/python/plotly/ directory:
252+
$ python setup.py updateplotlyjsdev --local /path/to/your/plotly.js/
253+
```
229254

230255
## Testing
231256

@@ -272,11 +297,11 @@ pytest plotly/tests/test_plotly/test_plot.py::test_function
272297

273298
Running tests with tox is much more powerful, but requires a bit more setup.
274299

275-
You'll need to export an environment variable for *each* tox environment you wish to test with. For example, if you want to test with `Python 2.7` and
300+
You'll need to export an environment variable for *each* tox environment you wish to test with. For example, if you want to test with `Python 3.9` and
276301
`Python 3.6`, but only care to check the `core` specs, you would need to ensure that the following variables are exported:
277302

278303
```
279-
export PLOTLY_TOX_PYTHON_27=<python binary>
304+
export PLOTLY_TOX_PYTHON_39=<python binary>
280305
export PLOTLY_TOX_PYTHON_36=<python binary>
281306
```
282307

@@ -287,15 +312,15 @@ Where the `<python binary` is going to be specific to your development setup. As
287312
# tox envs #
288313
############
289314

290-
export PLOTLY_TOX_PYTHON_27=python2.7
291-
export PLOTLY_TOX_PYTHON_34=python3.4
292-
export TOXENV=py27-core,py34-core
315+
export PLOTLY_TOX_PYTHON_39=python3.9
316+
export PLOTLY_TOX_PYTHON_36=python3.6
317+
export TOXENV=py39-core,py36-core
293318
```
294319

295320
Where `TOXENV` is the environment list you want to use when invoking `tox` from the command line. Note that the `PLOTLY_TOX_*` pattern is used to pass in variables for use in the `tox.ini` file. Though this is a little setup, intensive, you'll get the following benefits:
296321

297322
* `tox` will automatically manage a virtual env for each environment you want to test in.
298-
* You only have to run `tox` and know that the module is working in both `Python 2` and `Python 3`.
323+
* You only have to run `tox` and know that the module is working in all included Python versions.
299324

300325
Finally, `tox` allows you to pass in additional command line arguments that are formatted in (by us) in the `tox.ini` file, see `{posargs}`. This is setup to help with our configuration of [pytest markers](http://doc.pytest.org/en/latest/example/markers.html), which are set up in `packages/python/plotly/pytest.ini`. To run only tests that are *not* tagged with `nodev`, you could use the following command:
301326

doc/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ Checklist
6565

6666
### Build process
6767

68-
Run `make` to build html pages for the tutorials. This uses `jupytext` to
68+
This build process requries a free personal public mapbox token to work.
69+
70+
First, create an account at https://account.mapbox.com/auth/signup Once that is done, navigate to https://account.mapbox.com/ and copy your "Default public token" to the file `doc/python/.mapbox_token`
71+
72+
Next, run `make` to build html pages for the tutorials. This uses `jupytext` to
6973
execute the notebooks and `nbconvert` to convert notebook files to static html
7074
pages. Note that the CI will build the doc, so you don't have to build it
7175
yourself, it is enough to check that the markdown file runs correctly in

doc/apidoc/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ help:
3636
# Remove files which were added only for docstring generation
3737
rm ../../packages/python/plotly/plotly/colors/diverging.py ../../packages/python/plotly/plotly/colors/sequential.py ../../packages/python/plotly/plotly/colors/qualitative.py ../../packages/python/plotly/plotly/colors/cyclical.py ../../packages/python/plotly/plotly/colors/colorbrewer.py ../../packages/python/plotly/plotly/colors/carto.py ../../packages/python/plotly/plotly/colors/cmocean.py
3838
rm ../../packages/python/plotly/plotly/express/colors/diverging.py ../../packages/python/plotly/plotly/express/colors/sequential.py ../../packages/python/plotly/plotly/express/colors/qualitative.py ../../packages/python/plotly/plotly/express/colors/cyclical.py ../../packages/python/plotly/plotly/express/colors/colorbrewer.py ../../packages/python/plotly/plotly/express/colors/carto.py ../../packages/python/plotly/plotly/express/colors/cmocean.py
39-
rename 's/graph_objs/graph_objects/' _build/html/*.html _build/html/generated/*.html
39+
rename 's/graph_objs/graph_objects/' _build/html/*.html _build/html/generated/*.html _build/html/generated/generated/*.html
4040
mv _build/html/generated/plotly.graph_objs.html _build/html/generated/plotly.graph_objects.html
4141
sed -i 's/graph_objs/graph_objects/g' _build/html/*.html
4242
sed -i 's/graph_objs/graph_objects/g' _build/html/*.inv

0 commit comments

Comments
 (0)