Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable extending conda deps in new implementation #1567

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion metaflow/metaflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,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 @@ -195,22 +196,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 @@ -252,12 +249,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
Loading