我有一个Python package,我试图在PyPI上注册。我正在尝试使用最新版本的twine(1.9.1)并遵循instructions on the twine webpage。
我在本地正确配置了我的包。 (setup.py
已完成,所有这些。)名称尚未在PyPI上声明。我有一个关于PyPI的帐户。我的机器上没有~/.pypirc
个文件。我已经建立了一个源分发和一个轮子。
> ll dist
total 64
-rw-r--r-- 1 billmcn staff 14184 Aug 1 13:35 mycroft-1.1.0.tar.gz
-rw-r--r-- 1 billmcn staff 15996 Aug 1 13:36 mycroft-1.1.0-py3-none-any.whl
当我尝试注册其中任何一个软件包时,我收到以下错误消息。
> twine register dist/mycroft-1.1.0.tar.gz
Registering package to https://upload.pypi.org/legacy/
Enter your username: billmcn
Enter your password:
Registering mycroft-1.1.0.tar.gz
HTTPError: 410 Client Error: Project pre-registration is no longer required or supported, so continue directly to uploading files. for url: https://upload.pypi.org/legacy/
当我尝试注册wheel文件时,我收到相同的错误消息。这让我觉得这个注册步骤是不必要的。但是,当我尝试上传我的包时,我看到了这一点。
> twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: billmcn
Enter your password:
Uploading mycroft-1.1.0-py3-none-any.whl
[================================] 23132/23132 - 00:00:00
HTTPError: 403 Client Error: You are not allowed to upload to 'mycroft'. for url: https://upload.pypi.org/legacy/
如果您在尝试上传软件包之前未能注册软件包,则会出现错误。我在PyPI网站上browse for it时看不到我的包裹。所以我被卡住了。
https://upload.pypi.org/legacy/对我来说有点怀疑。我应该指定其他一些网址吗?
如何注册我的包裹?
这与Uploading package to pypi using twine: Invalid URI类似。问题是该人在url
函数中有一个无效的setup.py:setup
关键字参数。但是,我的网址是项目的github页面https://github.com/wpm/mycroft,并且是正确的。
如果我有以下~/.pypirc
文件,我会看到同样的问题:
[distutils]
index-servers =
pypi
pypitest
[pypi]
username=billmcn
password=********
[pypitest]
username=billmcn
password=********
尝试手动指定上传网址。
twine upload dist/* -r https://pypi.python.org/pypi
KeyError: Missing 'https://pypi.python.org/pypi' section from the configuration file
or not a complete URL in --repository.
Maybe you have a out-dated '~/.pypirc' format?
more info: https://docs.python.org/distutils/packageindex.html#pypirc
--help
文字说twine应该能够弄清楚我是否指定了存储库名称或网址,但让我们明确。
> twine upload dist/* --repository-url https://pypi.python.org/pypi
Uploading distributions to https://pypi.python.org/pypi
Note: you are uploading to the old upload URL. It's recommended to use the new URL "https://upload.pypi.org/legacy/" or to leave the URL unspecified and allow twine to choose.
Enter your username: billmcn
Enter your password:
Uploading mycroft-1.1.0-py3-none-any.whl
HTTPError: 410 Client Error: Gone (This API has been deprecated and removed from legacy PyPI in favor of using the APIs available in the new PyPI.org implementation of PyPI (located at https://pypi.org/). For more information about migrating your use of this API to PyPI.org, please see https://packaging.python.org/guides/migrating-to-pypi-org/#uploading. For more information about the sunsetting of this API, please see https://mail.python.org/pipermail/distutils-sig/2017-June/030766.html) for url: https://pypi.python.org/pypi
所以我应该使用" new"网址https://upload.pypi.org/legacy/?
> twine upload dist/* --repository-url https://upload.pypi.org/legacy/
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: billmcn
Enter your password:
Uploading mycroft-1.1.0-py3-none-any.whl
HTTPError: 403 Client Error: You are not allowed to upload to 'mycroft'. for url: https://upload.pypi.org/legacy/
我很难过。我无法找到当前正确网址的任何官方来源。
由于Python documentation recommends against使用python setup.py register
和python setup.py upload
,我希望能够工作。
无论如何我试过这个并遇到了同样的问题。
> python setup.py register
running register
running egg_info
writing mycroft.egg-info/PKG-INFO
writing dependency_links to mycroft.egg-info/dependency_links.txt
writing entry points to mycroft.egg-info/entry_points.txt
writing requirements to mycroft.egg-info/requires.txt
writing top-level names to mycroft.egg-info/top_level.txt
reading manifest file 'mycroft.egg-info/SOURCES.txt'
writing manifest file 'mycroft.egg-info/SOURCES.txt'
running check
We need to know who you are, so please choose either:
1. use your existing login,
2. register as a new user,
3. have the server generate a new password for you (and email it to you), or
4. quit
Your selection [default 1]:
Username: billmcn
Password:
Registering mycroft to https://upload.pypi.org/legacy/
Server response (410): Project pre-registration is no longer required or supported, so continue directly to uploading files.
和
> python setup.py sdist bdist_wheel upload
...builds the packages...
running upload
Password:
Submitting dist/mycroft-1.1.0.tar.gz to https://upload.pypi.org/legacy/
Upload failed (403): You are not allowed to upload to 'mycroft'.
error: Upload failed (403): You are not allowed to upload to 'mycroft'.
打开PyPI issue #677。
答案 0 :(得分:2)
可悲的是,即使它看起来很空并且没有任何代码,看起来PyPI上已经有一个'mycroft'包:https://pypi.python.org/pypi/mycroft/0.1.0。这就是为什么api告诉你,你没有权利这个包名。
它可能来自旧版本的pypi,因为它甚至没有默认版本。这可能是为什么它无法通过研究工具找到的原因。我能够使用json api找到它:https://pypi.python.org/pypi/mycroft/json
我不知道pypi对此有什么政策,但也许他们可以删除它,因为即使GitHub也会抛出404.无论如何都不会接受使用新api上传的软件包。