Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

pixi add option that takes in input a Python module name instead of conda package name #849

Closed
traversaro opened this issue Feb 24, 2024 · 6 comments
Labels
✨ enhancement Feature request 👩‍💻 cli Issue related to CLI

Comments

@traversaro
Copy link
Contributor

Problem description

A common workflow I am experiencing working with pixi is:

  • Setup a pixi.toml
  • Run stuff
  • Get an error like "ModuleNotFoundError: No module named 'glfw'"
  • Call pixi add <condapkgname>, where <condapkgname> is the conda-forge package that provides the module not found (in case of glfw, it is pyglfw).

It would be cool (but I do not know how feasible) to have a pixi add-pymod or pixi add --pymod command that:

  • Query some kind of database that maps python modules names (not python package names) to conda-forge package names (I think there is something similar at the conda-forge level), and then pixi add the corresponding conda-forge package name.

Probably it is not a feature that can be implemented right away, but I wanted to track this idea somewhere.

Even more futuristic, if cps gets actually adopted by the C++ community, it would be cool to do something similar in C++ with cps package names.

@traversaro traversaro added the ✨ enhancement Feature request label Feb 24, 2024
@ruben-arts
Copy link
Contributor

ruben-arts commented Feb 26, 2024

Interesting idea, we are working on improving conda-python mapping thus this data might be available soon. Not sure if this would fit into pixi directly but would be cool to do a prototype!

@traversaro
Copy link
Contributor Author

Even more futuristic, if cps gets actually adopted by the C++ community, it would be cool to do something similar in C++ with cps package names.

Probably a bit OT, but just to note it somewhere: without going too much in the future with standards that are not even out in alpha, something else quite useful could be a CMake package --> conda package resolver (fyi @AleTarsi).

@ruben-arts
Copy link
Contributor

Ping @wolfv @baszalmstra @nichmor. Do you think this would be easy to add to the pypi-conda mapping tool?

@traversaro
Copy link
Contributor Author

Probably a bit OT, but just to note it somewhere: without going too much in the future with standards that are not even out in alpha, something else quite useful could be a CMake package --> conda package resolver (fyi @AleTarsi).

Again, a bit OT, but just to past in public a comment in a private chat:

A first pass at the CMake mapping is relatively easy. If a conda package provides a -config.cmake file, then it provides the PackageName. If a conda package provides a -config.cmake file, then it provides all possible packages obtained by varying the cases of packagename, i.e. PackageName, PACKAGENAME, PaCkAgEnAmE, etc etc. For the packages provided by Find.cmake scripts in CMake itself, the simplest solution is just hardcoding. For the packages provided by third-party Find.cmake, the solution is hardcoding ot just ignore them.

@ruben-arts ruben-arts added needs-decision Undecided if this should be done 👩‍💻 cli Issue related to CLI labels Feb 29, 2024
@baszalmstra baszalmstra removed the needs-decision Undecided if this should be done label Mar 4, 2024
@ruben-arts
Copy link
Contributor

The CPS feature would be an awesome addition. If that becomes a good standard we would be open to add this as a feature. The python mapping does not include the python module name (miss understanding on my part) so this might require an extra mapping step we're currently not working on. Is there already a opensource mapping for this that anyone knows of?

@traversaro
Copy link
Contributor Author

Is there already a opensource mapping for this that anyone knows of?

I am not an expert of that part of conda-forge, but unless I am missing something it seems that the existing mapping used by grayskull contains both the pypi package name and python module import name, see:

@prefix-dev prefix-dev locked and limited conversation to collaborators Mar 12, 2024
@baszalmstra baszalmstra converted this issue into discussion #958 Mar 12, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
✨ enhancement Feature request 👩‍💻 cli Issue related to CLI
Projects
None yet
Development

No branches or pull requests

3 participants