Skip to content

Commit

Permalink
go back to using get_pinned_conda_libs as a source for conda dependen…
Browse files Browse the repository at this point in the history
…cies. (#1567)
  • Loading branch information
saikonen authored Oct 9, 2023
1 parent f165ea3 commit f52d03d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
1 change: 0 additions & 1 deletion metaflow/metaflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ def get_version(pkg):
return pkg_resources.get_distribution(pkg).version


# TODO: This is no longer in use and can be dispensed with.
# PINNED_CONDA_LIBS are the libraries that metaflow depends on for execution
# and are needed within a conda environment
def get_pinned_conda_libs(python_version, datastore_type):
Expand Down
27 changes: 10 additions & 17 deletions metaflow/plugins/pypi/conda_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import requests

from metaflow.metaflow_config import get_pinned_conda_libs
from metaflow.exception import MetaflowException
from metaflow.metaflow_environment import MetaflowEnvironment
from metaflow.metaflow_profile import profile
Expand Down Expand Up @@ -196,22 +197,18 @@ def get_environment(self, step):
}
else:
return {}
# Resolve conda environment for @pypi's Python, falling back on @conda's
# Python
env_python = (
environment.get("pypi", environment["conda"]).get("python")
or environment["conda"]["python"]
)
# TODO: Support dependencies for `--metadata`.
# TODO: Introduce support for `--telemetry` as a follow up.
# Certain packages are required for metaflow runtime to function correctly.
# Ensure these packages are available both in Conda channels and PyPI
# repostories.
pinned_packages = {"requests": ">=2.21.0"}
if self.datastore_type == "s3":
pinned_packages.update({"boto3": ">=1.14.0"})
elif self.datastore_type == "azure":
pinned_packages.update(
{"azure-identity": ">=1.10.0", "azure-storage-blob": ">=12.12.0"}
)
elif self.datastore_type == "gs":
pinned_packages.update(
{"google-cloud-storage": ">=2.5.0", "google-auth": ">=2.11.0"}
)
pinned_packages = get_pinned_conda_libs(env_python, self.datastore_type)

# PyPI dependencies are prioritized over Conda dependencies.
environment.get("pypi", environment["conda"])["packages"] = {
Expand Down Expand Up @@ -253,12 +250,8 @@ def get_environment(self, step):
{target_platform, conda_platform()}
)
environment["pypi"]["platforms"] = [target_platform]
# Resolve conda environment for @pypi's Python, falling back on @conda's
# Python
environment["pypi"]["python"] = environment["conda"]["python"] = (
environment["pypi"].get("python", environment["conda"]["python"])
or environment["conda"]["python"]
)
# Match PyPI and Conda python versions with the resolved environment Python.
environment["pypi"]["python"] = environment["conda"]["python"] = env_python

# Z combinator for a recursive lambda
deep_sort = (lambda f: f(f))(
Expand Down

0 comments on commit f52d03d

Please sign in to comment.