Skip to content

long_description_content_type flag in setup.py is ignored. IE #4079 not fixed. #9327

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

Closed
hlovatt opened this issue Apr 2, 2021 · 3 comments
Closed

Comments

@hlovatt
Copy link

hlovatt commented Apr 2, 2021

The long_description_content_type flag in setup.py is still ignored despite original bug #4079 now closed and marked as fixed.

For my setup.py of:

long_description=read_text('README.md'),
long_description_content_type='text/markdown',

I get the following errors:

`long_description` has syntax errors in markup and would not be rendered on PyPI.
line 112: Warning: Inline literal start-string without end-string.
warning: `long_description_content_type` missing. defaulting to `text/x-rst`.

The syntax error is not correct, the README renders on everything I have tried!

Therefore suspect that long_description_content_type error, which isn't missing, is the problem!

All files at:

https://github.com/hlovatt/statmach

@di
Copy link
Member

di commented Apr 2, 2021

Hi, can you attach the built distributions you're attempting to upload?

@ewjoachim
Copy link
Contributor

ewjoachim commented Apr 2, 2021

TL;DR, most probably:

Replace license=read_text('LICENSE') with license="MIT License"


Hello,

I've tried your files at hlovatt/statmach. More precisely, I've tried the following command:

python setup.py sdist && twine check --strict dist/*

As you'll notice, this command doesn't involve PyPI: it builds the package, and then checks it using Twine (nothing is sent).

Even if the current state of your master branch replaces the long description:

long_description=f'See {statmach.__repository__} for detailed description.\n',  # read_text('README.md'),

it still seems to fail with:

Checking dist/statmach-1.0.8.tar.gz: FAILED, due to warnings
  warning: `long_description_content_type` missing. defaulting to `text/x-rst`.

Replacing the line with:

long_description=read_text('README.md'),

doesn't change the check output, so it seems the problem is elsewhere.

The problem seems to be that you're loading the entire license file in the license field rather than just a single-line string, such as MIT License. Multiline strings create problems with setuptools as seen in #9315.

The fix is to only let long_description contain newlines. This is not #4079.
Of course, if pypa/setuptools#1390 gets resolve, this would also fix your issue.

I cannot guarantee that your problem is this, and that there isn't any other problem hiding behind but I can say that having multiple lines in the license field as in the project you linked will produce the error you mentionned.

@hlovatt
Copy link
Author

hlovatt commented Apr 5, 2021

Many thanks for the help. Multiline license text is indeed the problem.

@hlovatt hlovatt closed this as completed Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants