Skip to content
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

Maybe provide a parameter to avoid browser caching for PyPI resolution requests #122

Open
CNSeniorious000 opened this issue Jul 19, 2024 · 5 comments · May be fixed by #125
Open

Maybe provide a parameter to avoid browser caching for PyPI resolution requests #122

CNSeniorious000 opened this issue Jul 19, 2024 · 5 comments · May be fixed by #125

Comments

@CNSeniorious000
Copy link
Member

CNSeniorious000 commented Jul 19, 2024

Currently micropip passes a kwargs to pyfetch during resolution.

fetch_kwargs=fetch_kwargs,

I think it is reasonable to add a no_cache parameter to install command or the Transaction class to skip browser caching. Currently it is not possible to skip browser caching for PyPI simple API calls.

Use case: upgrading a previously installed package

@ryanking13
Copy link
Member

Thanks @CNSeniorious000! I can think of two ways to implement this.

  1. adding a cache parameter as you suggest.
  2. adding a headers parameter that users can pass arbitrary request headers when calling fetch. For instance, people can do headers={'cache': 'no-store'} or headers={'cache': "no-cache"} to pass cache-related parameters.

The second option would provide more flexibility, but it would also leak the internal implementation of micropip.install. WDYT?

@CNSeniorious000
Copy link
Member Author

CNSeniorious000 commented Jul 20, 2024

But cache: "no-cache" parameter is fetch's kwargs instead of the headers. Do you mean exposing a **fetch_kwargs in micropip.install?

And then here we don't need to init the fetch_kwargs with an empty dict:

fetch_kwargs = dict()

@ryanking13
Copy link
Member

Oh yes, fetch_kwargs is what I meant, not headers.

@CNSeniorious000
Copy link
Member Author

One more question. If I specify cache='no-cache' in **fetch_kwargs, both the resolution step and the downloading step will skip the cache. But I think whl urls should be fetched with force-cache instead. Is there a way to allow customizing the two fetch kwargs separately?

@ryanking13
Copy link
Member

Is there a way to allow customizing the two fetch kwargs separately?

I don't think we have such an option now, but I think it is reasonable. This may be something that we need to consider when re-designing the micropip module (#112) cc: @RulerOfCakes

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 a pull request may close this issue.

2 participants