Skip to content

Commit 3779546

Browse files
Merge branch 'main' into patch-1
2 parents d255ab5 + 2b5fddb commit 3779546

109 files changed

Lines changed: 8806 additions & 14116 deletions

File tree

Some content is hidden

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

‎.github/workflows/build-doc.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1818

1919
- name: Set up uv
20-
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
20+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
2121
with:
22-
python-version: "3.9"
22+
python-version: "3.10"
2323

2424
- name: Install system dependencies
2525
run: sudo apt-get update && sudo apt-get install rename
@@ -56,14 +56,14 @@ jobs:
5656
python check-or-enforce-order.py build/html
5757
5858
- name: Upload HTML docs artifact
59-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
59+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
6060
with:
6161
name: doc-html
6262
path: doc/build/html/
6363

6464
- name: Create GitHub App token
6565
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
66-
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
66+
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
6767
id: app-token
6868
with:
6969
app-id: ${{ vars.GRAPHING_LIBRARIES_CI_GHAPP_ID }}

‎.github/workflows/build-package.yml‎

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,61 +11,21 @@ permissions:
1111
contents: read
1212

1313
jobs:
14-
plotlyjs-dev-build:
15-
name: plotly.js dev build
16-
runs-on: ubuntu-latest
17-
steps:
18-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19-
- name: Set up Python
20-
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
21-
with:
22-
python-version: "3.12"
23-
- name: Set up Node
24-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
25-
with:
26-
node-version: "22"
27-
- name: Set up uv
28-
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
29-
- name: Install dependencies
30-
run: |
31-
uv venv
32-
source .venv/bin/activate
33-
uv sync --locked --extra dev_optional
34-
- name: Update plotly.js to dev
35-
run: |
36-
source .venv/bin/activate
37-
python commands.py updateplotlyjsdev
38-
- name: Test core (excluding nodev)
39-
run: |
40-
source .venv/bin/activate
41-
pytest -k 'not nodev' tests/test_core
42-
- name: Build source distribution packages
43-
run: |
44-
source .venv/bin/activate
45-
uv sync --locked --extra dev_build
46-
python -m build --sdist --wheel -o dist
47-
- name: Upload dist artifacts
48-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
49-
with:
50-
name: plotlyjs-dev-build-dist
51-
path: dist/
52-
if-no-files-found: error
53-
5414
full-build:
5515
name: Full prod build
5616
runs-on: ubuntu-latest
5717
steps:
5818
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5919
- name: Set up Python
60-
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
20+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
6121
with:
6222
python-version: "3.12"
6323
- name: Set up Node
64-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
24+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
6525
with:
6626
node-version: "22"
6727
- name: Set up uv
68-
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
28+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
6929
- name: PyPI Build
7030
run: |
7131
uv venv
@@ -82,7 +42,7 @@ jobs:
8242
run: |
8343
tar czf output.tgz output
8444
- name: Upload output artifact
85-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
45+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
8646
with:
8747
name: full-build-output
8848
path: output.tgz

‎.github/workflows/check-codegen.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1919
- name: Set up Python
20-
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
20+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
2121
with:
2222
python-version: "3.x"
2323

2424
- name: Set up uv
25-
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
25+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
2626

2727
- name: Install dependencies
2828
run: |

‎.github/workflows/check-formatting.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1919
- name: Set up Python
20-
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
20+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
2121
with:
2222
python-version: "3.12"
2323
- name: Set up uv
24-
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
24+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
2525
- name: Install dependencies
2626
run: |
2727
uv venv

‎.github/workflows/check-js-build.yml‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2222
- name: Set up Python
23-
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
23+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
2424
with:
2525
python-version: "3.x"
2626

@@ -29,20 +29,21 @@ jobs:
2929
PYPROJECT_PATH="pyproject.toml"
3030
PKGJSON_PATH="js/package.json"
3131
PYPROJECT_VERSION=$(awk -F'"' '/^version/ {print $2; exit}' $PYPROJECT_PATH)
32+
EXPECTED_JS_VERSION=$(echo "$PYPROJECT_VERSION" | sed -E 's/(a|b|rc)[0-9]+$/-&/')
3233
JSPROJECT_VERSION=$(cat $PKGJSON_PATH | jq -r '.version')
33-
if [ "$PYPROJECT_VERSION" != "$JSPROJECT_VERSION" ]; then
34+
if [ "$EXPECTED_JS_VERSION" != "$JSPROJECT_VERSION" ]; then
3435
echo "❌ Version number $JSPROJECT_VERSION in $PKGJSON_PATH does not match version number $PYPROJECT_VERSION in $PYPROJECT_PATH"
3536
exit 1
3637
else
3738
echo "✅ Version number $JSPROJECT_VERSION in $PKGJSON_PATH matches version number $PYPROJECT_VERSION in $PYPROJECT_PATH"
3839
fi
3940
- name: Install Node
40-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
41+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
4142
with:
4243
node-version: '22'
4344

4445
- name: Set up uv
45-
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
46+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
4647

4748
- name: Copy current files to a temporary directory
4849
run: |
@@ -76,7 +77,7 @@ jobs:
7677
fi
7778
7879
- name: Store the build artifacts from plotly/labextension
79-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
80+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
8081
if: failure()
8182
with:
8283
name: labextension

‎.github/workflows/publish-pypi.yml‎

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
name: Publish to PyPI
2+
3+
# Run from the "main" branch and give the tag to publish (for example v7.1.0
4+
# or v7.1.0rc0). Publishing to PyPI waits for approval on the "pypi"
5+
# environment. The GitHub release is only created after PyPI accepts the files.
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: Tag to publish (for example v7.1.0 or v7.1.0rc0)
11+
required: true
12+
type: string
13+
14+
# A second run of the same tag waits for the first run to finish
15+
concurrency:
16+
group: publish-${{ inputs.tag }}
17+
cancel-in-progress: false
18+
19+
permissions:
20+
contents: read
21+
22+
env:
23+
TAG: ${{ inputs.tag }}
24+
25+
jobs:
26+
validate:
27+
name: Validate tag
28+
runs-on: ubuntu-latest
29+
outputs:
30+
version: ${{ steps.tag.outputs.version }}
31+
prerelease: ${{ steps.tag.outputs.prerelease }}
32+
steps:
33+
- name: Require the workflow to run from main
34+
env:
35+
REF: ${{ github.ref }}
36+
run: |
37+
if [ "$REF" != "refs/heads/main" ]; then
38+
echo "::error::Run this workflow from the main branch, not $REF"
39+
exit 1
40+
fi
41+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
42+
with:
43+
fetch-depth: 0
44+
persist-credentials: false
45+
# Only vX.Y.Z and vX.Y.Z followed by aN, bN or rcN are publishable. The
46+
# optional suffix group is the single source of truth for "pre-release".
47+
- name: Check the tag format
48+
id: tag
49+
run: |
50+
if [[ ! "$TAG" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)((a|b|rc)[0-9]+)?$ ]]; then
51+
echo "::error::Tag $TAG must look like vX.Y.Z, vX.Y.ZaN, vX.Y.ZbN or vX.Y.ZrcN"
52+
exit 1
53+
fi
54+
if [ -n "${BASH_REMATCH[2]}" ]; then prerelease=true; else prerelease=false; fi
55+
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
56+
echo "prerelease=$prerelease" >> "$GITHUB_OUTPUT"
57+
echo "Tag $TAG: version ${TAG#v}, prerelease $prerelease"
58+
- name: Check that the tag exists and is on main
59+
run: |
60+
git rev-parse --verify --quiet "refs/tags/$TAG^{commit}" || {
61+
echo "::error::Tag $TAG does not exist"
62+
exit 1
63+
}
64+
git merge-base --is-ancestor "refs/tags/$TAG^{commit}" origin/main || {
65+
echo "::error::Tag $TAG is not reachable from main"
66+
exit 1
67+
}
68+
69+
build:
70+
name: Build files from the tag
71+
needs: validate
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
75+
with:
76+
ref: ${{ inputs.tag }}
77+
persist-credentials: false
78+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
79+
with:
80+
python-version: "3.12"
81+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
82+
with:
83+
node-version: "22"
84+
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
85+
- name: Build wheel and sdist
86+
run: |
87+
uv venv
88+
source .venv/bin/activate
89+
uv sync --locked --extra dev_build
90+
cd js
91+
npm ci
92+
npm run build
93+
cd ..
94+
python -m build --sdist --wheel -o dist
95+
# The build backend names both files after the version in pyproject.toml,
96+
# so this one check ties pyproject.toml, the wheel and the sdist to the tag.
97+
- name: Verify that the build matches the tag
98+
env:
99+
VERSION: ${{ needs.validate.outputs.version }}
100+
run: |
101+
expected=$(printf '%s\n' "plotly-$VERSION-py3-none-any.whl" "plotly-$VERSION.tar.gz")
102+
found=$(ls -1 dist | LC_ALL=C sort)
103+
if [ "$found" != "$expected" ]; then
104+
echo "::error::Tag $TAG expects these files in dist/, but found different ones"
105+
printf 'Expected:\n%s\nFound:\n%s\n' "$expected" "$found"
106+
exit 1
107+
fi
108+
- name: Extract release notes from CHANGELOG.md
109+
env:
110+
VERSION: ${{ needs.validate.outputs.version }}
111+
run: |
112+
# Print the lines under "## [<version>] - <date>" up to the next "## " heading
113+
awk -v heading="[$VERSION]" '
114+
$1 == "##" && $2 == heading { found = 1; next }
115+
found && /^## / { exit }
116+
found { print }
117+
' CHANGELOG.md > notes.md
118+
if ! grep -q '[^[:space:]]' notes.md; then
119+
echo "::error::CHANGELOG.md has no section for $VERSION"
120+
exit 1
121+
fi
122+
cat notes.md
123+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
124+
with:
125+
name: dist
126+
path: dist/
127+
if-no-files-found: error
128+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
129+
with:
130+
name: notes
131+
path: notes.md
132+
if-no-files-found: error
133+
134+
pypi:
135+
name: Upload to PyPI
136+
needs: [validate, build]
137+
runs-on: ubuntu-latest
138+
# Waits for a libraries_admin approval before the OIDC token is issued
139+
environment:
140+
name: pypi
141+
url: https://pypi.org/p/plotly
142+
# Signs this workflow so PyPI trusts it
143+
permissions:
144+
id-token: write
145+
steps:
146+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
147+
with:
148+
name: dist
149+
path: dist/
150+
- name: Publish package distributions to PyPI
151+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
152+
with:
153+
# A re-run of a tag already on PyPI skips instead of failing
154+
skip-existing: true
155+
156+
github-release:
157+
name: Create GitHub release
158+
needs: [validate, pypi]
159+
runs-on: ubuntu-latest
160+
# Kept apart from the pypi job so that the OIDC token and the write
161+
# access to the repository never share a job
162+
permissions:
163+
contents: write
164+
env:
165+
GH_TOKEN: ${{ github.token }}
166+
GH_REPO: ${{ github.repository }}
167+
PRERELEASE: ${{ needs.validate.outputs.prerelease }}
168+
steps:
169+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
170+
with:
171+
name: dist
172+
path: dist/
173+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
174+
with:
175+
name: notes
176+
path: .
177+
- name: Create the release
178+
run: |
179+
if gh release view "$TAG" > /dev/null 2>&1; then
180+
echo "::error::A release for $TAG exists already. Delete it and re-run."
181+
exit 1
182+
fi
183+
flags=""
184+
if [ "$PRERELEASE" = "true" ]; then
185+
flags="--prerelease"
186+
fi
187+
gh release create "$TAG" dist/* \
188+
--title "$TAG" \
189+
--notes-file notes.md \
190+
--verify-tag \
191+
$flags
192+
- name: Assert the pre-release flag matches the version
193+
run: |
194+
actual=$(gh release view "$TAG" --json isPrerelease --jq .isPrerelease)
195+
if [ "$actual" != "$PRERELEASE" ]; then
196+
echo "::error::Release $TAG has prerelease=$actual, but the version requires $PRERELEASE"
197+
exit 1
198+
fi
199+
echo "Release $TAG has prerelease=$actual, as the version requires"

‎.github/workflows/run-percy.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2424
- name: Set up Python
25-
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
25+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
2626
with:
2727
python-version: "3.11"
2828
- name: Set up Node
29-
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
29+
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
3030
with:
3131
node-version: "22"
3232
- name: Set up Chrome
3333
uses: browser-actions/setup-chrome@48ad923757ca74d66703209fe939badbdf80f2f4 # v2.2.0
3434
with:
3535
install-chromedriver: true
3636
- name: Set up uv
37-
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
37+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
3838
- name: Install requirements
3939
run: |
4040
uv venv

0 commit comments

Comments
 (0)