6
votes

I uploaded a package to pypi.org but my RST README isn't formatted correctly.

This is what it looks like on GitHub: https://github.com/NinjaSnail1080/akinator.py

This is what it looks like on PyPi: https://pypi.org/project/akinator.py/

For some reason, on GitHub everything is formatted correctly, but on PyPi, it isn't formatted at all. Instead of showing the README formatted in RST, it's just a complete mess of unformatted text.

I tried running python3 -m twine check dist/* on my project and got this:

Checking distribution dist/akinator.py-1.0.3.dev3-py3-none-any.whl: warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.
Failed
The project's long_description has invalid markup which will not be rendered on PyPI. The following syntax errors were detected:
line 26: Error: Unexpected indentation.
Checking distribution dist/akinator.py-1.0.3.dev3.tar.gz: warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.
Failed
The project's long_description has invalid markup which will not be rendered on PyPI. The following syntax errors were detected:
line 26: Error: Unexpected indentation.
line 26: Error: Unexpected indentation.

For some reason, it says the long_description_content_type is missing, which is untrue. My setup.py file specifically says long_description_content_type="text/x-rst". It also mentions unexpected indentations in line 26 of the long description, but there are no indentations at all in that line.

I have absolutely no idea what I did wrong here. Somehow, it looks perfectly fine on GitHub, but on PyPi, it's just a mess. And the warnings that twine check gave me don't make any sense.

2
Try upgrading setuptools and regenerate distributions.phd

2 Answers

5
votes

The issue is that you're including your entire license in the License field, but this field is only supposed to be a short description or name of the license -- it should not contain newlines.

This is producing the following metadata:

Metadata-Version: 2.1
Name: akinator.py
Version: 1.0.3.dev2
Summary: An API wrapper for the online game, Akinator, written in Python
Home-page: https://github.com/NinjaSnail1080/akinator.py
Author: NinjaSnail1080
Author-email: [email protected]
License: MIT License

Copyright (c) 2019 NinjaSnail1080

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

Where everything after the first newline is interpreted as the Long-Description.

To fix this, just set license="MIT", or omit it entirely -- it's optional, and you already have it in your list of classifiers.

There is an outstanding bug to fix this in setuptools here: https://github.com/pypa/setuptools/issues/1390

1
votes

I had just the same symptoms. Using python3.7 instead of python3.6 helped:

python3.7 setup.py sdist bdist_wheel

OS: Ubuntu 18.04.2 LTS