Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing README.rst to render correctly on PyPI. #434

Merged
merged 2 commits into from
Dec 18, 2014

Conversation

dhermes
Copy link
Contributor

@dhermes dhermes commented Dec 18, 2014

Main changes:

  • Using named links instead of anonymous
  • Using an absolute instead of project relative link for
    CONTRIBUTING
  • Changing duplicated link text so that they differ
  • Lining up :target: with the line above for embedded img's

H/T to
https://github.com/coagulant/coveralls-python/blob/master/README.rst
for guidance.

@dhermes
Copy link
Contributor Author

dhermes commented Dec 18, 2014

I'm not 100% this will work so a PyPI maintainer should upload the new RST via:
https://pypi.python.org/pypi?%3Aaction=pkg_edit&name=gcloud
to make sure.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 76ce9e6 on dhermes:fix-readme-for-pypi into c2ba130 on GoogleCloudPlatform:master.

@tseaver
Copy link
Contributor

tseaver commented Dec 18, 2014

Here is how I test the renderings:

$ python setup.py --long-description | rst2html > /tmp/foo && firefox /tmp/foo

Warnings show up in nice, hard-to-ignore dropshadow boxes.

@tseaver
Copy link
Contributor

tseaver commented Dec 18, 2014

My example assumed that we were setting the long_description argument to setup() based on README.rst, which we don't (but should). E.g.:

import os

from setuptools import setup, find_packages

here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst')) as f:
    README = f.read()

setup(
    name='gcloud',
    version='0.3.0',
    description='API Client library for Google Cloud',
    long_description=README,
    #...
)

It could include CHANGES.rst, too, if we hand that file. E.g.:

import os

from setuptools import setup, find_packages

here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst')) as f:
    README = f.read()
with open(os.path.join(here, 'CHANGES.rst')) as f:
    CHANGES = f.read()

setup(
    name='gcloud',
    version='0.3.0',
    description='API Client library for Google Cloud',
    long_description='\n\n'.join([README, CHANGES]),
    #...
)

Doing it that way avoids the need to upload a file: it gets done during the setup.py register stage automatically.

@tseaver
Copy link
Contributor

tseaver commented Dec 18, 2014

BTW, the following::

$ rst2html < README.rst > foo.html

shows that the error preventing rendring on PyPI is the inclusion of the .. code:: role, which is Sphinx-only.

@dhermes
Copy link
Contributor Author

dhermes commented Dec 18, 2014

Great! Thanks for that. I googled around for RST validators and had no luck. Will fix the Sphinx parts and ping again.

Main changes:
- Using named links instead of anonymous
- Using an absolute instead of project relative link for
  CONTRIBUTING
- Changing duplicated link text so that they differ
- Lining up :target: with the line above for embedded img's

H/T to
https://github.com/coagulant/coveralls-python/blob/master/README.rst
for guidance.
@dhermes dhermes force-pushed the fix-readme-for-pypi branch from 76ce9e6 to 48249e1 Compare December 18, 2014 17:55
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 48249e1 on dhermes:fix-readme-for-pypi into 1f2ed88 on GoogleCloudPlatform:master.

@dhermes
Copy link
Contributor Author

dhermes commented Dec 18, 2014

  1. Leaving the .. code section in renders just fine (and with syntax highlighting):

screen_shot_045

as compared to using just the Some text:: directive (like coagulant does), which doesn't look great:

screen_shot_046

  1. A StackOverflow post indicates that :code: may be an issue but one of the comments notes that .. code is included in the PyPI code.

I think the more likely culprit was the relative link to CONTRIBUTING.rst.

@dhermes
Copy link
Contributor Author

dhermes commented Dec 18, 2014

@tseaver I finally got access to the PyPI project and played around (a bit of binary search) until it rendered.

It turns out the remaining issue was the final relative link LICENSE <LICENSE>__. #Fail that I missed it.

You can check out https://pypi.python.org/pypi/gcloud now and it renders perfectly.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling beb58b1 on dhermes:fix-readme-for-pypi into 1f2ed88 on GoogleCloudPlatform:master.

@dhermes
Copy link
Contributor Author

dhermes commented Dec 18, 2014

@tseaver PTAL

Is it safe to set

--- a/setup.py
+++ b/setup.py
@@ -25,6 +25,7 @@ setup(
     name='gcloud',
     version='0.3.0',
     description='API Client library for Google Cloud',
+    long_description=open('README.rst', 'r').read(),
     author='JJ Geewax',
     author_email='[email protected]',
     scripts=[],

Also, in doing this, python setup.py --long-description | rst2html didn't give me any warnings about the relative links (LICENSE and CONTRIBUTING).

@tseaver
Copy link
Contributor

tseaver commented Dec 18, 2014

Should be fine to update setup.py to include the long_description. Maybe do it via a with statement to avoid resource warnings under Py3k?

@tseaver
Copy link
Contributor

tseaver commented Dec 18, 2014

LGTM

dhermes added a commit that referenced this pull request Dec 18, 2014
Fixing README.rst to render correctly on PyPI.
@dhermes dhermes merged commit 05c5258 into googleapis:master Dec 18, 2014
@dhermes dhermes deleted the fix-readme-for-pypi branch December 18, 2014 19:46
atulep pushed a commit that referenced this pull request Apr 6, 2023
Source-Link: googleapis/synthtool@703554a
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:94961fdc5c9ca6d13530a6a414a49d2f607203168215d074cdb0a1df9ec31c0b
atulep pushed a commit that referenced this pull request Apr 18, 2023
Source-Link: googleapis/synthtool@703554a
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:94961fdc5c9ca6d13530a6a414a49d2f607203168215d074cdb0a1df9ec31c0b
parthea pushed a commit that referenced this pull request Jun 4, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Jun 4, 2023
Source-Link: https://togithub.com/googleapis/synthtool/commit/26c7505b2f76981ec1707b851e1595c8c06e90fc
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f946c75373c2b0040e8e318c5e85d0cf46bc6e61d0a01f3ef94d8de974ac6790
parthea added a commit that referenced this pull request Jul 6, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea added a commit that referenced this pull request Aug 15, 2023
* feat: add prebuilt telecom webhook python sample code and test

* feat:add test

* fix:lint errors

* fix:add new line at the end of file

* fix: add more comprehensive tests

* fix: pylint

* feat:change helper function and address comments

* fix: pylint

Co-authored-by: nicain <[email protected]>
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea pushed a commit that referenced this pull request Sep 20, 2023
@release-please release-please bot mentioned this pull request Sep 20, 2023
vchudnov-g pushed a commit that referenced this pull request Sep 20, 2023
* chore: update Java and Python dependencies

PiperOrigin-RevId: 408420890

Source-Link: googleapis/googleapis@2921f9f

Source-Link: googleapis/googleapis-gen@6598ca8
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU5OGNhOGNiYmY1MjI2NzMzYTA5OWM0NTA2NTE4YTVhZjZmZjc0YyJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Sep 22, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea added a commit that referenced this pull request Oct 21, 2023
parthea pushed a commit that referenced this pull request Oct 21, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Oct 21, 2023
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 472772457

Source-Link: googleapis/googleapis@855b74d

Source-Link: googleapis/googleapis-gen@b64b1e7
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjY0YjFlN2RhM2UxMzhmMTVjYTM2MTU1MmVmMDU0NWU1NDg5MWI0ZiJ9
parthea pushed a commit that referenced this pull request Oct 21, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Oct 22, 2023
Source-Link: googleapis/synthtool@703554a
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:94961fdc5c9ca6d13530a6a414a49d2f607203168215d074cdb0a1df9ec31c0b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants