var*_*tec 4 python pip python-wheel
我想pip
从我的驾驶室安装轮子,当且仅当轮子从驾驶室丢失时才回退到 PyPI(通过缓存代理)。
我试图通过调用来实现此目的
pip install -U --index-url $PYPI_PROXY_URL --find-links $WHEELHOUSE_URL \
-r requirements.txt
Run Code Online (Sandbox Code Playgroud)
然而,它并没有确定从哪里获取包,而是从代理的 PyPI 或驾驶室中获取包的来源似乎相当随机,尽管驾驶室拥有所有必需的包。
我希望这是确定性的,并且始终首先选择驾驶室。我怎样才能做到这一点pip
?
我知道--no-index
会强制它仅使用驾驶室,但我想保留对驾驶室丢失的包裹进行后备的能力。
深入研究 pip 的源代码我发现:
使用内部函数对有效候选者进行排序_candidate_sort_key
,其工作原理如下:
Run Code Online (Sandbox Code Playgroud)If not finding wheels, then sorted by version only. If finding wheels, then the sort order is by version, then: 1. existing installs 2. wheels ordered via Wheel.support_index_min(self.valid_tags) 3. source archives Note: it was considered to embed this logic into the Link comparison operators, but then different sdist links with the same version, would have to be considered equal
在其他条件相同的情况下,它会退回到硬编码顺序:
从 pip 9.0.1 开始,上述顺序是硬编码的,因此无法使用设置或参数来更改它。
归档时间: |
|
查看次数: |
1050 次 |
最近记录: |