Skip to content

Commit

Permalink
Revert "inject keyrings.google-artifactregistry-auth for private GCP …
Browse files Browse the repository at this point in the history
…PyPi reg…" (#1779)

This reverts commit 208897c.
  • Loading branch information
madhur-ob authored Mar 27, 2024
1 parent 208897c commit 9ced231
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 27 deletions.
26 changes: 9 additions & 17 deletions metaflow/plugins/pypi/conda_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,16 @@ def get_environment(self, step):
)
# 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 = get_pinned_conda_libs(env_python, self.datastore_type)

# PyPI dependencies are prioritized over Conda dependencies.
environment.get("pypi", environment["conda"])["packages"] = {
**pinned_packages,
**environment.get("pypi", environment["conda"])["packages"],
}
# Disallow specifying both @conda and @pypi together for now. Mixing Conda
# and PyPI packages comes with a lot of operational pain that we can handle
# as follow-up work in the future.
Expand All @@ -245,14 +254,6 @@ def get_environment(self, step):
msg += "step is not yet supported. Use one of @pypi or @conda only."
raise CondaEnvironmentException(msg)

# Certain packages are required for metaflow runtime to function correctly.
pinned_packages = get_pinned_conda_libs(env_python, self.datastore_type)

environment["conda"]["packages"] = {
**pinned_packages,
**environment["conda"]["packages"],
}

# To support cross-platform environments, these invariants are maintained
# 1. Conda packages are resolved for target platforms
# 2. Conda packages are resolved for local platform only for PyPI packages
Expand Down Expand Up @@ -281,15 +282,6 @@ def get_environment(self, step):
# Match PyPI and Conda python versions with the resolved environment Python.
environment["pypi"]["python"] = environment["conda"]["python"] = env_python

# we could have added `keyrings.google-artifactregistry-auth` in `get_pinned_conda_libs`
# but then, it would be applied to every step, while we only add it where the `pypi`
# decorator is being used..
if os.getenv("GOOGLE_APPLICATION_CREDENTIALS"):
environment["conda"]["packages"] = {
**environment["conda"]["packages"],
"keyrings.google-artifactregistry-auth": ">=1.1.1",
}

# Z combinator for a recursive lambda
deep_sort = (lambda f: f(f))(
lambda f: lambda obj: (
Expand Down
11 changes: 1 addition & 10 deletions metaflow/plugins/pypi/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,6 @@ def indices(self, prefix):
return index, extras

def _call(self, prefix, args, env=None, isolated=True):
# `--no-input` flag should not be passed when credentials
# are being determined for the index-url and are not a
# part of it..
# TODO: we need a better way to handle this
if os.getenv("GOOGLE_APPLICATION_CREDENTIALS"):
no_input = False
else:
no_input = True

if env is None:
env = {}
try:
Expand All @@ -279,9 +270,9 @@ def _call(self, prefix, args, env=None, isolated=True):
prefix,
"pip3",
"--disable-pip-version-check",
"--no-input",
"--no-color",
]
+ (["--no-input"] if no_input else [])
+ (["--isolated"] if isolated else [])
+ args,
stderr=subprocess.PIPE,
Expand Down

0 comments on commit 9ced231

Please sign in to comment.