我正在尝试创建我的第一个python包.为了不搞砸整个交易,我一直在尝试将其上传到testpypi服务器.这似乎很好(sdist创建和上传不显示任何错误).但是,当我尝试从https://testpypi.python.org/pypi将其安装到新的virtualenv时,它会抱怨我的安装要求,例如:
pip install -i https://testpypi.python.org/pypi poirot
Collecting poirot
Downloading https://testpypi.python.org/packages/source/p/poirot/poirot-0.0.15.tar.gz
Collecting tqdm==3.4.0 (from poirot)
Could not find a version that satisfies the requirement tqdm==3.4.0 (from poirot) (from versions: )
No matching distribution found for tqdm==3.4.0 (from poirot)
Run Code Online (Sandbox Code Playgroud)
tqdm和Jinja2是我唯一的要求.我尝试指定版本,而不是单向指定-Error.
它似乎试图在testpypi服务器上找到tqdm和Jinja2而没有找到它们(因为它们只能在普通的pypi上使用).将软件包上传到非测试服务器并运行pip install.
我需要添加到setup.py文件(如下所示),以便在上传到testpypi时找到它们的要求?
谢谢!
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(name='poirot',
version='0.0.15',
description="Search a git repository's revision history for text patterns.",
url='https://github.com/dcgov/poirot',
license='https://raw.githubusercontent.com/DCgov/poirot/master/LICENSE.md',
packages=['poirot'],
install_requires=['tqdm==3.4.0', 'Jinja2==2.8'],
test_suite='nose.collector',
tests_require=['nose-progressive'],
classifiers=[
'Environment :: Console',
'Intended Audience :: …Run Code Online (Sandbox Code Playgroud) 我希望使用Python 请求库在GitHub存储库中创建一个新文件.在命令行中输入以下内容适用于我(替换LOGIN并TOKEN视情况而定):
curl -X PUT -d '{"path": "testfile.txt", "message": "test", "content": "aGVsbG8y"}' https://api.github.com/repos/LOGIN/testrepo/contents/testfile.txt\?access_token\=TOKEN
Run Code Online (Sandbox Code Playgroud)
但是在尝试使用请求时,我一直遇到"解析JSON的问题"错误(状态代码400):
data = {
"message": "test",
"content": "aGVsbG8y",
"path": "testfile.txt"
}
url = "https://api.github.com/repos/LOGIN/testrepo/contents/testfile.txt?access_token={}".format(TOKEN)
response = requests.put(url, data=data)
Run Code Online (Sandbox Code Playgroud)
关于我的做法有何不同?我已经检查了类似的问题,但没有找到正确的调整.谢谢!