从 git 安装时,我可以强制 pip 进行浅结帐吗?

Mar*_*oma 8 python git pip

以下命令从 git 存储库安装 Python 包:

$ pip install git+ssh://git@github.com/username/repo.git
Collecting git+ssh://git@github.com/username/repo.git
  Cloning ssh://git@github.com/username/repo.git to /tmp/pip-req-build-8s4nci15
Run Code Online (Sandbox Code Playgroud)

我不是 100% 确定,但由于它需要很长时间,我猜它会克隆每个提交。但是对于安装,我只需要最新的。

相反,我想要一个浅克隆(带有--depth 1)。那可能吗?

Chr*_*ris 6

添加--depth 1git clone命令已经被详细讨论过,暂时被pip的维护者拒绝。这似乎是一个比人们想象更复杂的问题,特别是因为它会破坏setuptools_scm广泛使用的问题。

正如克劳斯在评论中所说,您可以git clone通过指向远程存档文件来避免开销而不是使用 Git URL:

pip install http://my.package.repo/SomePackage-1.0.4.zip
Run Code Online (Sandbox Code Playgroud)