widgetti / widgetti/ipyvuetify
lazy loading heavyweight dependencies in lab
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 355
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Description
thanks for ipyvuetify!
Problem
The core ipyvuetify bundles are very large (~1.8mb), and appear to block the load of the Lab application (e.g. when the "three moon" animation starts)... this is better than the bad old days where it would just make webpack fail, but still not a great experience.
Motivation
Over on jupyterlite, we've been tightening up the performance story, and use our docs site as a stress test. We include ipyvuetify, we've shaved off enough from the core that we're now starting to see extensions in our top-five blockers.
Proposed Solution
A quick fix for this is to use a lazy loading approach for the exports key. Basically, this would move the import of index.js into an async function, along with the theme side-effect. It may also require changing some webpack settings.
The one challenge is getting the version, which can't be lazy loaded: it may be sensible to split that, or accept having it captured in two places and adding a test to keep them in sync.
The bottom line trade will be a slight delay when the first widget this package provides is rendered, which is usually far less noticeable, as it's less likely the browser will be loading much else other than some websocket messages, vs start up time when likely hundreds of files are vying for a spot in the loading queue.
Related
Here's some prior art for adopting this approach from core, and other heavyweight plugins:
- https://github.com/jupyter-widgets/ipywidgets/blob/fbdbd005da4dc58994704f39bcc19a40bbecdec5/python/jupyterlab_widgets/src/plugin.ts#L301
- https://github.com/bqplot/bqplot/pull/1192
- https://github.com/jupyter-widgets/pythreejs/pull/297
- https://github.com/plotly/plotly.py/blob/master/packages/javascript/jupyterlab-plotly/src/jupyterlab-plugin.ts#L19
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in js/src/labplugin.js at the exports key, then compare the lazy-loading patterns in the linked ipywidgets, bqplot, pythreejs, and plotly examples. Check how index.js, the theme side effect, version handling, and webpack settings interact. Done means heavyweight widget code loads on first use without blocking Lab startup, with version consistency covered by a test if it is duplicated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, webpack
- Domain
- build-system, frontend, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100