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

Option to skip selected dependencies #22

Closed
wants to merge 3 commits into from

Conversation

joemarshall
Copy link
Contributor

Many packages include dependencies which are only used in some cases. e.g. I've got some packages which include a load of jupyter server stuff as deps, which can be ignored in pyodide.

This patch lets you skip some dependencies if you don't want to get them, whilst still getting other deps with micropip.

@ryanking13
Copy link
Member

ryanking13 commented Nov 3, 2022

Thanks, @joemarshall! I am a bit undecided about this PR. We have deps option which exists for a similar purpose. But I agree that it would be convenient to have options to ignore specific dependencies if a package has tons of dependencies. So if @rth or @hoodmane is okay with this. I have no objections to merging this.

@rth
Copy link
Member

rth commented Nov 3, 2022

Yes, this would be useful, thanks @joemarshall ! This was also requested by @bollwyvl in point 3 in #16. The only thing I'm not certain is in terms of API whether it would be better to have,

  1. this skip_deps passed to each install call
  2. a API such as micropip.add_noop_package(package_name: str | list[str]) as proposed in the linked issue. Which could be provided once. Later, it could also take as an optional argument whether the package needs to be mocked (in case it's a nonrelevant package but imported somewhere in the dependencies). The name of this function remains to be determined.

WDYT?

@ryanking13
Copy link
Member

ryanking13 commented Nov 4, 2022

add_noop_package API looks good to me, as third-party Pyodide-based application developers can specify packages that can be ignored, and users who use it doesn't have to be aware of what is happening in the background (I think it is why jupyterlite team wants this feature?).

@joemarshall
Copy link
Contributor Author

joemarshall commented Nov 6, 2022

Ooh, that is a super idea. Maybe even add_mock_package, with an option to pass in a module object or leave it for a noop. I'll close this pr.

@joemarshall joemarshall closed this Nov 6, 2022
@joemarshall
Copy link
Contributor Author

I have a neat little class which makes a module from itself, with class members becoming module members, with add_mock_package, I could just chuck those straight into micropip and they'd only get into the sys namespace when micropip install was called on something with them as a dependency

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 this pull request may close these issues.

3 participants