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.
-
3You can reach all the information you need from the PyPI homepage.Rik Poggi– Rik Poggi2012年02月23日 11:05:52 +00:00Commented Feb 23, 2012 at 11:05
-
2Inspired by @wjoba I wrote a guide here gist.github.com/stevepeak/5520777 enjoy!Steve Peak– Steve Peak2013年05月05日 13:17:38 +00:00Commented May 5, 2013 at 13:17
-
I'm maintaining a python project template that's ready to be installed with pip, here: github.com/DarkTrick/python_project_templateDarkTrick– DarkTrick2023年05月13日 03:32:44 +00:00Commented May 13, 2023 at 3:32
4 Answers 4
Or, if you're feeling fancy (read: lazy)...
sudo easy_install PasteScriptpaster create mynewpackage- answer the questions!
cd mynewpackagepython setup.py sdistpython setup.py register- 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 ;)
4 Comments
sudo pip install PasteScriptYou need to
- Write a setup.py file
- Run python setup.py sdist tar gzipped file.
- 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
1 Comment
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.
Comments
You may want to check out libmaker. It makes it easy to make packages. This is the link to the homepage and documentation.