Serving python package from github at pypi

I have a public python project on github. It is for windows only. I would like to add it to pypi so that people can install it via

pip install mypackage

      

Is there a way to save my package to github instead of using aws s3 bucket? If so, how? I also need to know what the expected format is. Am I supposed to create a package folder and put mypackage-1.0.tar.gz file in it, even though this is for Windows?

I already read this: http://docs.python-guide.org/en/latest/shipping/packaging/

so far when I run pip install https://github.com/my_username/mypackage I get this error:

Download from url https://github.com/my_username/mypackageCleanup ... Exception: Traceback (last call last): File "C: \ python27 \ Lib \ site-packages \ pip-1.5.6-py2.7.egg \ pip \ basecommand.py", line 122, in main status = self.run (options, args) File "C: \ Python27 \ lib \ site-packages \ pip-1.5.6-py2.7.egg \ pip \ commands \ install.py" line 278 in perspective require_set .prepare_files (finder, force_root_egg_info = self.bundle, bundle = self.bundle) File "C: \ Python27 \ lib \ site-packages \ pip-1.5.6-py2.7.egg \ pip \ req.py", line 1197, in prepare_files do_download, File "C: \ Python27 \ lib \ site-packages \ pip-1.5.6-py2.7.egg \ pip \ req.py", line 1375, in unpack_url self.session, File " C: \ Python27 \ lib \ site-packages \ pip-1.5.6-py2.7.egg \ pip \ download.py ", line 582, in unpack_http_url unpack_file (temp_location, location, content_type,link) File "C: \ Python27 \ lib \ site-packages \ pip-1.5.6-py2.7.egg \ pip \ util.py", line 627, in unpack_file and is_svn_page (file_contents (filename))): File "C: \ Python27 \ lib \ site-packages \ pip-1.5.6-py2.7.egg \ pip \ util.py", line 210, in file_contents return fp.read (). decode ('utf-8') File "C: \ Python27 \ lib \ encodings \ utf_8.py", line 16, in decode return codecs.utf_8_decode (input, errors, True) UnicodeDecodeError: codec 'utf8' cannot decode bytes 0x8b at position 1: invalid start byte) File "C: \ Python27 \ lib \ encodings \ utf_8.py", line 16, in decode return codecs.utf_8_decode (input, errors, True) UnicodeDecodeError: codec 'utf8' cannot decode byte 0x8b at position 1: invalid start byte) File "C: \ Python27 \ lib \ encodings \ utf_8.py", line 16, in decode return codecs.utf_8_decode (input, errors, True) UnicodeDecodeError: codec 'utf8' cannot decode byte 0x8b at position 1: invalid start byte

I also figured out that I have to write setup.py and setup.cfg and then I can run

python setup.py build
python setup.py register
>>Registering mypackage to http://pypi.python.org/pypi
>>Server response (401): basic auth failed

      

I do not know why the registration is failing. Also tried:

python setup.py sdist register upload

      

which complains as in: PyPi Problems - Load Error (401): You need to identify to edit the packaging information but creating a .pypirc did not fix the problem. Any ideas on how to add my package to pypi?

+3


source to share


2 answers


I found the correct clear documentation: http://peterdowns.com/posts/first-time-with-pypi.html

I also list the following steps:



  • register for a pypi account
  • enter your credentials in a .pypirc text file (on windows you need to rename .pypirc.txt to .pypirc in the terminal)
  • set HOME environment variable (you can do this in terminal)

    set HOME = path to directory where you put .pypirc

  • make sure you have the correct setup.py and setup.cfg file. You need to read docs and sample projects.

  • make https://github.com/my_username/mypackage/packages/0.1
  • create a mypackage.zip file by running

    python setup.py register -r pypitest

  • Upload it to 0.1 folder on github

  • tag it in github

    git tag 0.1 -m "Adds a tag so we can put this in PyPI." git push -tags origin master

  • register and download:

    python setup.py register -r pypi

    python setup.py sdist upload -r pypi

+4


source


I had the same 401 authentication problem: I changed [distutils]

to [pypirc]

according to the docs and it worked for me.

Here is my file ~/.pypirc

:



[pypirc]
index-servers =
    pypi
    pypitest

[pypi]
repository=https://pypi.python.org/pypi

[pypitest]
repository=https://testpypi.python.org/pypi

[server-login]
username:stav
password:****

      

+1


source







All Articles