Render markdown readme on PyPI (#6004)

* Render markdown readme on PyPI

PyPI now supports GitHub-flavored Markdown descriptions
(https://blog.thea.codes/github-flavored-markdown-on-pypi/),
so there's no need to convert the README to rst with pypandoc
any more.

* Remove readme checking

Checking markdown descriptions is not necessary.
See https://github.com/pypa/readme_renderer#markdown

* Upgrade twine
This commit is contained in:
Steven Loria 2018-06-03 14:21:04 -04:00 committed by Tom Christie
parent f67d23c441
commit cf925caa48
4 changed files with 6 additions and 32 deletions

View File

@ -32,11 +32,6 @@ matrix:
- tox --installpkg ./dist/djangorestframework-*.whl - tox --installpkg ./dist/djangorestframework-*.whl
- tox # test sdist - tox # test sdist
- python: "3.6"
env: TOXENV=readme
addons:
apt_packages: pandoc
exclude: exclude:
- { python: "2.7", env: DJANGO=master } - { python: "2.7", env: DJANGO=master }
- { python: "2.7", env: DJANGO=2.0 } - { python: "2.7", env: DJANGO=2.0 }

View File

@ -2,13 +2,7 @@
wheel==0.30.0 wheel==0.30.0
# Twine for secured PyPI uploads. # Twine for secured PyPI uploads.
twine==1.9.1 twine==1.11.0
# Transifex client for managing translation resources. # Transifex client for managing translation resources.
transifex-client==0.11 transifex-client==0.11
# Pandoc to have a nice pypi page
pypandoc
# readme_renderer to check readme syntax
readme_renderer

View File

@ -8,15 +8,8 @@ from io import open
from setuptools import find_packages, setup from setuptools import find_packages, setup
try:
from pypandoc import convert_file
def read_md(f): def read(f):
return convert_file(f, 'rst')
except ImportError:
print("warning: pypandoc module not found, could not convert Markdown to RST")
def read_md(f):
return open(f, 'r', encoding='utf-8').read() return open(f, 'r', encoding='utf-8').read()
@ -32,10 +25,6 @@ version = get_version('rest_framework')
if sys.argv[-1] == 'publish': if sys.argv[-1] == 'publish':
try:
import pypandoc
except ImportError:
print("pypandoc not installed.\nUse `pip install pypandoc`.\nExiting.")
if os.system("pip freeze | grep twine"): if os.system("pip freeze | grep twine"):
print("twine not installed.\nUse `pip install twine`.\nExiting.") print("twine not installed.\nUse `pip install twine`.\nExiting.")
sys.exit() sys.exit()
@ -56,7 +45,8 @@ setup(
url='http://www.django-rest-framework.org', url='http://www.django-rest-framework.org',
license='BSD', license='BSD',
description='Web APIs for Django, made easy.', description='Web APIs for Django, made easy.',
long_description=read_md('README.md'), long_description=read('README.md'),
long_description_content_type='text/markdown',
author='Tom Christie', author='Tom Christie',
author_email='tom@tomchristie.com', # SEE NOTE BELOW (*) author_email='tom@tomchristie.com', # SEE NOTE BELOW (*)
packages=find_packages(exclude=['tests*']), packages=find_packages(exclude=['tests*']),

View File

@ -5,7 +5,7 @@ envlist =
{py34,py35,py36}-django20, {py34,py35,py36}-django20,
{py35,py36}-django21 {py35,py36}-django21
{py35,py36}-djangomaster, {py35,py36}-djangomaster,
dist,lint,docs,readme, dist,lint,docs,
[travis:env] [travis:env]
DJANGO = DJANGO =
@ -50,8 +50,3 @@ commands = mkdocs build
deps = deps =
-rrequirements/requirements-testing.txt -rrequirements/requirements-testing.txt
-rrequirements/requirements-documentation.txt -rrequirements/requirements-documentation.txt
[testenv:readme]
commands = ./setup.py check -rs
deps =
-rrequirements/requirements-packaging.txt