Skip to content

Commit 037956a

Browse files
committed
Merge branch 'main' into merge-docs-changes-to-main
2 parents 75237dc + 3850056 commit 037956a

File tree

15,308 files changed

+746
-25540
lines changed

Some content is hidden

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

15,308 files changed

+746
-25540
lines changed

.circleci/config.yml

+68-162
Large diffs are not rendered by default.

.flake8

-2
This file was deleted.

.gitattributes

-1
This file was deleted.

.github/pull_request_template.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ below :-).
77
### Documentation PR
88
99
- [ ] I've [seen the `doc/README.md` file](https://github.com/plotly/plotly.py/blob/master/doc/README.md)
10-
- [ ] This change runs in the current version of Plotly on PyPI and targets the `doc-prod` branch OR it targets the `master` branch
10+
- [ ] This change runs in the current version of Plotly on PyPI and targets the `doc-prod` branch OR it targets the `main` branch
1111
- [ ] If this PR modifies the first example in a page or adds a new one, it is a `px` example if at all possible
1212
- [ ] Every new/modified example has a descriptive title and motivating sentence or paragraph
1313
- [ ] Every new/modified example is independently runnable
@@ -27,7 +27,7 @@ below :-).
2727
2828
## Code PR
2929
30-
- [ ] I have read through the [contributing notes](https://github.com/plotly/plotly.py/blob/master/contributing.md) and understand the structure of the package. In particular, if my PR modifies code of `plotly.graph_objects`, my modifications concern the `codegen` files and not generated files.
30+
- [ ] I have read through the [contributing notes](https://github.com/plotly/plotly.py/blob/master/CONTRIBUTING.md) and understand the structure of the package. In particular, if my PR modifies code of `plotly.graph_objects`, my modifications concern the `codegen` files and not generated files.
3131
- [ ] I have added tests (if submitting a new feature or correcting a bug) or
3232
modified existing tests.
3333
- [ ] For a new feature, I have added documentation examples in an existing or

.gitignore

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
0
22
0.html
33
iframe_figures/
4-
packages/python/plotly/plotly/tests/test_orca/images/linux/failed/
4+
tests/test_orca/images/linux/failed/
55

66
*.egg-info
77

@@ -15,6 +15,7 @@ doc/python/raw.githubusercontent.com/
1515

1616
# Don't ignore dataset files
1717
!*.csv.gz
18+
!*.geojson.gz
1819

1920
*.ipynb
2021

@@ -48,21 +49,17 @@ plotly.egg-info/
4849
# macOS utility file
4950
**/.DS_Store
5051

51-
plotly/tests/test_orca/images/*/failed
52-
plotly/tests/test_orca/images/*/tmp
53-
/plotly-package/plotly/tests/test_core/test_offline/plotly.min.js
52+
tests/test_orca/images/*/failed
53+
tests/test_orca/images/*/tmp
54+
tests/test_core/test_offline/plotly.min.js
5455
temp-plot.html
5556
.vscode
5657
doc/python/.ipynb_checkpoints
5758
doc/python/.mapbox_token
5859
doc/.ipynb_checkpoints
5960
tags
6061
doc/check-or-enforce-order.py
62+
plotly/package_data/widgetbundle.js
6163

62-
packages/javascript/jupyterlab-plotly/lib/
63-
packages/python/plotly/jupyterlab_plotly/labextension/
64-
packages/python/plotly/jupyterlab_plotly/nbextension/index.js*
65-
packages/python/plotly/plotly/package_data/widgetbundle.js
66-
67-
test/percy/*.html
68-
test/percy/pandas2/*.html
64+
tests/percy/*.html
65+
tests/percy/pandas2/*.html

.pre-commit-config.yaml

-6
This file was deleted.

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ This version includes several performance improvements ([#2368](https://github.c
716716
- Introduce range breaks on date axes (for example, to remove week-ends) via `layout.xaxis.rangebreaks`
717717
- Introduce a new unified x (or y) hovermode (`layout.hovermode="x unified"`), in which the hover box shows the information for all traces at a given x (or y) position
718718
- Add `node.customdata` and `link.customdata` to sankey traces
719-
- Updated [contributing notes](https://github.com/plotly/plotly.py/blob/master/contributing.md) for more explanations on how to contribute to plotly.py [#2290](https://github.com/plotly/plotly.py/pull/2290). Please give feedback on these notes!
719+
- Updated [contributing notes](https://github.com/plotly/plotly.py/blob/master/CONTRIBUTING.md) for more explanations on how to contribute to plotly.py [#2290](https://github.com/plotly/plotly.py/pull/2290). Please give feedback on these notes!
720720
- Updated documentation examples [#2325](https://github.com/plotly/plotly.py/pull/2325), and to show how to color links in Sankey diagrams [#2291](https://github.com/plotly/plotly.py/pull/2291).
721721
- Special thanks to [@SylwiaOliwia2](https://github.com/SylwiaOliwia2) and [@dangercrow](https://github.com/dangercrow) for improving our documentation!
722722

@@ -1738,7 +1738,7 @@ This is a major version with many exciting updates. See the [Introducing plotly.
17381738
- Error message for `plotly.figure_factory.create_choropleth` is now helpful to Anaconda users who do not have the correct modules installed for the County Choropleth figure factory.
17391739

17401740
### Changed / Deprecated
1741-
Please see the [migration guid](migration-guide.md) for a full list of the changes and deprecations in version 3.0.0
1741+
Please see the [migration guide](MIGRATION_GUIDE.md) for a full list of the changes and deprecations in version 3.0.0
17421742

17431743

17441744

contributing.md CONTRIBUTING.md

+22-72
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ There are many ways to contribute to plotly.py. To contribute effectively, it is
2020
is [generated from the Plotly.js schema](https://plotly.com/python/figure-structure/),
2121
so changes to be made in this package need to be
2222
[contributed to Plotly.js](https://github.com/plotly/plotly.js) or to the `codegen` system
23-
in `packages/python/plotly/codegen`. Most of the codegen code concerns the generation of docstrings from
23+
in `codegen/`. Most of the codegen code concerns the generation of docstrings from
2424
the schema JSON in Plotly.js. Traces and
2525
Layout classes have a direct correspondence with their Javascript
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
26+
counterpart. Higher-level methods that work on figures regardless of the current schema (e.g., `BaseFigure.for_each_trace`) are defined in `plotly/basedatatypes.py`. Additional helper methods are defined there for the `Figure` object, such as
2727
`update_layout`, `add_trace`, etc.
2828

2929
- [the `plotly.express` module](https://plotly.com/python/plotly-express/) (usually imported as `px`) is a high-level
30-
functional API that uses `graph_objects` under the hood. Its code is in `packages/python/plotly/plotly/express`.
30+
functional API that uses `graph_objects` under the hood. Its code is in `plotly/express/`.
3131
Plotly Express functions
3232
are designed to be highly consistent with each other, and to do *as little computation
3333
in Python as possible*, generally concerning themselves with formatting data and creating
@@ -49,13 +49,13 @@ There are many ways to contribute to plotly.py. To contribute effectively, it is
4949
as we are introducing more features into `plotly.express`. Some issues in the
5050
tracker are labeled "figure_factory" and can be good issues to work on. More
5151
instructions on figure factories are found
52-
[here](packages/python/plotly/plotly/figure_factory/README.md).
52+
[here](plotly/figure_factory/README.md).
5353

5454
- other pure-Python submodules are: `plotly.io` (low-level interface for
5555
displaying, reading and writing figures), `plotly.subplots` (helper function
5656
for layout of multi-plot figures)
5757

58-
- tests are found in `packages/python/plotly/plotly/tests`. Different
58+
- tests are found in `plotly/tests`. Different
5959
directories correspond to different test jobs (with different dependency sets)
6060
run in continuous integration. More is explained about tests
6161
in the following "Technical aspects" section.
@@ -138,27 +138,25 @@ We will support Python 3.12 and higher versions soon.
138138

139139
### Install development requirements (Non-Windows)
140140
```bash
141-
(plotly_dev) $ pip install -r packages/python/plotly/requires-optional.txt
141+
(plotly_dev) $ pip install -r requires-optional.txt
142142
```
143143
### Install development requirements (Windows + Conda)
144144
Because Windows requires Visual Studio libraries to compile some of the optional dependencies, follow these steps to
145145
complete installation and avoid gdal-config errors.
146146

147147
```bash
148148
(plotly_dev) $ conda install fiona
149-
(plotly_dev) $ pip install -r packages/python/plotly/requires-optional.txt
149+
(plotly_dev) $ pip install -r requires-optional.txt
150150
```
151151

152152
### Editable install of plotly packages
153153
```bash
154-
(plotly_dev) $ pip install -e packages/python/plotly/
155-
(plotly_dev) $ pip install -e packages/python/chart-studio/
156-
(plotly_dev) $ pip install -e packages/python/plotly-geo/
154+
(plotly_dev) $ pip install -e .
157155
```
158156

159157
**Note**: To test `go.FigureWidget` locally, you'll need to generate the javascript bundle as follows:
160158
```
161-
cd packages/python/plotly/js
159+
cd js
162160
npm install && npm run build
163161
```
164162

@@ -176,7 +174,7 @@ documentation on _development mode_.
176174
This repo uses the [Black](https://black.readthedocs.io/en/stable/) code formatter,
177175
and the [pre-commit](https://pre-commit.com/) library to manage a git commit hook to
178176
run Black prior to each commit. Both pre-commit and black are included in the
179-
`packages/python/plotly/requires-optional.txt` file, so you should have them
177+
`requires-optional.txt` file, so you should have them
180178
installed already if you've been following along.
181179

182180
To enable the Black formatting git hook, run the following from within your virtual
@@ -200,7 +198,7 @@ a PR as follows.
200198

201199
### Making a Development Branch
202200

203-
Third, *don't* work in the `master` branch. As soon as you get your master branch ready, run:
201+
Third, *don't* work in the `main` branch. As soon as you get your main branch ready, run:
204202

205203
**DO THIS (but change the branch name)**
206204
```bash
@@ -216,13 +214,12 @@ make that pull request!
216214

217215

218216
## Update to a new version of Plotly.js
219-
First update the version of the `plotly.js` dependency in `packages/python/plotly/js/package.json`.
217+
First update the version of the `plotly.js` dependency in `js/package.json`.
220218

221219
Then run the `updateplotlyjs` command with:
222220

223221
```bash
224-
$ cd packages/python/plotly
225-
$ python setup.py updateplotlyjs
222+
$ python commands.py updateplotlyjs
226223
```
227224

228225
This will download new versions of `plot-schema.json` and `plotly.min.js` from
@@ -236,7 +233,7 @@ For dev branches, it is also possible to use `updateplotlyjsdev` in two configur
236233

237234
If your devbranch is part of the official plotly.js repository, you can use
238235
```bash
239-
python setup.py updateplotlyjsdev --devrepo reponame --devbranch branchname
236+
python commands.py updateplotlyjsdev --devrepo reponame --devbranch branchname
240237
```
241238
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.
242239

@@ -251,16 +248,13 @@ $ npm run build
251248
$ npm pack
252249
$ mv plotly.js-*.tgz plotly.js.tgz
253250

254-
# In your plotly.py/packages/python/plotly/ directory:
255-
$ python setup.py updateplotlyjsdev --local /path/to/your/plotly.js/
251+
# In your plotly.py/ directory:
252+
$ python commands.py updateplotlyjsdev --local /path/to/your/plotly.js/
256253
```
257254

258255
## Testing
259256

260-
We take advantage of two tools to run tests:
261-
262-
* [`tox`](https://tox.readthedocs.io/en/latest/), which is both a virtualenv management and test tool.
263-
* [`pytest`](https://docs.pytest.org/en/latest/), a powerful framework for unit testing.
257+
To run tests, we use [`pytest`](https://docs.pytest.org/en/latest/), a powerful framework for unit testing.
264258

265259
### Running Tests with `pytest`
266260

@@ -269,79 +263,35 @@ Since our tests cover *all* the functionality, to prevent tons of errors from sh
269263
After you've done that, go ahead and run the test suite!
270264

271265
```bash
272-
pytest packages/python/plotly/plotly/tests/
266+
pytest tests/
273267
```
274268

275269
Or for more *verbose* output:
276270

277271
```bash
278-
pytest -v packages/python/plotly/plotly/tests/
272+
pytest -v tests/
279273
```
280274

281275
Either of those will run *every* test we've written for the Python API. You can get more granular by running something like:
282276

283277
```bash
284-
pytest packages/python/plotly/plotly/tests/test_core/
278+
pytest tests/test_core/
285279
```
286280

287281
... or even more granular by running something like:
288282

289283
```bash
290-
pytest plotly/tests/test_plotly/test_plot.py
284+
pytest tests/test_plotly/test_plot.py
291285
```
292286

293287
or for a specific test function
294288

295289
```bash
296-
pytest plotly/tests/test_plotly/test_plot.py::test_function
297-
```
298-
299-
### Running tests with `tox`
300-
301-
Running tests with tox is much more powerful, but requires a bit more setup.
302-
303-
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
304-
`Python 3.6`, but only care to check the `core` specs, you would need to ensure that the following variables are exported:
305-
306-
```
307-
export PLOTLY_TOX_PYTHON_39=<python binary>
308-
export PLOTLY_TOX_PYTHON_36=<python binary>
309-
```
310-
311-
Where the `<python binary` is going to be specific to your development setup. As a more complete example, you might have this loaded in a `.bash_profile` (or equivalent shell loader):
312-
313-
```bash
314-
############
315-
# tox envs #
316-
############
317-
318-
export PLOTLY_TOX_PYTHON_39=python3.9
319-
export PLOTLY_TOX_PYTHON_36=python3.6
320-
export TOXENV=py39-core,py36-core
321-
```
322-
323-
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:
324-
325-
* `tox` will automatically manage a virtual env for each environment you want to test in.
326-
* You only have to run `tox` and know that the module is working in all included Python versions.
327-
328-
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:
329-
330-
```bash
331-
tox -- -a '!nodev'
332-
```
333-
334-
Note that anything after `--` is substituted in for `{posargs}` in the tox.ini. For completeness, because it's reasonably confusing, if you want to force a match for *multiple* `pytest` marker tags, you comma-separate the tags like so:
335-
336-
```bash
337-
tox -- -a '!nodev','!matplotlib'
290+
pytest tests/test_plotly/test_plot.py::test_function
338291
```
339292

340293
### Writing Tests
341294

342295
You're *strongly* encouraged to write tests that check your added functionality.
343296

344297
When you write a new test anywhere under the `tests` directory, if your PR gets accepted, that test will run in a virtual machine to ensure that future changes don't break your contributions!
345-
346-
Test accounts include: `PythonTest`, `PlotlyImageTest`, and `PlotlyStageTest`.
347-
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
include LICENSE.txt
22
include README.md
3-
include versioneer.py
4-
include plotly/_version.py
53
include requires-install.txt
64
include requires-express.txt
75
include plotly/package_data/widgetbundle.js

migration-guide.md MIGRATION_GUIDE.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Migration to Version 6
2+
See https://plotly.com/python/v6-migration/
3+
14
# Migration to Version 5
25
See https://community.plotly.com/t/introducing-plotly-py-5-0-0-a-new-federated-jupyter-extension-icicle-charts-and-bar-chart-patterns/54039
36

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Built on top of [plotly.js](https://github.com/plotly/plotly.js), `plotly.py` is
6767
---
6868

6969
- [Online Documentation](https://plotly.com/python/)
70-
- [Contributing to plotly](https://github.com/plotly/plotly.py/blob/master/contributing.md)
70+
- [Contributing to plotly](https://github.com/plotly/plotly.py/blob/master/CONTRIBUTING.md)
7171
- [Changelog](https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md)
7272
- [Code of Conduct](https://github.com/plotly/plotly.py/blob/master/CODE_OF_CONDUCT.md)
7373
- [Community forum](https://community.plotly.com)
@@ -141,6 +141,8 @@ or conda
141141
conda install -c plotly plotly-geo=1.0.0
142142
```
143143

144+
`plotly-geo` can be found on Github at https://github.com/plotly/plotly-geo.
145+
144146
## Copyright and Licenses
145147

146148
Code and documentation copyright 2019 Plotly, Inc.

0 commit comments

Comments
 (0)