Skip to content

Commit d339c7b

Browse files
committed
Merge branch 'main' into codegen2
2 parents 13df0c5 + c54a2bd commit d339c7b

17 files changed

+65
-93
lines changed

Diff for: .circleci/config.yml

+29-38
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ commands:
2424
name: Test core
2525
command: |
2626
. venv/bin/activate
27-
pytest tests/test_core
27+
python -m pytest tests/test_core
2828
no_output_timeout: 20m
2929

3030
test_optional:
@@ -39,51 +39,52 @@ commands:
3939
- run:
4040
name: Install dependencies
4141
command: |
42-
python -m venv venv
43-
. venv/bin/activate
44-
pip install -e .
45-
pip install -r ./test_requirements/requirements_<<parameters.py>>_optional.txt
42+
curl -LsSf https://astral.sh/uv/install.sh | sh
43+
uv venv
44+
source .venv/bin/activate
45+
uv pip install .
46+
uv pip install -r ./test_requirements/requirements_<<parameters.py>>_optional.txt
4647
cd js
4748
npm ci
4849
npm run build
4950
- run:
5051
name: Install plotly-geo
5152
command: |
52-
. venv/bin/activate
53-
pip install plotly-geo
53+
source .venv/bin/activate
54+
uv pip install plotly-geo
5455
- run:
5556
name: Test core
5657
command: |
57-
. venv/bin/activate
58-
pytest tests/test_core
58+
source .venv/bin/activate
59+
python -m pytest tests/test_core
5960
no_output_timeout: 20m
6061
- run:
6162
name: Test optional
6263
command: |
63-
. venv/bin/activate
64-
pytest tests/test_optional
64+
source .venv/bin/activate
65+
python -m pytest tests/test_optional
6566
no_output_timeout: 40m
6667
- run:
6768
name: Test utils
6869
command: |
69-
. venv/bin/activate
70-
pytest tests/test_plotly_utils/
70+
source .venv/bin/activate
71+
python -m pytest tests/test_plotly_utils/
7172
no_output_timeout: 20m
7273
- run:
7374
name: Test io
7475
command: |
75-
. venv/bin/activate
76-
pytest tests/test_io
76+
source .venv/bin/activate
77+
python -m pytest tests/test_io
7778
no_output_timeout: 20m
7879
- run:
79-
name: Test dependencdies not imported
80+
name: Test dependencies not imported
8081
command: |
81-
. venv/bin/activate
82+
source .venv/bin/activate
8283
python -m pytest -x test_init/test_dependencies_not_imported.py
8384
- run:
8485
name: Test lazy imports
8586
command: |
86-
. venv/bin/activate
87+
source .venv/bin/activate
8788
python -m pytest -x test_init/test_lazy_imports.py
8889
test_orca:
8990
parameters:
@@ -392,25 +393,21 @@ jobs:
392393
- "dc:5f:39:48:00:b4:72:34:e1:d2:c4:e1:1f:d1:e2:ce" #plotlydocbot
393394

394395
- checkout
395-
396-
# Download and cache dependencies
397-
- restore_cache:
398-
key: v2-dependencies-{{ checksum "doc/requirements.txt" }}-{{ checksum ".circleci/config.yml" }}
399396
- browser-tools/install-chrome
400397
- browser-tools/install-chromedriver
401398

402399
- run:
403400
name: install dependencies
404401
command: |
405402
cd doc
406-
python -m venv venv
407-
. venv/bin/activate
408-
pip uninstall -y plotly
409-
pip install -r requirements.txt
403+
curl -LsSf https://astral.sh/uv/install.sh | sh
404+
uv venv
405+
source .venv/bin/activate
406+
uv pip install -r requirements.txt
410407
if [ "${CIRCLE_BRANCH}" != "doc-prod" ]; then
411-
pip uninstall -y plotly
408+
uv pip uninstall plotly
412409
cd ..
413-
pip install -e .
410+
uv pip install -e .
414411
cd js
415412
npm ci
416413
npm run build
@@ -426,17 +423,11 @@ jobs:
426423
sudo apt-get install -y poppler-utils libxtst6 xvfb libgtk2.0-0 libgconf-2-4 libnss3 libasound2 rename
427424
echo 'export PATH="/home/circleci/project/node_modules/.bin:$PATH"' >> $BASH_ENV
428425
429-
- save_cache:
430-
paths:
431-
- ./doc/venv
432-
- ./doc/node_modules
433-
key: v1-dependencies-{{ checksum "doc/requirements.txt" }}-{{ checksum ".circleci/config.yml" }}
434-
435426
- run:
436427
name: make html
437428
command: |
438429
cd doc
439-
. venv/bin/activate
430+
source .venv/bin/activate
440431
echo ${mapbox_token} > python/.mapbox_token
441432
make -kj8 || make -kj8
442433
curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/front-matter-ci.py > front-matter-ci.py
@@ -485,14 +476,14 @@ jobs:
485476
name: make doc
486477
command: |
487478
cd doc
488-
. venv/bin/activate
479+
source .venv/bin/activate
489480
# For the API doc, we need to use the local version of plotly
490481
# since we are tweaking the source because of
491482
# graph_objs/graph_objects
492483
if [ "${CIRCLE_BRANCH}" == "doc-prod" ]; then
493-
pip uninstall -y plotly
484+
uv pip uninstall plotly
494485
cd ..
495-
pip install -e .
486+
uv pip install -e .
496487
cd doc
497488
cd apidoc
498489
make html

Diff for: .github/pull_request_template.md

+1-1
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

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
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.0.1] - 2025-02-16
6+
7+
### Fixed
8+
- Fix `TypeError` when using `orjson` to serialize `pandas.NA`.
9+
510
## [6.0.0] - 2025-01-28
611

712
### Added

Diff for: CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ a PR as follows.
198198

199199
### Making a Development Branch
200200

201-
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:
202202

203203
**DO THIS (but change the branch name)**
204204
```bash

Diff for: MANIFEST.in

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
include LICENSE.txt
22
include README.md
3-
include requires-install.txt
4-
include requires-express.txt
53
include plotly/package_data/widgetbundle.js

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pip install plotly
8585
or conda.
8686

8787
```
88-
conda install -c plotly plotly
88+
conda install -c conda-forge plotly
8989
```
9090

9191
### Jupyter Widget Support

Diff for: RELEASE.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Manually update the versions to `X.Y.Z` in the files specified below.
3333
- Create a tag for Github release
3434
+ `git tag vX.Y.Z`
3535
+ `git push --atomic origin release-X.Y.Z vX.Y.Z`
36-
- Create a Github pull request from `release-X.Y.Z` to `master` and wait for CI to be green
36+
- Create a Github pull request from `release-X.Y.Z` to `main` and wait for CI to be green
3737

3838
### Download and QA CI Artifacts
3939

@@ -62,7 +62,7 @@ Publishing to PyPI:
6262

6363
### Merge the PR and make a Release
6464

65-
1. Merge the pull request you created above into `master`
65+
1. Merge the pull request you created above into `main`
6666
2. Go to https://github.com/plotly/plotly.py/releases and "Draft a new release"
6767
3. Enter the `vX.Y.Z` tag you created already above and make "Release title" the same string as the tag.
6868
4. Copy the changelog section for this version as the "Describe this release"
@@ -73,9 +73,8 @@ Publishing to PyPI:
7373
- `doc/python/getting-started.md`
7474
- `doc/apidoc/conf.py`
7575
- `doc/requirements.txt`
76-
- `binder/requirements.txt`
77-
2. `doc-prod` should already have been merged on a regular basis into `master`, but
78-
start by doing it first if not. Then merge `master` into `doc-prod` to deploy the doc related
76+
2. `doc-prod` should already have been merged on a regular basis into `main`, but
77+
start by doing it first if not. Then merge `main` into `doc-prod` to deploy the doc related
7978
to features in the release.
8079
3. in a clone of the [`graphing-library-docs` repo](https://github.com/plotly/graphing-library-docs):
8180
1. bump the version of Plotly.py in `_data/pyversion.json`

Diff for: binder/requirements.txt

-21
This file was deleted.

Diff for: doc/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ released, or which has just been included but not yet released.
4141
your branch off the `doc-prod` branch and open your pull request against this
4242
`doc-prod` branch.
4343
- Case of a new (not released yet) feature: start your branch / pull request
44-
against the `master` branch. `master` and `doc-prod` will be synchronized at
44+
against the `main` branch. `main` and `doc-prod` will be synchronized at
4545
release time, so that the documentation of the feature is only deployed when
4646
it is available in a released version of `plotly.py`.
4747

Diff for: doc/python/getting-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ $ pip install plotly
6464
or `conda`:
6565

6666
```
67-
$ conda install -c plotly plotly
67+
$ conda install -c conda-forge plotly
6868
```
6969

7070
If you want to use Plotly Express, install its required dependencies with:

Diff for: doc/python/performance.md

+4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ The following [array data types](https://numpy.org/devdocs/reference/arrays.scal
7878

7979
Arrays or data types that are not supported for base64 encoding to Plotly.js's typed arrays specification will still work and render correctly with Plotly. Those arrays and or data types just won't have the performance benefits that Plotly.js's base64 typed arrays feature provides.
8080

81+
### Dash Design Kit Compatibility
82+
83+
The Dash Design Kit `Graph` component from versions of Dash Design Kit earlier than 1.13 doesn't work with Plotly.py version 6 when using Python objects listed in the previous "Arrays and Data Types Supported". Upgrade Dash Design Kit to 1.13 or later to resolve this issue.
84+
8185
### Unsupported Attributes
8286

8387
Arrays passed to attributes with the following names are not supported for base64 encoding for rendering with Plotly.js.

Diff for: doc/python/v6-changes.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ pip install anywidget
5757

5858
Plotly.py now takes advantage of recent changes in how Plotly.js handles typed arrays for improved performance. See the [performance page](https://plotly.com/python/performance/) for more details.
5959

60+
> If you are using Plotly.py 6 or later with Dash Design Kit, you may need to upgrade your Dash Design Kit version. See the [Dash Design Kit Compatibility section on the performance page](/python/performance/#dash-design-kit-compatibility) for more details.
61+
62+
6063
## Dataframe Support
6164

62-
Plotly Express now uses [Narwhals](https://narwhals-dev.github.io/narwhals/) to natively support pandas, Polars, and PyArrow. With this change, the [performance](https://plotly.com/python/performance/) of using Polars or PyArrow with Plotly Express is significantly improved.
65+
Plotly Express now uses [Narwhals](https://narwhals-dev.github.io/narwhals/) to natively support pandas, Polars, and PyArrow. With this change, the [performance](https://plotly.com/python/performance/) of using Polars or PyArrow with Plotly Express is significantly improved.
6366

6467
## Mapbox Deprecation
6568

Diff for: plotly/io/_json.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ def clean_to_json_compatible(obj, **kwargs):
529529

530530
# pandas
531531
if pd is not None:
532-
if obj is pd.NaT:
532+
if obj is pd.NaT or obj is pd.NA:
533533
return None
534534
elif isinstance(obj, (pd.Series, pd.DatetimeIndex)):
535535
if numpy_allowed and obj.dtype.kind in ("b", "i", "u", "f"):

Diff for: pyproject.toml

+7-2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,14 @@ classifiers = [
3838
requires-python = ">=3.8"
3939
license = {file="LICENSE.txt"}
4040
version = "6.0.0"
41-
dynamic = ["dependencies"]
41+
dependencies = [
42+
"narwhals>=1.15.1",
43+
"packaging"
44+
]
45+
46+
[project.optional-dependencies]
47+
express = ["numpy"]
4248

43-
# TODO: check that this works
4449
[tool.setuptools.packages.find]
4550
where = ["."]
4651
include = ["plotly*", "_plotly*"]

Diff for: requires-express.txt

-8
This file was deleted.

Diff for: requires-install.txt

-10
This file was deleted.

Diff for: tests/test_io/test_to_from_plotly_json.py

+6
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,9 @@ def test_sanitize_json(engine):
260260
for bad, good in replacements.items():
261261
assert bad not in fig_json
262262
assert good in fig_json
263+
264+
265+
@pytest.mark.parametrize("na_value", [np.nan, pd.NaT, pd.NA])
266+
def test_na_values(engine, na_value):
267+
result = pio.to_json_plotly(na_value, engine=engine)
268+
assert result == "null"

0 commit comments

Comments
 (0)