Metropolis
Metropolis

Reputation: 2128

Pin a version number of git revision with pip install --target

I have two Python projects in separate repos, say: common and depends_on_common.

Due to the constraints of our deployment environment (I do not have ssh access), I'm hoping to use

pip install --no-deps --target common /path/to/common

as part of a CI/CD build stage to vendor common in depends_on_common. What I'd like to do is to specify an explicit version of common, or a git revision instead of effectively always building off of snapshot.

There is no mention of this capability in the docs:

-t, --target <dir>
  Install packages into <dir>. By default this will not replace existing files/folders in <dir>. Use --upgrade to replace existing packages in <dir> with new versions.

but I was hoping there was some clever way to enable this.

Upvotes: 0

Views: 402

Answers (1)

sinoroc
sinoroc

Reputation: 22295

Maybe this section of the pip install documentation can put you in the right direction.

You probably want something like this:

pip install --no-deps --target ./common git+file:///path/to/common@da39a3ee5e6b4b0d3255bfef95601890afd80709#egg=common

Upvotes: 1

Related Questions