Skip to content

long_description_content_type flag in setup.py seems to (still) be ignored on upload. #9315

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
phseiff opened this issue Mar 31, 2021 · 5 comments
Labels
needs discussion a product management/policy issue maintainers and users should discuss

Comments

@phseiff
Copy link

phseiff commented Mar 31, 2021

Describe the bug

I am having the same problem as the one described in #4079 - my project isn't accepted by PyPi because its README isn't valid reStructuredText, even though long_descripton_content_type is specified as text/markdown.
However, the issue isn't solved for me by upgrading pip, twine, wheel and setuptools, like this comment suggested, and it was not solved by using twine rather than using setup.py bdist_wheel upload, like the comment additionally suggested.

Expected behavior

The package uploads correctly since long_description_content_type is set to text/markdown

To Reproduce

The pipeline that is supposed to upload the Package to PyPi can be found here, and the project I am trying to publish to PyPi can be found here, so you should be able to reproduce the issue.
It's also worth noting that uploading to PyPi worked fine with older versions of the project, which is why I assume that the commands I use and my README are correct and the problem is a (new or old) issue with warehouse.

My Platform

I am using Python 3.6 on Ubuntu 18.04 (using the GitHub actions CLI)

Additional Context

I mentioned this issue as a comment under #4079, but now I noticed that according to @di, people encountering similar issues with Description-Content-Type should raise a new issue, which I am hereby doing.

Thanks for any help you might be able to provide with this problem!

@di
Copy link
Member

di commented Mar 31, 2021

Looking at your build pipeline, I think this may be due to out of date versions of twine or setuptools resulting from mixing sudo pip3 and pip3 commands, or only using python3 and not sudo python3, etc.

I'd recommend adding the following to your pipeline immediately before python3 setup.py sdist and sharing the output here:

pip3 freeze
sudo pip3 freeze

This may also be due to pypa/setuptools#1390. Looking at https://github.com/phseiff/gender-render/blob/main/setup.py, you've got some \ and \n characters in your description and license fields that shouldn't be there. I'd recommend removing those as well.

@di di added the needs discussion a product management/policy issue maintainers and users should discuss label Mar 31, 2021
phseiff added a commit to phseiff/gender-render that referenced this issue Mar 31, 2021
@pradyunsg
Copy link
Contributor

You'd want to do pip3 freeze --all, because otherwise setuptools is hidden. (same for the sudo variant)

@phseiff
Copy link
Author

phseiff commented Mar 31, 2021

I'd recommend adding the following to your pipeline immediately before python3 setup.py sdist and sharing the output here

Thank you very much; I did that now. The full requested output can be found in this gist.

you've got some \ and \n characters in your description and license fields that shouldn't be there.

Thanks for pointing this out to me! I removed the \n character now. To my understanding, though, a \-character at the end of a line is a continuation symbol; for example,

foo = "foobar\
baz"

is similar to

foo = ("foboar"
       + "baz")

in that it makes no difference to the value of foo and serves the purpose of staying within the characters-per-line limit defined by PEP8 (or the project in question), unless I misunderstand something?

Since the \n-character was part of the license and not of the description in setup.py, and since uploading to test.pypi.org with said \n character in the license worked for me some time ago, I would've assumed that the problem was indeed caused by using sudo and not by pypa/setuptools#1390.
However, adding pip3 freeze to the pipeline and removing the \n character from the license field in setup.py somehow solved the problem, and the program was successfully pushed to test.pypi.org.

You'd want to do pip3 freeze --all, because otherwise setuptools is hidden. (same for the sudo variant)

Thanks for the hint; I will do this and share the output here in some minutes (edit: seems like that won't be necessary anymore).

phseiff added a commit to phseiff/gender-render that referenced this issue Mar 31, 2021
@di
Copy link
Member

di commented Mar 31, 2021

Yeah, this was definitely pypa/setuptools#1390 then. The same issue exists for all fields, not just the description field, but it often has the effect of seeming to break the description.

I'm going to close this issue as resolved, but I'd encourage you to share this in pypa/setuptools#1390 as I wouldn't really consider that issue to be resolved, since it's clear this is still a problem.

@di di closed this as completed Mar 31, 2021
@phseiff
Copy link
Author

phseiff commented Mar 31, 2021

Thanks again for helping me figure out the problem, then. I will be sure to share this in pypa/setuptools#1390 sometime around 👍.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs discussion a product management/policy issue maintainers and users should discuss
Projects
None yet
Development

No branches or pull requests

3 participants