Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a pip installable project?

Tags:

How do I create a pip installable project? How do you register with pip?

What meta data config should all projects have in order to allow integration and easy import.

like image 561
Matt Alcock Avatar asked Feb 23 '12 10:02

Matt Alcock


People also ask

How do I make a pip project installable?

Create an account on PYPI: Go to: https://pypi.python.org and select Register. Follow instructions. Create an account on testpypi: Go to: https://testpypi.python.org and select Register. Follow instructions.


2 Answers

Or, if you're feeling fancy (read: lazy)...

  1. sudo easy_install PasteScript
  2. paster create mynewpackage
  3. answer the questions!
  4. cd mynewpackage
  5. python setup.py sdist
  6. python setup.py register
  7. answer the questions!

Seems like more steps, but the PasteScript package handles a lot of the dirty work. Do yourself a favor and install it, use it, and never look back ;)

like image 200
wh1tney Avatar answered Oct 31 '22 18:10

wh1tney


You need to

  1. Write a setup.py file
  2. Run python setup.py sdist tar gzipped file.
  3. Run register or submit the project using the web form.

You can register using:

>> python setup.py register 

An exmaple setup.py file is:

#!/usr/bin/env python  from distutils.core import setup   setup(name='Distutils',   version='1.0',   description='Python Distribution Utilities',   author='Greg Ward',   author_email='[email protected]',   url='http://www.python.org/sigs/distutils-sig/',   packages=['distutils', 'distutils.command'],  ) 

Users will then just have to upack the taz file and run install..

>> python setup.py install 
like image 29
Matt Alcock Avatar answered Oct 31 '22 17:10

Matt Alcock