A proposal to improve PyScript packages
#2381
Replies: 4 comments 5 replies
-
|
forgot to mention |
Beta Was this translation helpful? Give feedback.
-
Minutes from today meeting@fpliger raised a valid concern such as:
@WebReflection myself followed up with a similar concern:
|
Beta Was this translation helpful? Give feedback.
-
|
just a quick note about #2291 and whether this helps resolve the "overload a useless dependency" issue (as a suggested solution to that issue) |
Beta Was this translation helpful? Give feedback.
-
|
In today community call https://youtu.be/ZOIszze1Y3s?si=KYQ3Zmokm5xKi0u7&t=553 I've demoed a PoC of the part of the proposal that fetches remote packages and "is just works" 🥳 ... the link pin-points to my demo, have a look if you'd like to understand what I was after in here 👋 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Our current
config.toml(or.json) offers definition of bothpackagesand files but it became obvious, over time, that a lot of projects using[files]are meant to bring in "custom packages".Not only the question around GitHub integration came up in various occasions, the reason for such question was almost always around the fact people would like to rather host their "custom packages" elsewhere, and these are the most common/obvious reasons:
.whlsuffixed remote packages, yet we haven't documented, explained, or provided, a way to create such packagesProposal
As opposed to asking everyone to update each file for each cloned/forked version of the original project, we could extend with relative ease the
packageslist of dependencies itself:.whl, we import that remote package in both Pyodide/MicroPython assuming it's a Pure Python module that "just works".zip,.tar.gzor.tgz, we fetch that remote file at runtime and extract its content within the Virtual FileSystem automatically.tomlor.json, we merge that remote config resolving its own[files]definition accordingly with the original fully qualified URLAbout Disambiguation
The current
[files]directive places sources within the Virtual FileSystem (VFS from now on) and it's already extracting.zipand.tar.gzfiles automatically but that's some DX stretch we backed into the config logic.Arguably, it's not clear if anyone actually needs to truly deliver a compressed asset, why we would do that, while when it's intent comes from the
packageslist, it's clear that MUST be done in order to allow such package to work.On the other side, if
packagescontains something like.tomlor.jsonfiles from a URL, it's obvious that's about a foreign config that should provide all information needed to bring in such module, so that forks will fetch at runtime that config and understand what to do without guessing.The config format
I believe it would be silly to reinvent the wheel here, so that I hope we agree that using exact same format we have for PyScript's configs would be lovely.
My thinking is that a foreign package would contain at least these fields:
As the Web cannot crawl remote folders, and because we already have a way to relatively bind files, assuming that packages entry was
https://remote-website.com/module/config.toml:the_package_namefolderthe_package_name/__init__.pythe_package_name/logic.pythe_package_name/extra/__init__.pythe_package_name/extra/logic.pyjs_modules.mainorjs_modules.workerwithin the current configDoing it this way, if a project contains the following config
The final running code could:
and no error would be shown.
Benefits
This approach would solve and answer the following requirements / questions:
raw.github...url that points at that project config. This way nobody needs to use CLI to create.whl,.zipor other archives, this way every single forked project will automatically keep up with latest versionAnd that's all folks, I am looking forward to discuss any gotcha, hint, improvement, idea around this topic, but I think this (at least intermediate) step would improve by far foreign packages integration, sharing of PyScript projects that are well maintained and whatnot 👋
Beta Was this translation helpful? Give feedback.
All reactions