我有一個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的人。這聽起來像是有些破碎。 –