Uploading my little project to pypi (python package index)

Wanted to upload my little project to pypi, the place from which the project can be easily installed using pip install..

First of all, need to create the setup.py file. This is documented in quite a few places. Just a few notes on this:
The “name” attribute is what is used to refer to the project when performing the upload, and what is used on the index.
the “packages” attribute should contain all packages to upload. Not sure if “empty” middle packages count or not. But I put one in anyway.

Now, this should all be just fine but the weirdest error are to be had. The command to perform the upload is “python setup.py sdist upload -r REPONAME”. And most of the websites tell me that the process should ask me for my username and password if I have not defined them anywhere. Anywhere being the “.pypirc” file mentioned in various places. But no, it give me the error “invalid schema definition”. Or something similar.

So to fix this most informative error, I tried various tricks and renaming fields in setup.py etc. None worked. So I tried to delete the project from pypi (don’t worry its not like it was popular and has user(s)). This finally gives the more reasonable error that I need to “.pypirc” file.

So, I need to add the “.pypirc” file. Where to, since Windows has no clearly defined “~” (home) directory. I had to define HOME environment variable and point that someplace, create the “.pypirc” and put my access credentials there. Finally register and upload works…

Maybe next time I will remember this..


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s