share your code with the python world by creating pip packages

12
Share your code with the Python world by creating pip packages Hannes Hapke 1/28/2014 @PDXPython

Upload: hannes-hapke

Post on 16-Jul-2015

143 views

Category:

Engineering


8 download

TRANSCRIPT

Page 1: Share your code with the Python world by creating pip packages

Share your code with the Python world by

creating pip packages

Hannes Hapke1/28/2014 @PDXPython

Page 2: Share your code with the Python world by creating pip packages

Do you have a great project and want to share it with

the Python world?

Page 3: Share your code with the Python world by creating pip packages

Example at renooble.com

>> Development of PyZillow

Page 4: Share your code with the Python world by creating pip packages

Step 1: Share your code in public repo

Github creates a license file automatically

Page 5: Share your code with the Python world by creating pip packages

Step 2: Create helpful support files

• Create your tests

• Create __version__.py VERSION = '0.2.2'

• Create README.txt or README.md ================== pyzillow 0.2.2 ==================

README ------ ...

Page 6: Share your code with the Python world by creating pip packages

Step 3: Create a setup.pyimport os

try: from setuptools import setup except ImportError: from distutils.core import setup

from __version__ import VERSION

setup( name='pyzillow', version=VERSION, author='Hannes Hapke', author_email='[email protected]', url='https://github.com/hanneshapke/pyzillow', download_url='https://github.com/hanneshapke/pyzillow/archive/master.zip', description='Python interface for Zillow\'s API. Currently supporting GetDeepSearchResults and GetUpdatedPropertyDetails API.', long_description=open(os.path.join(os.path.dirname(__file__), 'README.txt'), 'r').read(), py_modules=['pyzillow', 'pyzillowerrors', '__version__'], provides=['pyzillow'], requires=['requests'], install_requires=['requests >= 2.2.0'], classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Financial and Insurance Industry', 'Natural Language :: English', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2', 'License :: OSI Approved :: MIT License', 'Topic :: Internet', 'Topic :: Internet :: WWW/HTTP', ], keywords='zillow real estate rental xml api address zipcode', license='MIT', )

https://pypi.python.org/pypi?:action=list_classifiers

Page 7: Share your code with the Python world by creating pip packages

Step 4: Register your package with PyPI

$ python setup.py register PyPI asks you to create a new account or use your credentials

Page 8: Share your code with the Python world by creating pip packages

Step 5: Upload your package to PyPI

$ python setup.py sdist upload Voila, your package is now available to the Python world!

$ pip install YOUR_PACKAGE

Page 9: Share your code with the Python world by creating pip packages

Use your Github README.md as README

found at https://coderwall.com/p/qawuyq

try: import pypandoc long_description = pypandoc.convert('README.md', 'rst') except (IOError, ImportError): long_description = ''

Page 10: Share your code with the Python world by creating pip packages

https://wiki.python.org/moin/CheeseShopTutorial

Page 11: Share your code with the Python world by creating pip packages

Check out Python Wheel

Why? PEP 376 compliant install

http://pythonwheels.com https://pypi.python.org/pypi/wheel

Run `python setup.py sdist bdist_wheel upload`

Page 12: Share your code with the Python world by creating pip packages

@hanneshapkehanneshapke.github.io

github.com/hanneshapke

Portland, 2014