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

Twine check incorrectly reports long_description_content_type missing #454

Closed
martisak opened this issue Feb 14, 2019 · 11 comments
Closed
Labels
support Users asking for help using twine

Comments

@martisak
Copy link

martisak commented Feb 14, 2019

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

  1. 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)
  1. 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

@sigmavirus24
Copy link
Member

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).

@martisak
Copy link
Author

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

@di
Copy link
Sponsor Member

di commented Feb 15, 2019

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 pypa/setuptools#1390.

martisak added a commit to martisak/3gpp-citations that referenced this issue Feb 15, 2019
The issue is that the multiple lines in the `License` field are causing the
rest of the file to be interpreted as the `Long-Description`.

See pypa/twine#454 and
pypa/setuptools#1390
@martisak
Copy link
Author

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

ybastide added a commit to botify-labs/simpleflow that referenced this issue May 15, 2019
See pypa/twine#454 (comment): the
"license" field should be a single statement (content other than the
description with double newlines breaks the metadata).

Signed-off-by: Yves Bastide <yves@botify.com>
sharkykh referenced this issue in tox-dev/filelock May 18, 2019
fhightower added a commit to ioc-fang/ioc-fanger that referenced this issue Jun 4, 2019
@xuhdev
Copy link

xuhdev commented Jun 23, 2019

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

nedrebo added a commit to zivid/zivid-python that referenced this issue Jul 2, 2019
The full license text breaks PKG-INFO.
pypa/twine#454 (comment)

Also added PyPI supported classifier for the BSD license
nedrebo added a commit to zivid/zivid-python that referenced this issue Jul 2, 2019
The full license text breaks PKG-INFO.
pypa/twine#454 (comment)

Also added PyPI supported classifier for the BSD license
@mikofski
Copy link

mikofski commented Jul 5, 2019

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.

@sigmavirus24
Copy link
Member

@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.

@mikofski
Copy link

mikofski commented Jul 6, 2019

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!

@sigmavirus24
Copy link
Member

@mikofski I suspect it's the version of setuptools

matthewbalvanz-wf added a commit to pact-foundation/pact-python that referenced this issue Oct 1, 2019
This value is intended to be the name of the license with the
details being included in a LICENSE file in the .tar.gz.

pypa/twine#454 (comment)
pchtsp added a commit to pchtsp/pulp-or that referenced this issue Oct 31, 2019
stumitchell pushed a commit to coin-or/pulp that referenced this issue Nov 4, 2019
stumitchell added a commit to coin-or/pulp that referenced this issue Nov 4, 2019
…ed by adding the license text as an argument in setup.py (pypa/twine#454) (#235)"

This reverts commit 9dad3b4.
shaycrk added a commit to dssg/triage that referenced this issue Dec 16, 2019
Avoid reading the entire license in setup.py as this gets apparently interpreted by twine as the long description. Instead, set license simply to the name of the type of license. See discussion here: pypa/twine#454
Julian added a commit to Julian/mkpkg that referenced this issue Jan 24, 2020
See pypa/twine#454 for a way to catch this via CI.
Julian added a commit to python-jsonschema/jsonschema that referenced this issue Jan 24, 2020
See pypa/twine#454 for a way to catch this via CI.
Julian added a commit to Julian/venvs that referenced this issue Jan 24, 2020
See pypa/twine#454 for a way to catch this via CI.
Julian added a commit to Julian/svmlight-loader that referenced this issue Jan 26, 2020
See pypa/twine#454 for a way to catch this via CI.
Julian added a commit to Julian/regret that referenced this issue Jan 26, 2020
See pypa/twine#454 for a way to catch this via CI.
willu47 pushed a commit to willu47/amply that referenced this issue Mar 31, 2020
…ding the license text as an argument in setup.py (pypa/twine#454) (#235)
sandinmyjoints added a commit to sandinmyjoints/fold_to_ascii that referenced this issue May 3, 2020
sanvyruz added a commit to sanvyruz/pordego-dependency that referenced this issue May 5, 2020
@jxmorris12
Copy link

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!

@uburuntu
Copy link

uburuntu commented May 16, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Users asking for help using twine
Projects
Better `check`
  
Support requests
Development

No branches or pull requests

8 participants