Skip to content

feat(pydeck): register_library(npm=...) loads npm packages as ES modules (experimental) - #10797

Merged
chrisgervang merged 3 commits into
masterfrom
chr/pydeck-register-library-npm
Oct 8, 2026
Merged

chrisgervang merged 3 commits into
masterfrom
chr/pydeck-register-library-npm

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

For #10800

Background

Loading an npm package with #10794 needs an esm.sh URL with a long ?external= list, plus a version that matches pydeck's deck.gl. pydeck now builds that URL, so the shared list lives in one place.

Stacked on #10794. Tracked in #10763.

Change List

  • register_library(npm=...): esm.sh URL with shared packages external
  • @deck.gl-community/* defaults to pydeck's deck.gl minor version
  • Warns when a community version targets another deck.gl
  • name optional with npm; settings.esm_cdn for self-hosted CDNs
  • Test keeps the list in sync with shared-modules.js
  • custom_layers.rst section and CHANGELOG

Verified with pytest and to_html against the #10794 widget build: PathOutlineLayer from npm="@deck.gl-community/layers" renders in Chromium, Firefox and WebKit.


Note

Low Risk
Additive experimental API for custom JS library registration with tests and version warnings; no changes to core rendering or data paths.

Overview
Adds an experimental register_library(npm=...) path so users can load npm packages as ES modules without hand-building esm.sh URLs and ?external= lists.

pydeck now centralizes SHARED_PACKAGES, constructs the CDN URL (default esm_cdn = esm.sh), forces module=True, and defaults the window name to the package name. @deck.gl-community/* packages without a version pin to pydeck’s deck.gl minor; mismatched or unpinned community versions emit UserWarning. uri and npm remain mutually exclusive; name is required only for uri.

Docs in custom_layers.rst and the CHANGELOG replace the manual esm.sh example with the npm API. Tests cover URL shape, warnings, esm_cdn, validation, and parity with shared-modules.js in the Jupyter widget.

Reviewed by Cursor Bugbot for commit f1679c6. Bugbot is set up for automated code reviews on this repo. Configure here.

@coveralls

coveralls commented Oct 4, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 83.409% (-0.02%) from 83.429% — chr/pydeck-register-library-npm into master

@greptile-apps

greptile-apps Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] This PR appears safe to merge based on the reviewed changes.

Summary

This PR adds experimental npm-package registration for pydeck custom libraries. It constructs esm.sh module URLs with shared deck.gl dependencies externalized, selects a matching version for unpinned @deck.gl-community packages, and documents and tests the API. No new actionable issue was identified since the previous review.

Reviews (7) · Last reviewed commit: "fix(pydeck): warn when a deck.gl-communi..." · Reviewed by Greptile

Comment thread bindings/pydeck/docs/CHANGELOG.rst Resolved
Comment thread bindings/pydeck/pydeck/settings.py Resolved
@chrisgervang
chrisgervang force-pushed the chr/pydeck-register-library-npm branch 2 times, most recently from d1bab95 to 20cf000 Compare October 4, 2026 04:57
@chrisgervang

Copy link
Copy Markdown
Collaborator Author

@greptileai re-review

Base automatically changed from chr/jupyter-widget-esm-shared-modules to master October 4, 2026 18:45
@chrisgervang
chrisgervang force-pushed the chr/pydeck-register-library-npm branch from 20cf000 to 8f88d66 Compare October 4, 2026 18:45
@chrisgervang
chrisgervang force-pushed the chr/pydeck-register-library-npm branch from 8f88d66 to 91a42ab Compare October 8, 2026 19:09
@chrisgervang
chrisgervang force-pushed the chr/pydeck-register-library-npm branch from 91a42ab to f1679c6 Compare October 8, 2026 19:21
@chrisgervang
chrisgervang merged commit 3ac870b into master Oct 8, 2026
8 checks passed
@chrisgervang
chrisgervang deleted the chr/pydeck-register-library-npm branch October 8, 2026 19:57
chrisgervang added a commit that referenced this pull request Oct 22, 2026
…les (experimental) (#10797)

* feat(pydeck): register_library(npm=...) loads npm packages as ES modules (experimental)

* docs(pydeck): changelog entry for register_library(npm=...)

* fix(pydeck): warn when a deck.gl-community version does not pin a minor

(cherry picked from commit 3ac870b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants