27

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.

asked Feb 23, 2012 at 10:47
3

4 Answers 4

11

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 ;)

answered Feb 28, 2012 at 0:24
Sign up to request clarification or add additional context in comments.

4 Comments

There is also this excellent tutorial if you're looking for a more thorough explanation of how to create and distribute a python package.
You can also install via pip: sudo pip install PasteScript
That tutorial link is dead.
This tutorial is good.
10

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
answered Feb 23, 2012 at 11:37

1 Comment

Here is the current example setup.py file as per PYPA: github.com/pypa/sampleproject/blob/master/setup.py
1

I wish PasteScript did the job because it seems straightforward but it simply didn't work for me. I got my code uploaded to the pip repository with Peter Down's quick but well-explained tutorial.

Also, remember that if you are trying to have your code import from the package, you have to put it in __init__.py, which is sufficient for most projects.

answered Aug 12, 2015 at 16:33

Comments

0

You may want to check out libmaker. It makes it easy to make packages. This is the link to the homepage and documentation.

answered Jul 19, 2017 at 18:00

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.