Comments (6)
So actually, I've been thinking the most natural API for user-serviceable files is:
- drop files in
files/
- some top-level JSON encodes a (nearly) equivalent Contents API response tree
- this could (but doesn't need to) end up in
/ap/contents
(maybe as some well-known file,__jupyterlite_contents.json
) which can pre-seed the contents manager
- this could (but doesn't need to) end up in
- the contents manager is adjusted to be copy-to-localStorage-on-write
- load time is already going to be brutal, adding the actual contents will exacerbate the matter
from jupyterlite.
This would also be useful when providing kernel resources such as logos, which are for now manually placed in https://github.com/jtpio/jupyterlite/tree/main/app/kernelspecs
from jupyterlite.
Been thinking about this more while fiddling with #48: the approach in jyve was to get the stuff into package.json
and having a custom key, and I feel this approach is worth considering.
The package.json
will always be part of an npm package, and is still consumable by other languages (a la #41). A critical thing to add would be a schema to keep multiple implementations honest... it seems like mirroring the api routes as closely as possible probably makes the most sense... but some special notation will be required as we're talking about:
- in-line JSON fragments
- individual files
- lists of files
For things like pyodide wasm, it's a little murkier: in a traditional server-backed setup, these would just be !url-loader
or !file-loader
d in, and then served from the share/labextensions
path.
Similarly, being able to specify files
(a la #30) would also have enough information to drive contents without storing the base64-encoded JSON...
so, perhaps:
"jupyterlite": {
"routes": {
"/api/kernelspecs#/kernelspecs/pyodide": {
# the actual kernelspec
},
"/api/kernelspecs/pyodide/logo-32x32.png": "style/logo-32x32.png", # an implicit path
"/static/labextensions/@jupyterlite/pyodide-kernel/": [{ # a "mount point"
"path": "pyodide-dist",
"files": ["pandas.data", "pandas.wasm"] # etc. globs are... hard
}],
"/files/examples/": [{
"path": "docs",
"files": ["pyodide.ipynb"]
}]
}
}
in webpack land, these could be interepreted, potentially with that asset plugin, but there's also enough data here to do good things without it.
as a publisher, one could then disable particular routes if they didn't want them by configuring their .jupyterlite
file (which actually could be a valid package.json
, i guess, as it has pretty good metadata already... just no scripts
please!)
from jupyterlite.
Other things to consider:
- renaming files which are then persisted in local storage: should the content under
files
be downloaded again on the next page reload - distinction between writable and read-only data
from jupyterlite.
@jtpio do we basically have this now, or is there more to do? I feel like the only things that are special anymore are kernel icons... and p5 takes care of itself somehow without that, so maybe we just need a new issue/rename this issue just for that task.
from jupyterlite.
I think so yes.
For example p5 ships its own logo here: https://github.com/jupyterlite/p5-kernel/blob/212453c5d0ea35552f142fe2f779d4568a303192/packages/p5-kernel-extension/src/index.ts#L15
Xeus-based kernels also bring their own files (workers, glue js code).
So let's close this issue. Thanks for bringing that up!
from jupyterlite.
Related Issues (20)
- Collapsable cells HOT 2
- string saved to file has last part repeated (sometimes) HOT 2
- rendering cell output different from rendering same in file (unwrapped, directly in browser) HOT 3
- Widgets don't work with `display(...)`, and instead only appear as `repr(...)` text unless `jupyterlab_server` is installed before `lite build`, but there's no indication it's a requirement HOT 4
- Some extensions cannot be disabled using `disabledExtensions` HOT 3
- Pyodide crashes when starting two pyodide kernels at the same time in Chrome HOT 7
- Allow to pre-populate the REPL prompt without executing the code
- Deploying in environments with credentials HOT 1
- Pressing "Restart and run all cells" randomly causes silent pyodide kernel crash HOT 2
- Pyodide becomes irresponsive after a few ipywidgets interactions HOT 5
- Explicit index.html dropped from path in notebook ToC links
- Delete current notebook option from notebook File menu HOT 1
- ipywidgets Installation issue HOT 1
- DriveFS cannot overwrite-truncate existing file HOT 1
- Add a noscript tag to the page with "js must be enabled" ?
- Fix workflow to update the playwright snapshots HOT 1
- Unable to create a New Notebook HOT 1
- Update to JupyterLab 4.3 and Notebook 7.3
- extra_http_headers work with _serve_tornado but not _serve_stdlib HOT 4
- pygame-ce HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jupyterlite.