-
Notifications
You must be signed in to change notification settings - Fork 0
Installer plugin demo #6
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
base: main
Are you sure you want to change the base?
Conversation
| print(solved_env.to_yaml(), end="") | ||
|
|
||
| else: | ||
| # Install conda packages |
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.
Installing conda packages does not touch the plugin system.
| "See `conda create --help` for details." | ||
| ) | ||
| file_envs = [] | ||
| for path in args.file: |
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.
Just for the purposes of demoing conda env create and conda create being used (almost) interchangeably.
|
|
||
| def uv_install(prefix: str, specs: list[str], *args, **kwargs) -> dict: | ||
| print("pretending to install stuff with uv") | ||
| for spec in specs: |
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.
clearly not actually implementing an install with uv. It's helpful to have this output for visual confirmation that the right plugins are getting invoked.
| # In this demo, swap the meaning of "pip" and "pypi" | ||
| yield CondaInstaller( | ||
| name="pypi_pip", | ||
| types=("pip","pypi"), |
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.
These types are mapping to the Environment.external_packages dict. The environment.yaml environment spec plugin will put all pip depenencies in the pip key of that dict. This relationship is not well definied. It would be better if it could be more strict.
| super().__post_init__() | ||
|
|
||
| # Configure plugin settings for preferred_installers | ||
| for t in self.types: |
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.
I'm not super confident about how well this works for overlapping plugin types. Needs more testing.
This demo demonstrates using conda installer plugin hooks to make conda install/create/update commands support installing pip packages.
This is achieved by:
Environemnt.external_packagesfield, that is populated by environment spec plugins.<installer_type>_preferred_installerNote, this is just a demo! Lots of the code is ugly and many things are not quite right 💔. Despite that, here are some helpful command to demonstrate this approach:
Consider a conda installation with the following .condarc
Let’s also consider the following tests/env/support/with-pip.yml
conda env createandconda createcommands can be use (almost) interchangeably:Notes: https://docs.google.com/document/d/1ca1jvxV1a82wS-veU3WYwoP9fk6I7DljzjUSB2Y8yZ4/edit?tab=t.0