Cos I was getting pissed about trying to create a package on PyPI...
Click here
The instructions on http://peterdowns.com/posts/first-time-with-pypi.html is great until the point where you have to do:
python setup.py sdist upload -r pypitest
And if you see this:
$ python setup.py register -r pypitest
running register
running check
Registering [package_name] to https://testpypi.python.org/pypi
Server response (500): <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>
Basically, the PyPI server is saying, "Oh so you have registered an account on testpypi? Big whoop, it's not indexed yet so here's a stupid server response that won't help you. Go ask on Stackoverflow"
So I waited a day and come back to try to register it and it gives a different responses:
$ python setup.py register -r pypitest
running register
running check
Registering charguana to https://testpypi.python.org/pypi
Server response (401): You must login to access this feature
Okay, now the server is saying, "Hi Big whoop, now you're in my index but you have register first but I don't tell you where..."
So stupidly, I opened the browser window and go to http://testpypi.python.org and realized that I didn't log out at all. PyPI server, what are you saying?!
Of course the answer is to google for the answer and most probably it'll point to some outdated Stackoverflow answer. Then it leads to this: http://stackoverflow.com/questions/33967798/server-response-401-you-must-login-to-access-this-feature-when-registering . Which contains no correct up-to-date answer.
And like always, we try the first answer SO shows and did this:
$ python setup.py register
running register
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]:
1
Username: alvations
Password:
Registering charguana to https://upload.pypi.org/legacy/
Server response (410): This API is no longer supported, instead simply upload the file.
It looked promising until the server says, "Hey Big whoop, you're out-dated, you ain't no need to register or login before you upload the file. Which file? And how to upload? I'm not telling you..."
So of course, the first reaction is to Google for "Server response (410) PyPI". Then it leads me to this twine
thingy pypa/twine#200
Then you further and see "Currently it only supports registering projects and uploading distributions."
Fine, I'll stick with python setup.py
and distutils.core.setup
...
So, this should be the first thing I've done python setup.py --help
and python setup.py --help-commands
$ python setup.py --help-commands
Standard commands:
build build everything needed to install
build_py "build" pure Python modules (copy to build directory)
build_ext build C/C++ extensions (compile/link to build directory)
build_clib build C/C++ libraries used by Python extensions
build_scripts "build" scripts (copy and fixup #! line)
clean clean up temporary files from 'build' command
install install everything from build directory
install_lib install all Python modules (extensions and pure Python)
install_headers install C/C++ header files
install_scripts install scripts (Python or otherwise)
install_data install data files
sdist create a source distribution (tarball, zip file, etc.)
register register the distribution with the Python package index
bdist create a built (binary) distribution
bdist_dumb create a "dumb" built distribution
bdist_rpm create an RPM distribution
bdist_wininst create an executable installer for MS Windows
upload upload binary package to PyPI
check perform some checks on the package
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
Ah ha, just do python setup.py sdist upload -r pypitest
, the next step in http://peterdowns.com/posts/first-time-with-pypi.html
Another server responses?! At this point, I diverte and write this gist...
$ python setup.py sdist upload -r pypitest
running sdist
running check
warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list)
warning: sdist: standard file not found: should have one of README, README.txt
writing manifest file 'MANIFEST'
creating charguana-0.1
creating charguana-0.1/charguana
making hard links in charguana-0.1...
hard linking setup.cfg -> charguana-0.1
hard linking setup.py -> charguana-0.1
hard linking charguana/__init__.py -> charguana-0.1/charguana
hard linking charguana/cjk.py -> charguana-0.1/charguana
Creating tar archive
removing 'charguana-0.1' (and everything under it)
running upload
Submitting dist/charguana-0.1.tar.gz to https://testpypi.python.org/pypi
Upload failed (401): You must be identified to edit package information
error: Upload failed (401): You must be identified to edit package information
And you guessed it, Google it and it'll lead you to yet another out-dated Stackoverflow answer that tells you to mess around your ~/.pypirc
and add some [server-login]
yada yada...
So I did and my ~/.pypirc
file looks like this:
[distutils]
index-servers =
pypi
pypitest
[pypi]
repository=https://pypi.python.org/pypi
username=alvations
password=**********
[pypitest]
repository=https://testpypi.python.org/pypi
username=alvations
password=**********
[server-login]
username:alvations
password:**********
And then re-ran the upload:
$ python setup.py sdist upload
running sdist
running check
warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list)
warning: sdist: standard file not found: should have one of README, README.txt
writing manifest file 'MANIFEST'
creating charguana-0.1
creating charguana-0.1/charguana
making hard links in charguana-0.1...
hard linking setup.cfg -> charguana-0.1
hard linking setup.py -> charguana-0.1
hard linking charguana/__init__.py -> charguana-0.1/charguana
hard linking charguana/cjk.py -> charguana-0.1/charguana
Creating tar archive
removing 'charguana-0.1' (and everything under it)
running upload
Submitting dist/charguana-0.1.tar.gz to https://upload.pypi.org/legacy/
Upload failed (403): Invalid or non-existent authentication information.
error: Upload failed (403): Invalid or non-existent authentication information.
$ python setup.py sdist upload -r pypitest
running sdist
running check
warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list)
warning: sdist: standard file not found: should have one of README, README.txt
writing manifest file 'MANIFEST'
creating charguana-0.1
creating charguana-0.1/charguana
making hard links in charguana-0.1...
hard linking setup.cfg -> charguana-0.1
hard linking setup.py -> charguana-0.1
hard linking charguana/__init__.py -> charguana-0.1/charguana
hard linking charguana/cjk.py -> charguana-0.1/charguana
Creating tar archive
removing 'charguana-0.1' (and everything under it)
running upload
Submitting dist/charguana-0.1.tar.gz to https://testpypi.python.org/pypi
Upload failed (403): You are not allowed to edit 'charguana' package information
error: Upload failed (403): You are not allowed to edit 'charguana' package information
As dilligent programmer, I do my dues and Google "Upload failed (403)" and it led to pypa/twine#87.
So there's no escape, I've to use another llibrary to uplaod stuff to PyPI... Fine.
And so I did:
$ pip install git+https://github.com/pypa/twine
$ python setup.py sdist
$ twine upload dist/charguana-0.1.tar.gz
Uploading distributions to https://pypi.python.org/pypi
Uploading charguana-0.1.tar.gz
[================================] 4546/4546 - 00:00:01
HTTPError: 403 Client Error: You are not allowed to edit 'charguana' package information for url: https://pypi.python.org/pypi
Alright, so upload it manually through the GUI on the PyPI website(https://pypi.python.org/pypi), and clicked everywhere until I found this inconspicious hyperlink on the text that brings you to https://pypi.python.org/pypi?%3Aaction=submit_form.
Which eventually led to https://packaging.python.org/distributing/
Then I went back to the terminal, did:
$ tar -xvf charguana-0.1.tar.gz
$ cd charguan-0.1/
$ cat PKG-INFO
Metadata-Version: 1.1
Name: charguana
Version: 0.1
Summary: A character vommitting library.
Home-page: https://github.com/alvations/charguana
Author: Liling Tan
Author-email: alvations@gmail.com
License: UNKNOWN
Download-URL: https://github.com/alvations/charguana/tarball/0.1
Description: UNKNOWN
Keywords: unicode,character,vommit,linguistics
Platform: UNKNOWN
Uploaded the PKG-INFO
manually through the browser on https://pypi.python.org/pypi?%3Aaction=submit_form
And VOILA: https://pypi.python.org/pypi/charguana !!!
In total ~1 hour of pain yesterday and 3 hours 42 mins of pain...
Thanks, was helpful!
Let me summarise to reduce the pain further: use twine:
https://pypi.python.org/pypi/twine