Distributing your own package on PyPi – Part 2

In Distributing your own package on PyPi I wrote about my first package on PyPI. Here are some refinements aka lessons learned:

Project Description on PyPI

I wondered why the project description on PyPi was empty. Solution: You need a long_description. If You already have a README.md, you can read it into a string and use this as the description.

But you have to add long_description_content_type=’text/markdown’ as well.

from setuptools import setup

# read the contents of your README file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
    long_description = f.read()

setup(
    name='flask_url_mapping',
    version='0.6',
    packages=['flask_url_mapping'],
    url='https://github.com/jboegeholz/flaskurls',
    download_url='https://github.com/jboegeholz/flaskurls/archive/0.2.tar.gz',
    license='MIT',
    author='Joern Boegeholz',
    author_email='boegeholz.joern@gmail.com',
    description='Django-style URL handling for Flask',
    long_description=long_description,
    long_description_content_type='text/markdown',
    install_requires=["Flask", "Flask-Login"]
)

 

Dependencies of your Package

If your package relies on the usage of other python packages you should add them to your setup.py as well via install_requires.

setup(
    name='flask_url_mapping',
    version='0.6',
    packages=['flask_url_mapping'],
    url='https://github.com/jboegeholz/flaskurls',
    download_url='https://github.com/jboegeholz/flaskurls/archive/0.2.tar.gz',
    license='MIT',
    author='Joern Boegeholz',
    author_email='boegeholz.joern@gmail.com',
    description='Django-style url handling for Flask',
    install_requires=["Flask", "Flask-Login"]
)