Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,6 @@ permissions:
contents: read

jobs:
plotlyjs-dev-build:
name: plotly.js dev build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Set up Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
- name: Set up uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
- name: Install dependencies
run: |
uv venv
source .venv/bin/activate
uv sync --locked --extra dev_optional
- name: Update plotly.js to dev
run: |
source .venv/bin/activate
python commands.py updateplotlyjsdev
- name: Test core (excluding nodev)
run: |
source .venv/bin/activate
pytest -k 'not nodev' tests/test_core
- name: Build source distribution packages
run: |
source .venv/bin/activate
uv sync --locked --extra dev_build
python -m build --sdist --wheel -o dist
- name: Upload dist artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: plotlyjs-dev-build-dist
path: dist/
if-no-files-found: error

full-build:
name: Full prod build
runs-on: ubuntu-latest
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/test-plotlyjs-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Test plotly.js dev

# Run codegen and the core tests against the plot-schema.json on plotly.js main
# once a week. This catches plotly.js schema changes that break codegen or
# validation before the next plotly.js release.
on:
schedule:
- cron: "0 9 * * 1" # Monday 09:00 UTC
workflow_dispatch:
inputs:
plotlyjs_ref:
description: "plotly.js branch, tag, or commit SHA to test"
required: false
default: "main"

permissions:
contents: read

jobs:
test-plotlyjs-dev:
name: Test against plotly.js dev schema
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Set up uv
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
- name: Install dependencies
run: |
uv venv
source .venv/bin/activate
uv sync --locked --extra dev_optional
- name: Download plot-schema.json from plotly.js
# plotly.js CI keeps test/plot-schema.json identical to the built schema
env:
PLOTLYJS_REF: ${{ inputs.plotlyjs_ref || 'main' }}
run: |
curl -fsSL -o codegen/resources/plot-schema.json \
"https://raw.githubusercontent.com/plotly/plotly.js/${PLOTLYJS_REF}/test/plot-schema.json"
- name: Run codegen
run: |
source .venv/bin/activate
python commands.py codegen
- name: Test core (excluding nodev)
run: |
source .venv/bin/activate
pytest -k 'not nodev' tests/test_core

report-failure:
name: Open an issue for a failed scheduled run
needs: test-plotlyjs-dev
# Manual runs can test any plotly.js ref, so only report scheduled runs
if: failure() && github.event_name == 'schedule'
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Open or update the failure issue
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
TITLE: "Weekly plotly.js dev test failed"
run: |
BODY="The weekly test against the plot-schema.json on plotly.js main failed: ${RUN_URL}"
# Comment on an open issue from an earlier failure instead of opening a duplicate
EXISTING=$(gh issue list --state open --search "in:title \"${TITLE}\"" \
--json number,title --jq "map(select(.title == \"${TITLE}\")) | .[0].number // empty")
if [ -n "${EXISTING}" ]; then
gh issue comment "${EXISTING}" --body "${BODY}"
else
gh issue create --title "${TITLE}" --body "${BODY}"
fi
24 changes: 5 additions & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ Steps to update plotly.js:

This command does the following:

- Downloads new versions of `plot-schema.json` and `plotly.min.js` from the [plotly.js GitHub repository](https://github.com/plotly/plotly.js)
- Downloads new versions of `plot-schema.json` and `plotly.min.js` from the [`plotly.js` npm package](https://www.npmjs.com/package/plotly.js)
and places them in `codegen/resources/` and `plotly/package_data/`, respectively.
- Updates `plotly/offline/_plotlyjs_version.py` with the new version
- Regenerates all of the classes under `graph_objs/` (`go.Figure`, `go.Layout`, etc.), and `plotly/validators/_validators.json`, based on the new schema
Expand Down Expand Up @@ -318,23 +318,9 @@ and places them in `codegen/resources/` and `plotly/package_data/`, respectively

7. Add a changelog entry to `CHANGELOG.md` with a link to the PR. We typically mention the version update, link to the plotly.js GitHub release page, and list out the most important changes. Follow the format of previous plotly.js version bump changelog updates.

### Using a Development Branch of Plotly.js
### Using a Development Version of Plotly.js

If your development branch is in [the plotly.js repository](https://github.com/plotly/plotly.js)
you can update to development versions of `plotly.js` with this command:

```bash
python commands.py updateplotlyjsdev --devrepo reponame --devbranch branchname
```

This downloads `dist/plotly.min.js` and `dist/plot-schema.json` from the latest commit of the branch `branchname` of the repo `reponame`.
If `--devrepo` or `--devbranch` are omitted,
`updateplotlyjsdev` defaults to `plotly/plotly.js` and `main` respectively.

### Local Repository

If you have a local repository of `plotly.js` you'd like to try,
you can prepare the package by running the following commands
To test plotly.py against a local repository of `plotly.js`, prepare the package by running the following commands
*in your local plotly.js repository*:

```bash
Expand All @@ -347,7 +333,7 @@ You can then run the following command
*in your local plotly.py repository*:

```bash
python commands.py updateplotlyjsdev --local /path/to/your/plotly.js/
python commands.py updateplotlyjsdev /path/to/your/plotly.js/
```

## Documentation for `commands.py`
Expand All @@ -362,5 +348,5 @@ Usage: `python commands.py <subcommand> <args>`
| `lint` | Lint all Python code in `plotly/`. |
| `format` | Format all Python code in `plotly/`. |
| `updateplotlyjs` | Update `plotly.min.js` and `plot-schema.json` to match the `plotly.js` version specified in `js/package.json`, run codegen to regenerate the Python files, then run `npm install` in `js/` to refresh `js/package-lock.json`. Set `SKIP_NPM=1` to skip the npm step. |
| `updateplotlyjsdev [--devrepo REPONAME --devbranch BRANCHNAME] \| [--local PATH]` | Update `plot-schema.json` and `plotly.min.js` to match the version in the provided plotly.js repo name and branch name, OR local path. Then, run codegen to regenerate the Python files. |
| `updateplotlyjsdev PATH` | Update `plot-schema.json` and `plotly.min.js` from the local plotly.js repository at `PATH`. Then, run codegen to regenerate the Python files. |
| `bumpversion X.Y.Z` | Update the plotly.py version number to X.Y.Z across all files where it needs to be updated. |
Loading
Loading