Skip to content

Commit

Permalink
Suppress warning during conda-lock install about pip deps
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Nov 10, 2023
1 parent 4912053 commit fcdadc9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions conda_lock/conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ def render_lockfile_for_platform( # noqa: C901
extras: Optional[AbstractSet[str]],
kind: Union[Literal["env"], Literal["explicit"]],
platform: str,
suppress_warning_for_pip_and_explicit: bool = False,
) -> List[str]:
"""
Render lock content into a single-platform lockfile that can be installed
Expand All @@ -588,7 +589,9 @@ def render_lockfile_for_platform( # noqa: C901
Lockfile format (explicit or env)
platform :
Target platform
suppress_warning_for_pip_and_explicit :
When rendering internally for `conda-lock install`, we should suppress
the warning about pip dependencies not being supported by all tools.
"""
lockfile_contents = [
"# Generated by conda-lock.",
Expand Down Expand Up @@ -696,7 +699,7 @@ def sanitize_lockfile_line(line: str) -> str:
]
)

if len(pip_deps) > 0:
if len(pip_deps) > 0 and not suppress_warning_for_pip_and_explicit:
logger.warning(
"WARNING: installation of pip dependencies from explicit lockfiles "
"is only supported by the "
Expand Down Expand Up @@ -1011,6 +1014,7 @@ def _render_lockfile_for_install(
platform=platform,
include_dev_dependencies=include_dev_dependencies,
extras=extras,
suppress_warning_for_pip_and_explicit=True,
)
with temporary_file_with_contents("\n".join(content) + "\n") as path:
yield path
Expand Down

0 comments on commit fcdadc9

Please sign in to comment.