share your code with the python world by creating pip packages
TRANSCRIPT
![Page 1: Share your code with the Python world by creating pip packages](https://reader033.vdocument.in/reader033/viewer/2022042615/55a7813d1a28ab133e8b4650/html5/thumbnails/1.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022042615/55a7813d1a28ab133e8b4650/html5/thumbnails/2.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022042615/55a7813d1a28ab133e8b4650/html5/thumbnails/3.jpg)
Example at renooble.com
>> Development of PyZillow
![Page 4: Share your code with the Python world by creating pip packages](https://reader033.vdocument.in/reader033/viewer/2022042615/55a7813d1a28ab133e8b4650/html5/thumbnails/4.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022042615/55a7813d1a28ab133e8b4650/html5/thumbnails/5.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022042615/55a7813d1a28ab133e8b4650/html5/thumbnails/6.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022042615/55a7813d1a28ab133e8b4650/html5/thumbnails/7.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022042615/55a7813d1a28ab133e8b4650/html5/thumbnails/8.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022042615/55a7813d1a28ab133e8b4650/html5/thumbnails/9.jpg)
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 11: Share your code with the Python world by creating pip packages](https://reader033.vdocument.in/reader033/viewer/2022042615/55a7813d1a28ab133e8b4650/html5/thumbnails/11.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022042615/55a7813d1a28ab133e8b4650/html5/thumbnails/12.jpg)
@hanneshapkehanneshapke.github.io
github.com/hanneshapke
Portland, 2014