|
UseInSetup
Use Creole for README and create ReSt on-the-fly for setup.py
Featured IntroductionThe Package Index used the long_description from setup.py to display a html page. This long_description must be written in ReStructuredText, but ReSt is not very easy to use. With python-creole you can write your README in creole and convert it on-the-fly in setup.py into ReStructuredText for the PyPi ;) ExampleOur README.creole on github: The rendered ReStructuredText on PyPi: HowToCreate a README.creole in your project root (use .creole file extension, so it would be rendered on github as html!) setup.pyPut this code into your setup.py: #!/usr/bin/env python
# coding: utf-8
"""
distutils setup example
~~~~~~~~~~~~~~~~~~~~~~~
"""
import os
import sys
from setuptools import setup, find_packages
PACKAGE_ROOT = os.path.dirname(os.path.abspath(__file__))
# convert creole to ReSt on-the-fly, see also:
# https://code.google.com/p/python-creole/wiki/UseInSetup
try:
from creole.setup_utils import get_long_description
except ImportError:
if "register" in sys.argv or "sdist" in sys.argv or "--long-description" in sys.argv:
etype, evalue, etb = sys.exc_info()
evalue = etype("%s - Please install python-creole >= v0.8 - e.g.: pip install python-creole" % evalue)
raise etype, evalue, etb
long_description = None
else:
long_description = get_long_description(PACKAGE_ROOT)
setup(
...
long_description = long_description,
...
)Note: creole.setup_utils.get_long_description is new in python creole v0.8.1! | |
► Sign in to add a comment