Skip to content

Commit

Permalink
Skip pip dependencies
Browse files Browse the repository at this point in the history
Remove pip dependencies that were parsed from the environment file;
conda doesn't emit them into an `--explicit` export format since they're
managed by pip in the conda env.

Related to conda#4.
  • Loading branch information
noahp committed May 25, 2020
1 parent 646d071 commit 03aa0cd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion conda_lock/conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,25 @@ def parse_environment_file(environment_file: pathlib.Path) -> Dict:
with environment_file.open("r") as fo:
env_yaml_data = yaml.safe_load(fo)
# TODO: we basically ignore most of the fields for now.
# notable pip deps are not supported
# notable pip deps are just skipped below
specs = env_yaml_data["dependencies"]
channels = env_yaml_data.get("channels", [])

# Split out any sub spec sections from the dependencies mapping
mapping_specs = [x for x in specs if not isinstance(x, str)]
specs = [x for x in specs if isinstance(x, str)]

# Print a warning if there are pip specs in the dependencies
for mapping_spec in mapping_specs:
if "pip" in mapping_spec:
print(
(
"Warning, found pip deps not included in the lock file! You'll need to install "
"them separately"
),
file=sys.stderr,
)

return {"specs": specs, "channels": channels}


Expand Down

0 comments on commit 03aa0cd

Please sign in to comment.