conda-lock icon indicating copy to clipboard operation
conda-lock copied to clipboard

Exclude some dependencies from lock

Open olivier-lacroix opened this issue 2 years ago • 4 comments

Hello,

It would be useful (to me at least) to be able to exclude / discard some dependencies read from input files. For instance, when the package depends on local dependencies, or packages in private pypi repositories (for cases not supported currently), etc..

This could be achieved by either:

  • having an --exclude cli argument taking a list of packages to exclude from the spec
  • having a way to mark a package as excluded, for instance in the [tool.conda-lock.dependencies] section of pyproject.toml

What do you think?

olivier-lacroix avatar Oct 20 '22 02:10 olivier-lacroix

This seems to me like an interesting idea, but I wonder if it could be achieved more simply by using multiple environment specifications (using --file multiple times). Could you please provide some more details about your use case?

maresb avatar Oct 20 '22 16:10 maresb

Hi @maresb! I use conda-lock to build a lock file from pyproject.toml file(s). Some of the core dependencies listed cannot be resolved by conda-lock (e.g. private repositories). I would like to be able to capture as much as possible in the lock file, then install “manually” the packages which cannot. Currently I do this by commenting out the offending dependencies in the pyproject files, but this is a bit tedious :-).

olivier-lacroix avatar Oct 20 '22 21:10 olivier-lacroix

Thanks @olivier-lacroix for the extra info! That clarifies a lot. I agree that an exclude option would make sense here. What do you think @mariusvniekerk?

(A side-thought: another way to split groups of dependencies is by having multiple requirements.txt files, so it might be interesting to offer requirements files as lockfile sources, but unfortunately requirements files aren't standardized between build-backends, so probably this isn't a very general solution.)

maresb avatar Oct 21 '22 02:10 maresb

I would greatly appreciate this feature due to a project I'm working on requiring local dependencies

I think allowing a exclude option in the keys under [tool.conda-lock.dependencies] alongside the existing "source = 'pypi" would be great as a catch-all "this package can't be found anywhere" option

I am working on a small PR for this

alchzh avatar Dec 21 '22 05:12 alchzh