Is it possible to have conditional pypi indexes? A...
# general
h
Is it possible to have conditional pypi indexes? An example case for this is say a subset of our projects use private packages and hence need to pull from a private pypi repo. Ideally, the setup/auth required for doing so could be skipped if not needed i.e. if only touching parts of the dependency graph that use public packages. This would be especially useful for things like
gcloud auth
that I’m currently solving with a
.pants.bootstrap
step but this depends on the
gcloud
cli being available as well as the correct user auth. Skipping this where possible would improve builds times and reduce confusing errors when they’re not available.
c
So you want to have -- for example -- one resolve that uses the public PyPi, and another that uses an internal one?
h
Essentially yes, this would be half solved by the Pex lockfile assigning sources to packages, but doesn’t solve the ability to skip pre-pants steps such as commands inside the .pants.bootstrap script. i.e. I only want to have to worry about having the
gcloud-cli
available as well as running it in said script if I need to for an index related to a target
c
I don't think there is a straightforward way to do that today because https://www.pantsbuild.org/2.26/reference/subsystems/python-repos#indexes is global. You could maybe do something like: • set index A, generate lockfile • set index B, generate other lockfile • leave index as [] • run your stuff and see if it works That would be annoying to manage, but that might help shed light on if moving index to be a per resolve field would be viable or a ball of yarn