warehouse: HTTPError: 400 Client Error: The description failed to render in the default format of reStructuredText
Related: https://github.com/pypa/warehouse/issues/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:
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.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 18 (8 by maintainers)
Commits related to this issue
- cleanup README.rst to upload to pypi seems long_description needs to render cleanly to upload to pypi https://github.com/pypa/warehouse/issues/5890 — committed to chungg/gnocchi by chungg 5 years ago
- cleanup README.rst to upload to pypi seems long_description needs to render cleanly to upload to pypi: https://github.com/pypa/warehouse/issues/5890 related: #1025 — committed to chungg/gnocchi by chungg 5 years ago
- cleanup README.rst to upload to pypi seems long_description needs to render cleanly to upload to pypi: https://github.com/pypa/warehouse/issues/5890 related: #1025 — committed to gnocchixyz/gnocchi by chungg 5 years ago
- cleanup README.rst to upload to pypi seems long_description needs to render cleanly to upload to pypi: https://github.com/pypa/warehouse/issues/5890 related: #1025 (cherry picked from commit d12a3fb... — committed to gnocchixyz/gnocchi by chungg 5 years ago
- cleanup README.rst to upload to pypi seems long_description needs to render cleanly to upload to pypi: https://github.com/pypa/warehouse/issues/5890 related: #1025 (cherry picked from commit d12a3fb... — committed to gnocchixyz/gnocchi by chungg 5 years ago
- cleanup README.rst to upload to pypi seems long_description needs to render cleanly to upload to pypi: https://github.com/pypa/warehouse/issues/5890 related: #1025 (cherry picked from commit d12a3fb... — committed to gnocchixyz/gnocchi by chungg 5 years ago
- Updated setup.py to address recent pypi changes. https://github.com/pypa/warehouse/issues/5890#issuecomment-494868157 — committed to vavarachen/splunk_hec_handler by vavarachen 5 years ago
- Add the long description type to the setup.py, to address a failure to publish bug Turns out, they changed stuff in pypi's codebase: https://github.com/pypa/warehouse/pull/5835 https://github.com/pyp... — committed to crunchyroll/ef-open by deleted user 5 years ago
- Add the long description type to the setup.py, to address a failure to publish bug (#124) Turns out, they changed stuff in pypi's codebase: https://github.com/pypa/warehouse/pull/5835 https://githu... — committed to crunchyroll/ef-open by deleted user 5 years ago
- Fix issue with long description https://github.com/pypa/warehouse/issues/5890#issuecomment-494868157 — committed to gleitz/howdoi by gleitz 5 years ago
- Specify long description format, fix deploy. Ref: https://github.com/pypa/warehouse/issues/5890 — committed to suds-community/suds by phillbaker 5 years ago
- Fix issue with long description by using markdown format Tell to pypi to convert long_description to markdown format. https://github.com/pypa/warehouse/issues/5890#issuecomment-494868157 Change-Id:... — committed to openstack-archive/ansible-role-redhat-subscription by 4383 5 years ago
- Update git submodules * 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 ... — committed to openstack/openstack by 4383 5 years ago
- 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... — committed to openstack-archive/puppet-pacemaker by 4383 5 years ago
- Update git submodules * Update puppet-pacemaker from branch 'master' - Force to use markdown to prevent pypi issue Recently the pypi team have reintroduce some deactivated tests on pac... — committed to openstack/openstack by 4383 5 years ago
- 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... — committed to openstack-archive/puppet-tripleo by 4383 5 years ago
- Update git submodules * 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 t... — committed to openstack/openstack by deleted user 5 years ago
- cleanup README.rst to upload to pypi seems long_description needs to render cleanly to upload to pypi: https://github.com/pypa/warehouse/issues/5890 related: #1025 (cherry picked from commit d12a3fb... — committed to gnocchixyz/gnocchi by chungg 5 years ago
- cleanup README.rst to upload to pypi seems long_description needs to render cleanly to upload to pypi: https://github.com/pypa/warehouse/issues/5890 related: #1025 (cherry picked from commit d12a3fb... — committed to gnocchixyz/gnocchi by chungg 5 years ago
- added long_description_content_type to fix https://github.com/pypa/warehouse/issues/5890 — committed to illumon-public/illumon-jpy by devinrsmith 5 years ago


Folks arriving at this issue: The cause is that in #5835 we merged a change which blocks uploads that have an invalid
long_descriptionthat 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_descriptionis invalid and will not render. You should upgradetwine:And then check your distributions for invalid markup:
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 yoursetup.pyfile, or that the tools that you’re using are out of date and don’t support this metadata field. Upgrade them to latest:Remove previous distributions:
Rebuild your distributions:
Check that the distributions are valid:
I just manage to upload it by replacing:
With:
I was also having this problem suddenly, even though my
setup.pyandREADME.rsthave 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)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