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

HTTPError: 400 Client Error: The description failed to render in the default format of reStructuredText #5890

Closed
evandrocoan opened this issue May 21, 2019 · 18 comments
Labels
help needed We'd love volunteers to advise on or help fix/implement this.

Comments

@evandrocoan
Copy link

Related: #5855 The description failed to render in the default format of reStructuredText

$ rm -rf ./dist && python3 setup.py sdist && twine upload dist/*
running sdist
running check
F:\Python\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'long_description_content_type'
  warnings.warn(msg)
warning: check: missing meta-data: if 'author' supplied, 'author_email' must be supplied too

warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list)

writing manifest file 'MANIFEST'
creating fastfilepackage-1.0.6
creating fastfilepackage-1.0.6\source
creating fastfilepackage-1.0.6\source\cppimplementation
creating fastfilepackage-1.0.6\source\fastfilepackage
making hard links in fastfilepackage-1.0.6...
hard linking LICENSE.txt -> fastfilepackage-1.0.6
hard linking README -> fastfilepackage-1.0.6
hard linking README.md -> fastfilepackage-1.0.6
hard linking setup.cfg -> fastfilepackage-1.0.6
hard linking setup.py -> fastfilepackage-1.0.6
hard linking source/cppimplementation\fastfile.cpp -> fastfilepackage-1.0.6\source/cppimplementation
hard linking source/cppimplementation\fastfilewrapper.cpp -> fastfilepackage-1.0.6\source/cppimplementation
hard linking source\fastfilepackage\__init__.py -> fastfilepackage-1.0.6\source\fastfilepackage
hard linking source\fastfilepackage\version.py -> fastfilepackage-1.0.6\source\fastfilepackage
creating dist
Creating tar archive
removing 'fastfilepackage-1.0.6' (and everything under it)
Enter your username: addons_zz
Uploading distributions to https://upload.pypi.org/legacy/
Uploading fastfilepackage-1.0.6.tar.gz
100%|##########| 19.4k/19.4k [00:01<00:00, 16.1kB/s]
NOTE: Try --verbose to see response content.
HTTPError: 400 Client Error: The description failed to render in the default format of reStructuredText. See https://pypi.org/help/#description-content-type for more information. for url: https://upload.pypi.org/legacy/

Contents of fastfilepackage-1.0.6.tar.gz:

  1. image
  2. image

i.e., README.md is present on the package file and its contents are just simple markdown.

$ pip list
Package                  Version    
------------------------ ---------- 
twine                    1.13.0
setuptools               41.0.1
wheel                    0.33.4
...

I only manage to upload the package by commenting out these 2 lines:

        # long_description = readme_contents,
        # long_description_content_type='text/markdown',

https://github.com/evandrocoan/fastfilepackage/blob/master/setup.py

Then, I was able to upload things successfully:

$ rm -rf ./dist && python3 setup.py sdist && twine upload dist/*
running sdist
running check
warning: check: missing meta-data: if 'author' supplied, 'author_email' must be supplied too

warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list)

warning: sdist: standard file not found: should have one of README, README.txt, README.rst

writing manifest file 'MANIFEST'
creating fastfilepackage-1.0.6
creating fastfilepackage-1.0.6\source
creating fastfilepackage-1.0.6\source\cppimplementation
creating fastfilepackage-1.0.6\source\fastfilepackage
making hard links in fastfilepackage-1.0.6...
hard linking LICENSE.txt -> fastfilepackage-1.0.6
hard linking README.md -> fastfilepackage-1.0.6
hard linking setup.cfg -> fastfilepackage-1.0.6
hard linking setup.py -> fastfilepackage-1.0.6
hard linking source/cppimplementation\fastfile.cpp -> fastfilepackage-1.0.6\source/cppimplementation
hard linking source/cppimplementation\fastfilewrapper.cpp -> fastfilepackage-1.0.6\source/cppimplementation
hard linking source\fastfilepackage\__init__.py -> fastfilepackage-1.0.6\source\fastfilepackage
hard linking source\fastfilepackage\version.py -> fastfilepackage-1.0.6\source\fastfilepackage
creating dist
Creating tar archive
removing 'fastfilepackage-1.0.6' (and everything under it)
Enter your username: addons_zz
Uploading distributions to https://upload.pypi.org/legacy/
Uploading fastfilepackage-1.0.6.tar.gz
100%|##########| 17.3k/17.3k [00:03<00:00, 5.78kB/s]

If I replace distutils.core.setup by setuptools.setup everything works fine without having to remove the long_description and long_description_content_type lines. But I use distutils.core.setup instead of setuptools.setup in my project because I do not know how to build Python C API with setuptools.setup. Everywhere I look on internet just tells me how to build Python C Extensions with distutils.core.setup. No one ever uses setuptools.setup.

@evandrocoan
Copy link
Author

evandrocoan commented May 21, 2019

I just manage to upload it by replacing:

from distutils.core import setup, Extension

With:

from setuptools import setup, Extension
  1. https://docs.python.org/3/library/distutils.html
  2. https://docs.python.org/3/extending/newtypes_tutorial.html
  3. https://stackoverflow.com/questions/12856931/how-to-put-my-python-c-module-inside-package
  4. https://stackoverflow.com/questions/42585210/extending-setuptools-extension-to-use-cmake-in-setup-py

@auvipy
Copy link

auvipy commented May 21, 2019

facing this error

twine upload --repository pypi dist/*
Enter your username: auvipy
ERROR:dbus.proxies:Introspect error on :1.402:/modules/kwalletd5: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
/usr/local/lib/python3.7/dist-packages/twine/utils.py:238: UserWarning: Failed to open keyring: org.freedesktop.DBus.Error.ServiceUnknown: The name :1.402 was not provided by any .service files.
warnings.warn(str(exc))
Enter your password:
Uploading distributions to https://upload.pypi.org/legacy/
Uploading django_celery_beat-1.5.0-py2.py3-none-any.whl
100%|██████████████████████████████████████| 50.5k/50.5k [00:02<00:00, 20.5kB/s]
NOTE: Try --verbose to see response content.
HTTPError: 400 Client Error: The description failed to render in the default format of reStructuredText. See https://pypi.org/help/#description-content-type for more information. for url: https://upload.pypi.org/legacy/

@spyoungtech
Copy link

spyoungtech commented May 22, 2019

I was also having this problem suddenly, even though my setup.py and README.rst have not changed since the last successful deploy.

I am using the travis-ci PyPI deploy feature.

In my case, the extended error was as follows (as produced by twine check)

The project's long_description has invalid markup which will not be rendered on PyPI. The following syntax errors were detected:
line 220: Warning: Cannot analyze code. No Pygments lexer found for "guess".
line 220: Warning: Cannot analyze code. No Pygments lexer found for "guess".

Which was odd because this previously worked... and is accepted by sphinx/rtd. Simply removing the specification let the upload work.

Related: spyoungtech/behave-webdriver#77

@di
Copy link
Member

di commented May 22, 2019

Folks arriving at this issue: The cause is that in #5835 we merged a change which blocks uploads that have an invalid long_description that we won't be able to render. This is intentional and not a bug.

Before, the behavior was that if the reStructuredText or metadata was invalid, we would just fall back to a plaintext. Now, to prevent unrendered descriptions on PyPI, we just block the upload instead.

Depending on what format you're using for your long_description, there's two solutions here:

If you're using a reStructuredText long_description:

Your long_description is invalid and will not render. You should upgrade twine:

$ pip install -U twine

And then check your distributions for invalid markup:

$ twine check dist/*

And fix the errors that it reports.

If you're using a Markdown long_description:

The metadata for your distribution is invalid and is not specifying Markdown.

This means that either you haven't set long_description_content_type='text/markdown', in your setup.py file, or that the tools that you're using are out of date and don't support this metadata field. Upgrade them to latest:

$ pip install -U twine wheel setuptools

Remove previous distributions:

$ rm -rf dist

Rebuild your distributions:

$ python setup.py sdist
$ python setup.py bdist_wheel

Check that the distributions are valid:

$ twine check dist/*

@di di pinned this issue May 22, 2019
chungg added a commit to chungg/gnocchi that referenced this issue May 28, 2019
seems long_description needs to render cleanly to upload to pypi

pypi/warehouse#5890
chungg added a commit to chungg/gnocchi that referenced this issue May 28, 2019
seems long_description needs to render cleanly to upload to pypi:
pypi/warehouse#5890

related: gnocchixyz#1025
mergify bot pushed a commit to gnocchixyz/gnocchi that referenced this issue May 28, 2019
seems long_description needs to render cleanly to upload to pypi:
pypi/warehouse#5890

related: #1025
mergify bot pushed a commit to gnocchixyz/gnocchi that referenced this issue May 29, 2019
seems long_description needs to render cleanly to upload to pypi:
pypi/warehouse#5890

related: #1025
(cherry picked from commit d12a3fb)

# Conflicts:
#	setup.cfg
mergify bot pushed a commit to gnocchixyz/gnocchi that referenced this issue May 29, 2019
seems long_description needs to render cleanly to upload to pypi:
pypi/warehouse#5890

related: #1025
(cherry picked from commit d12a3fb)
chungg added a commit to gnocchixyz/gnocchi that referenced this issue May 30, 2019
seems long_description needs to render cleanly to upload to pypi:
pypi/warehouse#5890

related: #1025
(cherry picked from commit d12a3fb)
vavarachen added a commit to vavarachen/splunk_hec_handler that referenced this issue May 31, 2019
@pradyunsg
Copy link
Contributor

@di would it be possible to add this information to the FAQ and link to that from the error message?

@yeraydiazdiaz yeraydiazdiaz unpinned this issue Jun 2, 2019
@yeraydiazdiaz yeraydiazdiaz pinned this issue Jun 2, 2019
@di di added the support label Jun 5, 2019
triplepoint pushed a commit to crunchyroll/ef-open that referenced this issue Jun 6, 2019
triplepoint pushed a commit to crunchyroll/ef-open that referenced this issue Jun 6, 2019
@brainwane brainwane added the help needed We'd love volunteers to advise on or help fix/implement this. label Jun 7, 2019
gleitz added a commit to gleitz/howdoi that referenced this issue Jun 15, 2019
phillbaker added a commit to suds-community/suds that referenced this issue Jun 28, 2019
openstack-gerrit pushed a commit to openstack-archive/ansible-role-redhat-subscription that referenced this issue Jul 1, 2019
Tell to pypi to convert long_description to markdown format.

pypi/warehouse#5890 (comment)

Change-Id: Id74d08c36b421f1b11f7cfeece1a77306ec138c0
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Jul 1, 2019
* Update ansible-role-redhat-subscription from branch 'master'
  - Fix issue with long description by using markdown format
    
    Tell to pypi to convert long_description to markdown format.
    
    pypi/warehouse#5890 (comment)
    
    Change-Id: Id74d08c36b421f1b11f7cfeece1a77306ec138c0
@4383

This comment has been minimized.

@di

This comment has been minimized.

@4383

This comment has been minimized.

@di

This comment has been minimized.

@daneads

This comment has been minimized.

@4383

This comment has been minimized.

@di

This comment has been minimized.

@4383

This comment has been minimized.

@di

This comment has been minimized.

@Jonathan-LeRoux

This comment has been minimized.

@jamadden

This comment has been minimized.

@Jonathan-LeRoux

This comment has been minimized.

openstack-gerrit pushed a commit to openstack-archive/puppet-pacemaker that referenced this issue Jul 15, 2019
Recently the pypi team have reintroduce some deactivated tests
on package deployment and especially tests concerning long_description
syntaxe.

If projects don't specify that they use the markdown format the
package deployment will fail if something went wrong in the markdown format.

By example if a project use inline literal this can be an issue due to
the fact that if `long_description_content_type` is missing [1]. The
default format will be `text/x-rst` where code block is different from
markdown.

These changes force to use the markdown format to avoid this kind of issue
on project who use `README` at markdown format.

[1] http://lists.openstack.org/pipermail/openstack-discuss/2019-July/007459.html

For more details:
pypi/warehouse#5890 (comment)

Change-Id: I6eb24615b08d1d2f8a90bb1d871256fe9abcd99f
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Jul 15, 2019
* Update puppet-pacemaker from branch 'master'
  - Force to use markdown to prevent pypi issue
    
    Recently the pypi team have reintroduce some deactivated tests
    on package deployment and especially tests concerning long_description
    syntaxe.
    
    If projects don't specify that they use the markdown format the
    package deployment will fail if something went wrong in the markdown format.
    
    By example if a project use inline literal this can be an issue due to
    the fact that if `long_description_content_type` is missing [1]. The
    default format will be `text/x-rst` where code block is different from
    markdown.
    
    These changes force to use the markdown format to avoid this kind of issue
    on project who use `README` at markdown format.
    
    [1] http://lists.openstack.org/pipermail/openstack-discuss/2019-July/007459.html
    
    For more details:
    pypi/warehouse#5890 (comment)
    
    Change-Id: I6eb24615b08d1d2f8a90bb1d871256fe9abcd99f
openstack-gerrit pushed a commit to openstack-archive/puppet-tripleo that referenced this issue Jul 15, 2019
Recently the pypi team have reintroduce some deactivated tests
on package deployment and especially tests concerning long_description
syntaxe.

If projects don't specify that they use the markdown format the
package deployment will fail if something went wrong in the markdown format.

By example if a project use inline literal this can be an issue due to
the fact that if `long_description_content_type` is missing [1]. The
default format will be `text/x-rst` where code block is different from
markdown.

These changes force to use the markdown format to avoid this kind of issue
on project who use `README` at markdown format.

[1] http://lists.openstack.org/pipermail/openstack-discuss/2019-July/007459.html

For more details:
pypi/warehouse#5890 (comment)

Change-Id: If1be877b265f36078a5e66a13b7ab55db699af0f
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Jul 15, 2019
* Update puppet-tripleo from branch 'master'
  - Merge "Force to use markdown to prevent pypi issue"
  - Force to use markdown to prevent pypi issue
    
    Recently the pypi team have reintroduce some deactivated tests
    on package deployment and especially tests concerning long_description
    syntaxe.
    
    If projects don't specify that they use the markdown format the
    package deployment will fail if something went wrong in the markdown format.
    
    By example if a project use inline literal this can be an issue due to
    the fact that if `long_description_content_type` is missing [1]. The
    default format will be `text/x-rst` where code block is different from
    markdown.
    
    These changes force to use the markdown format to avoid this kind of issue
    on project who use `README` at markdown format.
    
    [1] http://lists.openstack.org/pipermail/openstack-discuss/2019-July/007459.html
    
    For more details:
    pypi/warehouse#5890 (comment)
    
    Change-Id: If1be877b265f36078a5e66a13b7ab55db699af0f
chungg added a commit to gnocchixyz/gnocchi that referenced this issue Jul 23, 2019
seems long_description needs to render cleanly to upload to pypi:
pypi/warehouse#5890

related: #1025
(cherry picked from commit d12a3fb)
mergify bot pushed a commit to gnocchixyz/gnocchi that referenced this issue Jul 23, 2019
seems long_description needs to render cleanly to upload to pypi:
pypi/warehouse#5890

related: #1025
(cherry picked from commit d12a3fb)
illumon-public pushed a commit to illumon-public/illumon-jpy that referenced this issue Jul 30, 2019
@nlhkabu nlhkabu unpinned this issue Jul 31, 2019
illumon-public pushed a commit to illumon-public/illumon-jpy that referenced this issue Aug 1, 2019
* release/sultan:
  added long_description_content_type to fix pypi/warehouse#5890
@di
Copy link
Member

di commented Aug 15, 2019

Going to close this as there's nothing to do here. If you have followed the steps in #5890 (comment) and are still experiencing this, please open a new issue.

@di di closed this as completed Aug 15, 2019
@pypi pypi locked as resolved and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help needed We'd love volunteers to advise on or help fix/implement this.
Projects
None yet
Development

No branches or pull requests

10 participants