Skip to content

Commit c691390

Browse files
authored
Merge branch 'main' into colab
2 parents bf4b03e + 5b4363e commit c691390

481 files changed

Lines changed: 10548 additions & 4710 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.

.circleci/config.yml

Lines changed: 0 additions & 479 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Set up Chrome for pytest
2+
description: Install Chrome/Chromedriver, set BROWSER, and verify the setup
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Set up Chrome
7+
id: setup-chrome
8+
uses: browser-actions/setup-chrome@4f8e94349a351df0f048634f25fec36c3c91eded # v2.1.1
9+
with:
10+
install-chromedriver: true
11+
- name: Set BROWSER env var
12+
shell: bash
13+
run: |
14+
echo "BROWSER=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
15+
- name: Check Chrome setup
16+
shell: bash
17+
run: |
18+
CHROME_PATH="${{ steps.setup-chrome.outputs.chrome-path }}"
19+
CHROMEDRIVER_PATH="${{ steps.setup-chrome.outputs.chromedriver-path }}"
20+
echo "Chrome path: $CHROME_PATH"
21+
echo "Chrome version: $($CHROME_PATH --version)"
22+
echo "Chromedriver path: $CHROMEDRIVER_PATH"
23+
echo "Chromedriver version: $($CHROMEDRIVER_PATH --version)"
24+
echo "chrome --version: $(chrome --version)"
25+
echo "BROWSER = $BROWSER"
26+
python -c "import webbrowser; webbrowser.register_standard_browsers(); print(webbrowser._tryorder)"
27+
python -c "import webbrowser; webbrowser.get()"

.github/workflows/build-doc.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: Build Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- doc-prod
7+
pull_request:
8+
types: [opened, reopened, synchronize]
9+
10+
jobs:
11+
build-doc:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
15+
16+
- name: Set up uv
17+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
18+
with:
19+
python-version: "3.9"
20+
21+
- name: Install system dependencies
22+
run: sudo apt-get update && sudo apt-get install rename
23+
24+
- name: Install doc dependencies
25+
run: |
26+
cd doc
27+
uv venv
28+
source .venv/bin/activate
29+
uv pip install -r requirements.txt
30+
31+
- name: Install plotly in editable mode
32+
if: github.ref_name != 'doc-prod'
33+
run: |
34+
cd doc
35+
source .venv/bin/activate
36+
uv pip uninstall plotly
37+
uv pip install -e ..
38+
39+
40+
- name: Build HTML docs
41+
env:
42+
MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }}
43+
run: |
44+
cd doc
45+
source .venv/bin/activate
46+
echo "${MAPBOX_TOKEN}" > python/.mapbox_token
47+
make -kj8 || make -kj8
48+
curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/front-matter-ci.py > front-matter-ci.py
49+
curl https://raw.githubusercontent.com/plotly/graphing-library-docs/master/check-or-enforce-order.py > check-or-enforce-order.py
50+
python front-matter-ci.py build/html
51+
python check-or-enforce-order.py build/html
52+
53+
- name: Upload HTML docs artifact
54+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
55+
with:
56+
name: doc-html
57+
path: doc/build/html/
58+
59+
- name: Create GitHub App token
60+
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
61+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
62+
id: app-token
63+
with:
64+
app-id: ${{ vars.GRAPHING_LIBRARIES_CI_GHAPP_ID }}
65+
private-key: ${{ secrets.GRAPHING_LIBRARIES_CI_GHAPP_PRIVATE_KEY }}
66+
owner: ${{ github.repository_owner }}
67+
repositories: plotly.py-docs,graphing-library-docs
68+
69+
- name: Checkout plotly.py-docs (built)
70+
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
71+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
72+
with:
73+
repository: plotly/plotly.py-docs
74+
ref: built
75+
token: ${{ steps.app-token.outputs.token }}
76+
path: plotly.py-docs-html
77+
78+
- name: Deploy HTML docs
79+
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
80+
run: |
81+
git config --global user.name plotlydocbot
82+
git config --global user.email accounts@plot.ly
83+
rm -rf plotly.py-docs-html/*
84+
cp -r doc/build/html/* plotly.py-docs-html/
85+
cd plotly.py-docs-html
86+
git add .
87+
git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit"
88+
git push --force
89+
90+
- name: Checkout plotly.py-docs (built_ipynb)
91+
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
92+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
93+
with:
94+
repository: plotly/plotly.py-docs
95+
ref: built_ipynb
96+
token: ${{ steps.app-token.outputs.token }}
97+
path: plotly.py-docs-ipynb
98+
99+
- name: Deploy notebooks
100+
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
101+
run: |
102+
rm -rf plotly.py-docs-ipynb/*
103+
cp -r doc/build/ipynb/* plotly.py-docs-ipynb/
104+
cd plotly.py-docs-ipynb
105+
git add .
106+
git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit"
107+
git push --force
108+
109+
- name: Checkout graphing-library-docs
110+
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
111+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
112+
with:
113+
repository: plotly/graphing-library-docs
114+
ref: master
115+
token: ${{ steps.app-token.outputs.token }}
116+
path: graphing-library-docs
117+
118+
- name: Trigger downstream doc build
119+
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
120+
run: |
121+
cd graphing-library-docs
122+
git commit --allow-empty -m "deploying https://github.com/plotly/plotly.py/commit/${{ github.sha }}"
123+
git push
124+
125+
- name: Build API docs
126+
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
127+
run: |
128+
cd doc
129+
source .venv/bin/activate
130+
# For the API doc, we need to use the local version of plotly
131+
# since we are tweaking the source because of
132+
# graph_objs/graph_objects
133+
uv pip uninstall plotly
134+
uv pip install -e ..
135+
cd apidoc
136+
make html
137+
138+
- name: Checkout plotly.py-docs (gh-pages)
139+
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
140+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
141+
with:
142+
repository: plotly/plotly.py-docs
143+
ref: gh-pages
144+
token: ${{ steps.app-token.outputs.token }}
145+
path: plotly.py-docs-api
146+
147+
- name: Deploy API docs
148+
if: github.ref_name == 'doc-prod' && github.event_name == 'push'
149+
run: |
150+
rm -rf plotly.py-docs-api/*
151+
cp -r doc/apidoc/_build/html/* plotly.py-docs-api/
152+
touch plotly.py-docs-api/.nojekyll
153+
cd plotly.py-docs-api
154+
git add .
155+
git commit -m "build of https://github.com/plotly/plotly.py/commit/${{ github.sha }}" || echo "No changes to commit"
156+
git push --force
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, reopened, synchronize]
9+
10+
jobs:
11+
plotlyjs-dev-build:
12+
name: plotly.js dev build
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
- name: Set up Python
17+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
18+
with:
19+
python-version: "3.12"
20+
- name: Set up Node
21+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
22+
with:
23+
node-version: "22"
24+
- name: Set up uv
25+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
26+
- name: Install dependencies
27+
run: |
28+
uv venv
29+
source .venv/bin/activate
30+
uv sync --extra dev_optional
31+
- name: Update plotly.js to dev
32+
run: |
33+
source .venv/bin/activate
34+
python commands.py updateplotlyjsdev
35+
- name: Test core (excluding nodev)
36+
run: |
37+
source .venv/bin/activate
38+
pytest -k 'not nodev' tests/test_core
39+
- name: Build source distribution packages
40+
run: |
41+
source .venv/bin/activate
42+
uv sync --extra dev_build
43+
python -m build --sdist --wheel -o dist
44+
- name: Upload dist artifacts
45+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
46+
with:
47+
name: plotlyjs-dev-build-dist
48+
path: dist/
49+
if-no-files-found: error
50+
51+
full-build:
52+
name: Full prod build
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
56+
- name: Set up Python
57+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
58+
with:
59+
python-version: "3.12"
60+
- name: Set up Node
61+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
62+
with:
63+
node-version: "22"
64+
- name: Set up uv
65+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
66+
- name: PyPI Build
67+
run: |
68+
uv venv
69+
source .venv/bin/activate
70+
uv sync --extra dev_build
71+
cd js
72+
npm ci
73+
npm run build
74+
cd ..
75+
python -m build --sdist --wheel -o dist
76+
cp -R dist output
77+
git status
78+
- name: Zip output
79+
run: |
80+
tar czf output.tgz output
81+
- name: Upload output artifact
82+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
83+
with:
84+
name: full-build-output
85+
path: output.tgz
86+
if-no-files-found: error
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Check Python code formatting
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, reopened, synchronize]
9+
10+
jobs:
11+
check-code-formatting:
12+
name: Run ruff check
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
- name: Set up Python
17+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
18+
with:
19+
python-version: "3.12"
20+
- name: Set up uv
21+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
22+
- name: Install dependencies
23+
run: |
24+
uv venv
25+
source .venv/bin/activate
26+
uv sync --extra dev_core
27+
- name: Check handwritten code with ruff
28+
run: |
29+
source .venv/bin/activate
30+
ruff format --check .

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1-
on: push
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
types: [opened, reopened]
7+
paths:
8+
- 'js/**'
9+
- 'plotly/labextension/**'
10+
11+
name: Check JS build
212

313
jobs:
414
check-js-build:
515
name: Check JS version number and build artifacts
616
runs-on: ubuntu-latest
717
steps:
8-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
919
- name: Set up Python
10-
uses: actions/setup-python@v5
20+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
1121
with:
1222
python-version: "3.x"
1323

@@ -24,17 +34,19 @@ jobs:
2434
echo "✅ Version number $JSPROJECT_VERSION in $PKGJSON_PATH matches version number $PYPROJECT_VERSION in $PYPROJECT_PATH"
2535
fi
2636
- name: Install Node
27-
uses: actions/setup-node@v4
37+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
2838
with:
2939
node-version: '22'
3040

41+
- name: Set up uv
42+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
43+
3144
- name: Copy current files to a temporary directory
3245
run: |
3346
mv plotly/labextension/ plotly/labextension-tmp/
3447
3548
- name: Install dependencies and build
3649
run: |
37-
curl -LsSf https://astral.sh/uv/install.sh | sh
3850
uv venv
3951
source .venv/bin/activate
4052
uv pip install jupyterlab
@@ -59,7 +71,7 @@ jobs:
5971
fi
6072
6173
- name: Store the build artifacts from plotly/labextension
62-
uses: actions/upload-artifact@v4
74+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
6375
if: failure()
6476
with:
6577
name: labextension

0 commit comments

Comments
 (0)