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

[ENH] - Safer pip integrations #661

Closed
jaimergp opened this issue Nov 14, 2023 · 11 comments
Closed

[ENH] - Safer pip integrations #661

jaimergp opened this issue Nov 14, 2023 · 11 comments
Assignees
Labels
area: dependencies 📦 Issues related to conda-store dependencies area: user experience 👩🏻‍💻 Items impacting the end-user experience needs: more information 📝 More information is needed for triaging project: challenges status: in progress 🏗 type: enhancement 💅🏼

Comments

@jaimergp
Copy link
Member

Feature description

Right now, we have some kind of "extra" checks around pip requirements via the Specification schema, but other than that, we just delegate to conda env.

The idea here is to handle pip packages a bit more safely, as described in this draft.

Then we would modify this block so we only pass the conda deps to conda env, but we handle pip packages separately, as described in the draft.

Something like:

conda_pkgs, pip_pkgs = pkgs_from_environment_yml()
for pip_pkg in pip_pkgs:
   conda_deps, pip_deps = grayskull(pip_pkg, recursive=True)
   conda_pkgs.extend(conda_deps)
   pip_pkgs.extend(pip_deps)
conda_files = files_from_conda_solve(conda_pkgs)
pip_files = files_from_pip_install(pip_pkgs)
if pip_files.intersect(conda_files):
  # warn, or error
if not shared_objects(pip_files):
  # warn, or error
... # maybe other checks
conda_create(conda_pkgs)
pip_install(pip_pkgs)

Value and/or benefit

Safe pip integrations with reduced risk of clobbering and ABI incompatibilities.

Anything else?

This might start as a separate module, or maybe as a different repository.

@jaimergp
Copy link
Member Author

CLI prototype at https://github.com/jaimergp/conda-pip

You can try it out in your base environment with:

$ conda install -nbase grayskull pip
$ pip install https://github.com/jaimergp/conda-pip/archive/main.tar.gz

And then run commands like:

$ conda pip install scipy  # should tell you it will get it from conda
$ conda pip install ragna
Analyzing dependencies: done
conda will install:
 - aiofiles
 - emoji
 - fastapi
 - huey
 - httpx
 - importlib-metadata[version='>=4.6']
 - packaging
 - panel[version='>=1.3,<1.4']
 - pydantic[version='>=2']
 - pydantic-core
 - pydantic-settings[version='>=2']
 - pyjwt
 - python-multipart
 - redis-py
 - questionary
 - rich
 - sqlalchemy[version='>=2']
 - tomlkit
 - typer
 - uvicorn
pip will install:
 - ragna==0.1.1
Proceed ([y]/n)? 
# will run 'conda install' and 'pip install --no-deps', respectively

@dharhas
Copy link
Member

dharhas commented Nov 29, 2023

This is very promising. I like the direction. One longer term issue will be related to the UI. Whether we make pip packages easier to select and how we communicate what has been done under the hood. i.e. should we optionally spit out a new env.yaml with the packages moved to the conda section.

@trallard
Copy link
Collaborator

trallard commented Dec 5, 2023

Perhaps we will need a new yaml for visibility.
If that were the case we should probably add some auto generated header too.

@nkaretnikov nkaretnikov added status: in progress 🏗 needs: more information 📝 More information is needed for triaging labels Dec 13, 2023
@nkaretnikov
Copy link
Contributor

@jaimergp What's the status here? I see this was marked as Ready before.

@nkaretnikov nkaretnikov added area: dependencies 📦 Issues related to conda-store dependencies area: user experience 👩🏻‍💻 Items impacting the end-user experience labels Dec 13, 2023
@jaimergp
Copy link
Member Author

See jaimergp/conda-pip. Still not ready for integration in conda-store, but hoping to make more progress during December.

@jaimergp
Copy link
Member Author

jaimergp commented Apr 24, 2024

Current status:

I guess some documentation could be beneficial here, which I haven't added yet. I plan to do so after getting some consensus on the name of the project (see related issue), but I can do it already if someone on the team wants to test this locally?

@jaimergp
Copy link
Member Author

jaimergp commented May 1, 2024

Renamed to conda-pypi (conda-incubator/conda-pypi#18) and added documentation (conda-incubator/conda-pypi#19).

Useful reads (this is not yet on GH Pages):

@trallard
Copy link
Collaborator

Will close this as it is completed for the purpose of Challenges. And the project has now been moved to https://github.com/conda-incubator/conda-pypi

@dharhas
Copy link
Member

dharhas commented Jun 26, 2024

Is there another issue tracking moving towards using conda-pypi in conda-store to enable safer pip integration?

@trallard
Copy link
Collaborator

No there is not. I suppose @jaimergp @peytondmurray and I could discuss how this would look like and how we'd go about it.

@jaimergp
Copy link
Member Author

jaimergp commented Jul 5, 2024

Opened #845

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dependencies 📦 Issues related to conda-store dependencies area: user experience 👩🏻‍💻 Items impacting the end-user experience needs: more information 📝 More information is needed for triaging project: challenges status: in progress 🏗 type: enhancement 💅🏼
Projects
Archived in project
Development

No branches or pull requests

4 participants