Twine: Twine check incorrectly reports `long_description_content_type` missing

Created on 14 Feb 2019  路  11Comments  路  Source: pypa/twine

Your Environment

Thank you for taking the time to report an issue.

To more efficiently resolve this issue, we'd like to know some basic information about your system and setup.

1) Your operating system:
Mac OS X

2) Version of python you are running:
Python 3.7.2

3) How did you install twine? Did you use your operating system's package manager or pip or something else?

pip install twine==1.13.0

4) Version of twine you have installed (include complete output of):

Not working

twine version 1.13.0 (pkginfo: 1.5.0.1, requests: 2.21.0, setuptools: 40.8.0,
requests-toolbelt: 0.9.1, tqdm: 4.31.1)

Working

twine version 1.12.1 (pkginfo: 1.5.0.1, requests: 2.21.0, setuptools: 40.8.0,
requests-toolbelt: 0.9.1, tqdm: 4.31.1)

5) Which package repository are you targeting?
PyPI

If you're having issues uploading a specific package, you must include a copy of the following:

  • The package's PKG-INFO file
  • A redacted version of your .pypirc file (REMOVE ALL USERNAMES & PASSWORDS BEFORE UPLOADING)

The Issue

With Twine 1.13.1 twine check dist/* reports

Checking distribution dist/3gpp_citations-1.1.2-py3-none-any.whl: warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.

and PKG-INFO is missing Description-Content-Type: text/markdown.
With Twine 1.12.1 PKG-INFO correctly contains Description-Content-Type: text/markdown

Steps to Reproduce

If the issue is predictable and consistently reproducible, please list the steps here.

  1. Add long_description_content_type='text/markdown' to your setup.py.
setup(
...
    long_description=open('README.md').read(),
    long_description_content_type='text/markdown',
...
)
  1. Install Twine 1.12.1 and build
pip install twine==1.12.1
python setup.py sdist
twine check dist/*

This will result in Checking distribution dist/mypackage.tar.gz: Passed
PKG-INFO correctly contains Description-Content-Type: text/markdown

  1. Install Twine 1.13.0 and build
pip install twine==1.13.0
python setup.py sdist
twine check dist/*

This will result in

Checking distribution dist/mypackage.tar.gz: warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.
Passed

PKG-INFO is missing Description-Content-Type: text/markdown.

PKG-INFO.txt

support

Most helpful comment

The issue is that the multiple lines in your License field are causing the rest of the file to be interpreted as the Long-Description. This field should not be your entire license text, it should be just "MIT License", and you should include a LICENSE file in your distribution.

Essentially a duplicate of https://github.com/pypa/setuptools/issues/1390.

All 11 comments

Can you please upload both PKG-INFO files? To be clear, twine does not modify them, so we'll need more information about your system(s).

I have attached the PKG-INFO above. Interestingly, today I still get an error message from twine check dist/*, but the text is there in PKG-INFO. There is no difference in the output between 1.12.1 and 1.13.0 now, the difference is in the error message.

Twine 1.13.0

Checking distribution dist/3gpp-citations-1.1.3.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 56: Error: Unexpected indentation.
line 56: Error: Unexpected indentation.

Twine 1.12.1

Checking distribution dist/3gpp-citations-1.1.3.tar.gz: Failed
The project's long_description has invalid markup which will not be rendered on PyPI. The following syntax errors were detected:
line 56: Error: Unexpected indentation.
line 56: Error: Unexpected indentation.

You can see the full code on https://github.com/martisak/3gpp-citations

The issue is that the multiple lines in your License field are causing the rest of the file to be interpreted as the Long-Description. This field should not be your entire license text, it should be just "MIT License", and you should include a LICENSE file in your distribution.

Essentially a duplicate of https://github.com/pypa/setuptools/issues/1390.

Oh, nice! Everything worked after that, thanks a million @di !

@di If this is the case, is it better to emit a warning in case the license field has more than one line?

In bifacialvf package setup, the content-type is given (and in PKG-INFO) and the license is only 1-line (3-letters) "BSD" and yet with twine-1.13 on windows with Python-3.7 I also get this weird error:

$ twine check dist/*
Checking distribution dist/bifacialvf-0.1.7-py3-none-any.whl: warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.
Passed
Checking distribution dist/bifacialvf-0.1.7.tar.gz: warning: `long_description_content_type` missing.  defaulting to `text/x-rst`.
Passed

but it works with twine-1.12.1

I think this is still a legit issue, and I haven't seen a fix for it in this thread other than downgrading.

@mikofski it appears your situation is different from everyone else's in this thread. Please open a new issue and provide all of the information requested.

FYI: everything worked fine on my mac os x, with twine-1.13, so there may be something to do with the env on my pc. I will dig deeper, and open a new issue of I can't resolve. Thanks so much!

@mikofski I suspect it's the version of setuptools

This happened to me today and took around an hour to find this post and fix. The error wasn't with long_description at all; it was with license. A better error message would've saved me quite a bit of time. Thanks!

I spent an hour too. Only this suddenly helped me (all versions was up to date):
pip install readme_renderer[md]

Was this page helpful?
0 / 5 - 0 ratings

Related issues

myw picture myw  路  3Comments

brainwane picture brainwane  路  10Comments

shivam-kotwalia picture shivam-kotwalia  路  4Comments

bhrutledge picture bhrutledge  路  4Comments

cs01 picture cs01  路  5Comments