我想在conda构建配方中获得meta.yaml的sdist url。它需要从URL获取特定版本或最新版本。当我使用针对CI/CD的Github操作时,我需要自动检索特定版本或最新版本的源链接。
现在链接是这样的:https://files.pythonhosted.org/packages/40/e7/sha-256-of-file/file,我需要一些可靠的东西,比如https://hosting/package/release/file
我需要知道一种更可靠的方法来检索特定版本的最新sdist或sdist。有什么办法吗?还是我要换一条路?
到目前为止,这个问题并不适用于我,因为我不想在python中安装它。我需要它包括在meta.yaml配方的conda-build。
meta.yaml看起来是这样的:
{% set version = "0.1.1rc3" %}
package:
name: blablablah
version: {{ version }}
source:
url:
sha256: f3832918bc3c66617f92e35f5d70729187676313caa60c187eb0f28b8fe5e3b5
build:
noarch: python
number: 0
script: python -m pip install --no-deps --ignore-installed .
requirements:
host:
- python
- pip
- numpy==1.16.5
- cython
run:
- python
test:
imports:
- blablablah
about:
here are information about the package我不知道从哪里得到这个文件,因为代码每小时更新一次,手动升级是不可能的。
发布于 2020-01-21 18:12:50
如果您知道确切的项目名称和版本,可以使用以下URL结构:
project_name = "..."
version = "..."
url = f"https://files.pythonhosted.org/packages/source/{project_name[0]}/{project_name}/{project_name}-{version}.tar.gz例如:
https://files.pythonhosted.org/packages/source/p/pip/pip-20.0.1.tar.gz
如果您不知道最新版本,可以使用PyPI JSON获得它:
>>> import requests
>>> resp = requests.get('https://pypi.org/pypi/pip/json').json()
>>> resp['info']['version']
'20.0.1'备注:不能保证给定版本的源发行版存在,尽管它是有可能的。
https://stackoverflow.com/questions/59798989
复制相似问题