Friday, March 18, 2016

Push your package to pip

Finally after a long time .. a PR on my git project  https://github.com/Neetuj/python-wns
reminded me that i still need to push it to pip.

Given the hits I get on my notification entry (most popular so far) push-notifications-on-apns-gcm-WNS 
I felt bad for not putting in the effort before to push python-wns to pip
Anyways I finally did it today and now you all can avail the power of pip for python-wns by
pip install python-wns

Now if you are the one who are not interested in my pyton-wns package but want to push your own package here are the steps I followed  (order can be important so follow it :)

  • Register on https://testpypi.python.org/pypi
  • Register on https://pypi.python.org/pypi
  • Confirm all verification emails for the new accounts 
  • create a .pypirc file "vim ~/.pypirc" which looks like this 
  • [distutils]
    index-servers =
      pypi
      test

    [pypi]
    repository=https://pypi.python.org/pypi
    username=name
    password=pwd

    [test]
    repository=https://testpypi.python.org/pypi
    username=name
    password=pwd
  • package your library like this  
  • python-wns/
      setup.py
      setup.cfg
      LICENSE.txt
      README.md
      wns/
        __init__.py
        wnslib.py 
     
  •  The setup.py needs to be in a certain format you can checkout mine here setup.py
  • Then test 
  •  python setup.py register -r test
  •  proceed if you get Server response (200): OK
  • python setup.py sdist upload -r test
  • proceed if you get Server response (200): OK
  • python setup.py register sdist upload
  • and you are done!!  test "pip install python-wns"