我有一个Python package,我正试图在PyPI上注册。我正在尝试使用最新版本的麻线(1.9.1)和instructions on the twine webpage。Twine不会让我注册或上传我的软件包:是https://upload.pypi.org/legacy/错?
我有我的软件包在本地正确配置。 (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/
当我尝试注册车轮文件时,出现相同的错误消息。这让我觉得这个注册步骤是不必要的。但是,当我尝试上传我的包时,我看到了这一点。
> 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。问题在于该人在其setup.py:setup
函数中有一个无效的url
关键字参数。不过,我的网址是该项目的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
文中说麻线应该能够找出我是否指定库名或URL,但我们是明确的。因此我应该使用“新”URL 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/
我很难过。而且我无法找到当前正确URL的任何官方来源。
而且我想,因为使用python setup.py register
和python setup.py upload
的Python documentation recommends against得到麻线工作。
无论如何,我试过这个,看起来像是同样的问题。
> 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。
你有没有试过指定存储库URL来缠绕?我相信你可以做一些像'twine upload dist/* -r https:// pypi.python.org/pypi' –
我尝试了几个变种,没有用。修改上面的原始帖子。 –
我在https://packaging.python.org/guides/migrating-to-pypi-org/上发现了您的错误消息,但这并不能解释发生了什么。我也看了一下https://packaging.python.org/tutorials/distributing-packages/#uploading-your-project-to-pypi,但看起来就是你在做什么。此时,我会试着询问PyPI的人。这听起来像是有些破碎。 –