How can I make this long_description and README differ in a few sentences?

For my package, I have a README.rst file that reads in the detailed description of setup.py like this:

readme = open('README.rst', 'r') README_TEXT = readme.read() readme.close() setup( ... long_description = README_TEXT, .... ) 

That way, I can have a README file on my github page every time I make a transaction, and on a pypi page every time I python setup.py register . There is only one problem. I would like the github page to say something like this: "This document reflects a preview of envbuilder. For the latest version, see Pypi."

I could just put these lines in README.rst and delete them before I python setup.py register , but I know that there will be a time when I forget to delete sentences before I click on pypi.

I am trying to find a better way to automate this, so I do not need to worry about it. Does anyone have any idea? Is there any setuptools / distutils program that I can do?

+7
python github setuptools pypi distutils
source share
3 answers

You can simply use a ReST comment with some text, such as "split here", and then split it into your setup.py. Ian Bicking does this in virtualenv with index.txt and setup.py .

+8
source share

Another option is to completely fix the problem by adding a paragraph that works in both environments: "The last unstable code is on github. The last stable sets are on pypi."

After all, why aren't pypi people supposed to point to github? This would be more useful for both audiences and simplify setup.py.

+5
source share

You can always do this:

 GITHUB_ALERT = 'This document reflects a pre-release version...' readme = open('README.rst', 'r') README_TEXT = readme.read().replace(GITHUB_ALERT, '') readme.close() setup( ... long_description = README_TEXT, .... ) 

But then you have to keep this GITHUB_ALERT line in sync with the actual README wording. Instead of using a regex (for example, to match a line starting with Note for Github users: or something else) may give you a little more flexibility.

+2
source share

All Articles