warehouse: long_description_content_type=text/markdown doesn't always work

This page does not show correctly rendered markdown: https://pypi.org/project/datasette/

2018-04-13 at 2 47 pm

The setup.py file looks like this:

https://github.com/simonw/datasette/blob/fb988ace7c7e2bee5ac142a0eab22431d0675a77/setup.py#L13-L18

setup(
    name='datasette',
    description='An instant JSON API for your SQLite databases',
    long_description=get_long_description(),
    long_description_content_type='text/markdown',
    author='Simon Willison',

According to @ambv on Twitter this is caused by a bug: https://twitter.com/llanga/status/984866099886895104 “There’s a bug now where you need to upload just the tar.gz first with Twine and only then upload the rest of the files.”

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 27 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@scruffystuffs Looking at the metadata of the source distribution of your package, it has Windows-style line endings in the Description, so it looks like you’ve having the same issue as https://github.com/pypa/setuptools/issues/1440

Apparently python setup.py sdist upload is the problem. I will open a new issue about the fact that it’s extremely non-obvious that you have to use “twine”. (I know there’s documentation that says so… but it’s not the documentation that’s linked to when you’re looking for how to set your project description.)

Yep, this is due to building with an old version of wheel which incorrectly sets the Metadata-Version field. Should be fixed by a pip install wheel==0.31.0 and then building/uploading a new distribution.

This problem is still occurring when running python setup.py sdist bdist_wheel and twine upload from a windows machine.

Tested ubuntu 18.04 and windows 10. Ubuntu uploads everything fine, but running the exact same commands from a windows machine causes the above issue to appear with the exact same files.

setuptools, wheel, and twine are all at or beyond the levels specified in the above comments, and are at the same level for both machines.

That worked - I ran pip install wheel==0.31.0 before doing python setup.py bdist_wheel and the result was this page with the markdown correctly formatted: https://pypi.org/project/datasette/

running into similar issues with my team for relative links

Uploaded two example cases to test.pypi.org.

Uploaded from Windows Uploaded from Ubuntu

The files for these distributions should be identical, other than the version number, yet they render entirely differently on the project page.

If any more info is needed, let me know and I will be happy to provide it.

To clarify something: I’m not claiming that PyPI is linking to the Python documentation. PyPI links to packaging.python.org, of course. However, one way that people learn about PyPI in the first place is the Python documentation, where PyPI is described as that place that setup.py upload uploads to.

If you want to update people’s understanding about how to upload Python packages, talking about it on your own blog and mentioning Twine twice on a very long documentation page isn’t enough. You need to make getting the new tools part of the new PyPI user experience.

@di Updating setuptools did the trick! Thanks for the quick reply and so much for the PyPI update!

@rspeer You can use the https://test.pypi.org/ instance to test as well … (and delete tags later or re-try)