conda / conda-lock

Lightweight lockfile for conda environments
https://conda.github.io/conda-lock/
Other
457 stars 102 forks source link

Feature: provide local additions to grayskull_pypi_mapping.yaml #548

Open tlambert03 opened 7 months ago

tlambert03 commented 7 months ago

Checklist

What is the idea?

Apologies if I've missed this feature in the readme or prior discussion in the issues.

I'm helping someone setup conda-lock with a pyproject.toml setup that includes:

[project.optional-dependencies]
cuda = [
    "cupy-cuda11x ; platform_system != 'Darwin'",
]

naturally, specific cuda builds of of cupy aren't declared on conda as they are on pypi, but grayskull's lookup doesn't (currently) deal with all of those maps.

I know that I can provide my own --pypi_to_conda_lookup_file, but that appears to A) require a URI I can easily pass to requests.get B) presumably requires me to duplicate stuff that I need from grayskull's map?

looking through the source code, there doesn't appear to be any way to append to the lookup.

Why is this needed?

to assist in pypi-to-conda name mapping with minimal duplication

What should happen?

I'm thinking something like:

[tool.conda-lock.pypi-to-conda-name]
cupy-cuda11x = {"conda_name" = "cupy"}

or simpler if no additional info is needed

[tool.conda-lock.pypi-to-conda-name]
cupy-cuda11x = "cupy"
# or multiple packages, as would be useful in the case of cupy
cupy-cuda11x = ["cupy", "cuda-version=11.8"]

Additional Context

No response

maresb commented 7 months ago

Looks sensible! I like the second schema where each package name has a specification given as a string or list of strings.

Would you like to implement it?

tlambert03 commented 7 months ago

i could give it a shot!