New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow customizing cache location for packages in Node #3967
Conversation
Thanks for proposing this @netroy ! I wasn't part of the discussion in the parent issue, but how about calling this Also BTW micropip still doesn't cache package download in node, and we could re-use this variable there. |
|
Yes, sure Also a bit lower in the code there is,
so shouldn't we also download it into this new folder? Another thing is we should probably create this folder if it doesn't exist? |
hmm, or maybe We can also wait for a third opinion about the name. |
naming is indeed hard, but |
Let's go with it then. |
Done ✅
From what I understand, the package is first downloaded into an But this is only the case when |
The other case is that the user explicitly downloaded from a URL, which can probably be left alone. |
The behavior of this patch is a bit confusing if someone passes |
+1 and also update the docstring accordingly to mention caching and that it's used only in node. |
f0564bf
to
42b7a59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @netroy !
As a followup it would be nice to allow customization of the CDN url that we download the packages from. I think ideally we should have three variables:
cdnURL default:
cachePath default:
Then
|
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
@hoodmane Thanks for the review. I applied your suggestions. |
Thanks again @netroy! |
IMO a more general solution is to use absolute URLs in the |
I think absolute URLs are better when you know exactly where something is going to be hosted, but if we want a pyodide distro to be relocatable then we need to use relative urls. I think it would be good to have some postprocessor in the lockfile CLI that resolves relative urls in the lockfile relative to some base. But this would be an extra step that would mean that the distro has to be served from that particular location. We could deploy a lockfile like this on npm and then if someone wants to load packages from a custom CDN then they would just have to grab a custom lockfile. That makes a lot of sense. But obviously I think the advantage of what I described is that it unifies the logic between in node and not in node. But maybe there is another way to do this. |
@hoodmane @rth Thanks a lot for your time 🙏🏽 Out of curiosity, is there a If there is no release planned, we could try to setup another package on npm, and our own CDN with a custom build, as we don't really want to rush you folks with a release, but we'd also like to avoid shipping with this limitation of not being able to use modules. |
OK but in what case would one want to be relocatable and not put both the core Pyodide files and the packages into the same folder, then set
For node, where Pyodide core is npm installed, I agree it would make sense to be able to specify the |
I guess in any case it would be good to do an 0.24.0a1 alpha release with all the changes currently on main. I can look into it next week, unless someone else does it. |
It might be better to make another backport of this and @gabrielfougeron's reenabled package. But actually I guess the alpha won't have that many new features at this point. It feels like it should be a fat release but actually most of the stuff that I've been working on either hasn't landed or is to external repos or both... One thing that I want to get in before the next release is a rework of the streams API. I realized that Emscripten's TTY API is not very good and we can expose something better than our current interface by not using it. |
Technically it's a new feature, and not ideal to put it in a patch release in case it does break something that worked before (even if it's unlikely). Though I agree it is unfortunate not to be able e.g. update the npm package more easily. Yeah, I would say the fact of releasing an alpha doesn't mean a feature freeze; |
This seems like a very small, backwards compatible change. The only issue that could happen is if someone was already passing
Yeah it's never meant that before. |
No strong opinion about backporting this into a patch release. |
I'm in favor of making an alpha release, but we could consider a backport in addition. Or another thing to consider: I think the current set of features are relatively low impact but I'm planning to add messy stuff soon. Maybe we should make an alpha release now and also branch and plan to make a release with just the current features. Then whenever we get around to it we can make another release. |
Sounds like a plan. Some of the changes around JSPI sound indeed more risky :) Maybe we can wait until next week to branch and see if there is any else small we want to merge by then? Though I guess it can also always be backported later. |
Well I want to start merging these JSPI things. How about we make a next branch, anything we want into next release goes into main, and we can rebase next onto main or merge main into next as appropriate. |
Maybe I should do the stream changes now so we can consider trying to get that in. |
Works for me. |
I am not sure how to change the branch that a PR targets though... |
It's actually easy: |
@ryanking13 we just had a whole discussion about release planning here which you will probably want to read =) |
Cool, thanks for the ping @hoodmane. I am +1 with making the 'next' branch and putting risky things into it. I would like to add my ongoing micropip works including simple API support in the next release so we can experiment with it (e.g. using anaconda.org as an alternative registry)... but I think I don't have much time to work on it until next week. Anyway, it is not a hard blocker so we can release 0.24 if one of you want :) |
This change allows users to customize where wheels are cached in Node. This is important in the context of docker images and other cases where the `node_modules` folder isn't writable.
This change allows users to customize where the
.whl
files are downloaded to.This is important in the context of docker images, but also in cases where the
node_modules
folder isn't writable once the application (that uses pyodide) is shipped.This change is backward-compatible, as
installURL
still defaults toindexURL
.This fixes #3950