Skip to content

Commit 98ef520

Browse files
authored
Merge branch 'main' into feature-5362
2 parents 002754f + dc6c302 commit 98ef520

21 files changed

Lines changed: 748 additions & 1271 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1212
- Fix issue where user-specified `color_continuous_scale` was ignored when template had `autocolorscale=True` [[#5439](https://github.com/plotly/plotly.py/pull/5439)], with thanks to @antonymilne for the contribution!
1313
- Use presence of `COLAB_NOTEBOOK_ID` env var to enable Colab renderer instead of testing import of `google.colab` [[#5473](https://github.com/plotly/plotly.py/pull/5473)], with thanks to @kevineger for the contribution!
1414
- Update tests to be compatible with numpy 2.4 [[#5522](https://github.com/plotly/plotly.py/pull/5522)], with thanks to @thunze for the contribution!
15+
- Add default headers to be passed in to Kaleido v1.3.0 to avoid blocked Open Street Map tiles [#5588](https://github.com/plotly/plotly.py/pull/5588)]
1516

1617
### Updated
1718
- The `__eq__` method for `graph_objects` classes now returns `NotImplemented` to give the other operand an opportunity to handle the comparison [[#5547](https://github.com/plotly/plotly.py/pull/5547)], with thanks to @RazerM for the contribution!

RELEASE.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ Once these are verified working, you can move on to publishing the release.
110110

111111
### Publishing to PyPI
112112

113-
The final step is to publish the release to PyPI. **You will need special permissions from Plotly leadership to do this.**.
113+
The final step is to publish the release to PyPI. **You will need special permissions from Plotly leadership to do this.**
114114

115-
You must install first install [Twine](https://pypi.org/project/twine/) (`pip install twine`) if not already installed.
115+
You must first install [Twine](https://pypi.org/project/twine/) (`pip install twine`) if not already installed.
116116

117117
Publishing to PyPI:
118118
```bash
@@ -132,10 +132,21 @@ Your account must have permissions to publish to the `plotly` project on PyPI.
132132
start by doing it first if not. Then merge `main` into `doc-prod` to deploy the doc related
133133
to features in the release.
134134
3. in a clone of the [`graphing-library-docs` repo](https://github.com/plotly/graphing-library-docs):
135-
1. bump the version of plotly.py in `_data/pyversion.json`
135+
1. bump the version of plotly.py in `_data/pyversion.json`
136136
2. bump the version of plotly.js with `cd _data && python get_plotschema.py <PLOTLY.JS VERSION>` fixing any errors that come up.
137-
- If plotly.js contains any new traces or trace or layout attributes, you'll get a warning `“missing key in attributes: <attribute-name>`. To resolve, add the attribute to the relevant section in `/_data/orderings.json` in the position you want it to appear in the reference docs.
138-
3. rebuild the Algolia `schema` index with `ALGOLIA_API_KEY=<key> make update_ref_search`
137+
138+
**About `_data/orderings.json`:** `get_plotschema.py` downloads the raw `plot-schema.json` from the specified plotly.js release and uses `_data/orderings.json` (which lives in `graphing-library-docs`, not plotly.js) to determine the order in which traces, trace attributes, and layout attributes appear in the [reference documentation](https://plotly.com/python/reference/). The file has three sections:
139+
- `layout` — top-level layout attributes (e.g. `hovermode`, `clickmode`, `xaxis`)
140+
- `traces` — order of trace types (e.g. `scatter`, `bar`, `pie`)
141+
- `trace_attr_order` — order of attributes shared across traces
142+
143+
If plotly.js adds new traces or trace/layout attributes that aren't listed in `orderings.json`, `get_plotschema.py` prints a warning like `missing key in attributes: <attribute-name>` and appends the missing entry to the end of its section. To resolve:
144+
145+
- Add each missing attribute to the appropriate section of `/_data/orderings.json` in the position you want it to appear in the reference docs.
146+
- When in doubt about trace-attribute placement, match plotly.js's native order: open the regenerated `_data/plotschema.json` and find where plotly.js itself places the attribute (e.g. inspect a representative trace's `attributes` keys in order). Following the native order keeps related attributes grouped (for example, `texttemplate``texttemplatefallback``texttemplatesrc`).
147+
- For new top-level layout attributes, group them with semantically related entries rather than appending to the end (for example, a new click-behavior attribute like `clickanywhere` belongs next to `clickmode`).
148+
- Re-run `python get_plotschema.py <PLOTLY.JS VERSION>` after editing `orderings.json` and confirm the warnings are gone.
149+
3. Rebuild the Algolia `schema` index with `ALGOLIA_API_KEY=<key> make update_ref_search`
139150
4. Rebuild the Algolia `python` index with `ALGOLIA_API_KEY=<key> make update_python_search`
140151
5. Commit and push the changes to `master` in that repo
141152

@@ -158,5 +169,5 @@ PyPI RC (no special flags, just the `rc1` suffix):
158169
(plotly_dev) $ twine upload dist/plotly-X.Y.Zrc1*
159170
```
160171

161-
The `--tag next` part ensures that users won't install this version unless
162-
they explicitly ask for the version or for the version with the `next` tag.
172+
The `rc1` suffix ensures that users won't install this version by default —
173+
they must explicitly request it (e.g., `pip install plotly==X.Y.Zrc1`).

commands.py

Lines changed: 21 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -149,34 +149,20 @@ def overwrite_plotlyjs_version_file(plotlyjs_version):
149149
)
150150

151151

152-
def request_json(url):
153-
"""Get JSON data from a URL."""
152+
def get_latest_commit_info(repo, branch):
153+
"""Get latest commit info from GitHub API."""
154154

155+
url = "https://api.github.com/repos/{repo}/commits/{branch}".format(
156+
repo=repo, branch=branch
157+
)
155158
req = requests.get(url)
156-
return json.loads(req.content.decode("utf-8"))
157-
158-
159-
def get_latest_publish_build_info(repo, branch):
160-
"""Get build info from Circle CI."""
161-
162-
url = (
163-
r"https://circleci.com/api/v1.1/project/github/"
164-
r"{repo}/tree/{branch}?limit=100&filter=completed"
165-
).format(repo=repo, branch=branch)
166-
167-
branch_jobs = request_json(url)
168-
169-
# Get most recent successful publish build for branch
170-
builds = [
171-
j
172-
for j in branch_jobs
173-
if j.get("workflows", {}).get("job_name", None) == "publish-dist"
174-
and j.get("status", None) == "success"
175-
]
176-
build = builds[0]
159+
assert req.status_code == 200, "Failed to fetch commit info: %s" % req.text
160+
commit = req.json()
177161

178-
# Extract build info
179-
return {p: build[p] for p in ["vcs_revision", "build_num", "committer_date"]}
162+
return {
163+
"vcs_revision": commit["sha"],
164+
"committer_date": commit["commit"]["committer"]["date"],
165+
}
180166

181167

182168
def get_bundle_schema_local(local):
@@ -188,29 +174,15 @@ def get_bundle_schema_local(local):
188174
return plotly_archive, plotly_bundle, plotly_schemas
189175

190176

191-
def get_bundle_schema_urls(build_num):
192-
"""Get URLs for required files."""
193-
194-
url = (
195-
"https://circleci.com/api/v1.1/project/github/"
196-
"plotly/plotly.js/{build_num}/artifacts"
197-
).format(build_num=build_num)
198-
199-
artifacts = request_json(url)
200-
201-
# Find archive
202-
archives = [a for a in artifacts if a.get("path", None) == "plotly.js.tgz"]
203-
archive = archives[0]
204-
205-
# Find bundle
206-
bundles = [a for a in artifacts if a.get("path", None) == "dist/plotly.min.js"]
207-
bundle = bundles[0]
177+
def get_github_urls(repo, revision):
178+
"""Get URLs for required files from GitHub."""
208179

209-
# Find schema
210-
schemas = [a for a in artifacts if a.get("path", None) == "dist/plot-schema.json"]
211-
schema = schemas[0]
180+
raw = f"https://raw.githubusercontent.com/{repo}/{revision}"
181+
archive_url = f"https://github.com/{repo}/tarball/{revision}"
182+
bundle_url = raw + "/dist/plotly.min.js"
183+
schema_url = raw + "/dist/plot-schema.json"
212184

213-
return archive["url"], bundle["url"], schema["url"]
185+
return archive_url, bundle_url, schema_url
214186

215187

216188
def update_schema(plotly_js_version):
@@ -249,9 +221,9 @@ def update_plotlyjs(plotly_js_version, outdir):
249221
def update_schema_bundle_from_master(args):
250222
"""Update the plotly.js schema and bundle from master."""
251223
if args.local is None:
252-
build_info = get_latest_publish_build_info(args.devrepo, args.devbranch)
253-
archive_url, bundle_url, schema_url = get_bundle_schema_urls(
254-
build_info["build_num"]
224+
build_info = get_latest_commit_info(args.devrepo, args.devbranch)
225+
archive_url, bundle_url, schema_url = get_github_urls(
226+
args.devrepo, build_info["vcs_revision"]
255227
)
256228

257229
# Update bundle in package data

dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "uv"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
cooldown:
9+
default-days: 3 # Should match tool.uv.exclude-newer option in pyproject.toml

0 commit comments

Comments
 (0)