Skip to content

Commit 21f4f2b

Browse files
authored
Merge branch 'main' into numpy-2.4-is1d-removal
2 parents ce04f5e + b4afdb7 commit 21f4f2b

525 files changed

Lines changed: 4268 additions & 2666 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/pull_request_template.md

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,30 @@
11
<!--
2-
Please uncomment this block and fill in this checklist if your PR makes substantial changes to documentation in the `doc` directory.
3-
Not all boxes must be checked for every PR:
4-
check those that apply to your PR and leave the rest unchecked to discuss with your reviewer.
5-
6-
If your PR modifies code of the `plotly` package, we have a different checklist below.
7-
8-
## Documentation PR
9-
10-
- [ ] I have seen the [`doc/README.md`](https://github.com/plotly/plotly.py/blob/main/doc/README.md) file.
11-
- [ ] This change runs in the current version of Plotly on PyPI and targets the `doc-prod` branch OR it targets the `main` branch.
12-
- [ ] If this PR modifies the first example in a page or adds a new one, it is a `px` example if at all possible.
13-
- [ ] Every new/modified example has a descriptive title and motivating sentence or paragraph.
14-
- [ ] Every new/modified example is independently runnable.
15-
- [ ] Every new/modified example is optimized for short line count and focuses on the Plotly/visualization-related aspects of the example rather than the computation required to produce the data being visualized.
16-
- [ ] Meaningful/relatable datasets are used for all new examples instead of randomly-generated data where possible.
17-
- [ ] The random seed is set if using randomly-generated data.
18-
- [ ] New/modified remote datasets are loaded from https://plotly.github.io/datasets and added to https://github.com/plotly/datasets.
19-
- [ ] Large computations are avoided in the new/modified examples in favour of loading remote datasets that represent the output of such computations.
20-
- [ ] Imports are `plotly.graph_objects as go`, `plotly.express as px`, and/or `plotly.io as pio`.
21-
- [ ] Data frames are always called `df`.
22-
- [ ] `fig = <something>` is called high up in each new/modified example (either `px.<something>` or `make_subplots` or `go.Figure`).
23-
- [ ] Liberal use is made of `fig.add_*` and `fig.update_*` rather than `go.Figure(data=..., layout=...)`.
24-
- [ ] Specific adders and updaters like `fig.add_shape` and `fig.update_xaxes` are used instead of big `fig.update_layout` calls.
25-
- [ ] `fig.show()` is at the end of each example.
26-
- [ ] `plotly.plot()` and `plotly.iplot()` are not used in any example.
27-
- [ ] Named colors are used instead of hex codes wherever possible.
28-
- [ ] Code blocks are marked with `&#96;&#96;&#96;python`.
29-
30-
## Code PR
31-
32-
- [ ] I have read through the [contributing notes](https://github.com/plotly/plotly.py/blob/main/CONTRIBUTING.md) and understand the structure of the package. In particular, if my PR modifies code of `plotly.graph_objects`, my modifications concern the code generator and *not* the generated files.
33-
- [ ] I have added tests or modified existing tests.
34-
- [ ] For a new feature, I have added documentation examples (please see the doc checklist as well).
35-
- [ ] I have added a CHANGELOG entry if changing anything substantial.
36-
- [ ] For a new feature or a change in behavior, I have updated the relevant docstrings in the code.
2+
Thank you for your contribution to plotly.py!
373
4+
Please complete each section below.
385
-->
6+
7+
### Link to issue
8+
<!-- Link to the issue closed by this PR. If the issue doesn't exist yet, create it. -->
9+
10+
Closes #(issue number)
11+
12+
### Description of change
13+
<!-- Provide a clear 1-2 sentence description of what this PR does. -->
14+
15+
### Demo
16+
17+
<!-- Include screenshots or screen recordings of this PR in action. -->
18+
19+
### Testing strategy
20+
21+
<!-- Provide 1-2 sentences explaining tests added or changed by this PR. If testing changes are not needed, explain why. -->
22+
23+
### Additional information (optional)
24+
25+
<!-- Include any additional context, background, or explanation which doesn't fit in the previous sections. -->
26+
27+
### Guidelines
28+
29+
- [ ] I have reviewed the [pull request guidelines](https://github.com/plotly/plotly.py/blob/main/CONTRIBUTING.md#opening-a-pull-request) and the [Code of Conduct](https://github.com/plotly/plotly.py/blob/main/CODE_OF_CONDUCT.md) and confirm that this PR follows them.
30+
- [ ] I have added an entry to the [changelog](https://github.com/plotly/plotly.py/blob/main/CHANGELOG.md) if needed (not required for documentation PRs).

.github/workflows/build-doc.yml

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

0 commit comments

Comments
 (0)