I seek to reuse information from my README.rst in package description of the setup.py
In my setup.py I have a readme function:
def readme():
try:
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f:
return f.read()
except (IOError, OSError):
return ''
which I call in
setup(
...
long_description=readme(),
...
)
Because my reStructuredText is a rather huge README.rst it might be a better way just to read only a particular section of restructured text.
Is there a smart way to rewrite readme() so that it parses README.rst and ignores the rest of reStructuredText formatting, i.e. gives only plain text of a small subsection?