warehouse: `long_description_content_type` flag in setup.py seems to be ignored on upload.
Describe the bug I have a python package on PyPi that just (as of the last ~4-5 days) now fails to upload, with a new error:
durr@rwpscrape /m/S/S/WebRequest> python3 setup.py sdist upload
[snip build process]
Submitting dist/WebRequest-0.0.28.tar.gz to https://upload.pypi.org/legacy/
Upload failed (400): The description failed to render in the default format of reStructuredText. See https://pypi.org/help/#description-content-type for more information.
error: Upload failed (400): The description failed to render in the default format of reStructuredText. See https://pypi.org/help/#description-content-type for more information.
Ok, that’s clear enough. My readme is in markdown, let’s see how to fix this.
Going to https://packaging.python.org/tutorials/packaging-projects/#description, it states you can add long_description_content_type="text/markdown", to your setup.py file, and it’ll be processed as markdown.
<does edits>....
<submits to PyPi again
Submitting dist/WebRequest-0.0.28.tar.gz to https://upload.pypi.org/legacy/
[snip build process]
Upload failed (400): The description failed to render in the default format of reStructuredText. See https://pypi.org/help/#description-content-type for more information.
error: Upload failed (400): The description failed to render in the default format of reStructuredText. See https://pypi.org/help/#description-content-type for more information.
What?
Expected behavior I expect if I specify the readme is markdown, as the documentation says to do so, the readme should be treated as markdown.
To Reproduce Attempt to upload a package with a readme that is valid markdown, but not valid reStructuredText.
My Platform
- Python 3.5.2 x64
- Ubuntu 16.04 LTS
- setuptools-39.2.0 (I specifically checked that it’s the most current version)
- readme_renderer 20.0
Actual project in question is here. The readme.md in question is here, and the setup.py is here
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 20
- Comments: 45 (17 by maintainers)
Commits related to this issue
- So packaging somehow is now fucked, apparently due to pypi changes or something. See https://github.com/pypa/warehouse/issues/4079 (I think?). Siiiiigh. — committed to fake-name/WebRequest by fake-name 6 years ago
- [py] convert README to rst due to pypa/warehouse/issues/4079 — committed to rayglover-ibm/sparse-solvers by rayglover-ibm 6 years ago
- Update the UA list to something more modern. Waf checking in the chromium fetch interface. Revs have implemented a bunch more then would otherwise be reasonable due to debugging for https://github.com... — committed to fake-name/WebRequest by fake-name 6 years ago
- Putting long_description_content_type back! & Add setup_requires — committed to Freshwater-Initiative/Observatory by lsetiawan 6 years ago
- fix(pypi): fix deployment issue to pypi I updated the libraries locally and was able to create the package successfully. I'm sending the PR directly to master so we see if it is really fixing the iss... — committed to ladybug-tools/ladybug by mostaphaRoudsari 5 years ago
- fix(pypi): fix deployment issue to pypi I updated the libraries locally and was able to create the package successfully. I'm sending the PR directly to master so we see if it is really fixing the iss... — committed to ladybug-tools/ladybug by mostaphaRoudsari 5 years ago
- fix(pypi): fix deployment issue to pypi I updated the libraries locally and was able to create the package successfully. I'm sending the PR directly to master so we see if it is really fixing the iss... — committed to ladybug-tools/ladybug by mostaphaRoudsari 5 years ago
- long_description_content_type='text/markdown' fix for issue https://github.com/pypa/warehouse/issues/4079 — committed to nix-community/nixpkgs-pytools by costrouc 5 years ago
- Change README.md a bit in attempt to make pypi happy See https://github.com/pypa/warehouse/issues/4079#issuecomment-517638827 — committed to tomtung/omikuji by tomtung 5 years ago
- Don't load README.md in setup.py This is blocking publishing to pypi; see https://github.com/pypa/warehouse/issues/4079 had to give up after trying a few times. — committed to tomtung/omikuji by tomtung 5 years ago
- Don't load README.md in setup.py This is blocking publishing to pypi; see https://github.com/pypa/warehouse/issues/4079 had to give up after trying a few times. — committed to tomtung/omikuji by tomtung 5 years ago
- Don't load README.md in setup.py This is blocking publishing to pypi; see https://github.com/pypa/warehouse/issues/4079 had to give up after trying a few times. — committed to tomtung/omikuji by tomtung 5 years ago
I have setuptools upgraded to version 41.0.1 twine version 1.13.0 wheel version 0.33.4 and i am still getting this issue
We’re reverting this behavior in #4099, hang tight.
Still have the issue with latest packages installed: setuptools 41.0.1
twine 1.13.0
wheel 0.33.4
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/
Seems I can make it working by modifying the
README.mda bit, which is change ```python Some code ```to ```
some code ```
Hi @frmdstryr, it’s not possible to change anything about a published package – they are essentially immutable.
It’s likely that you have an out-of-date version of either
twine,wheelorsetuptoolswhich cannot interpret this new metadata field. You can upgrade them all with:Once you do that, you can either increment the version number and make a new release, or make a post release to fix your description.
long_description_content_typeworks withtwine, but seems to have no effect when usingsetuptools.Works:
setup.pycontainslong_description_content_type='text/markdown',setup.py bdist_wheel(sdistalso works)twine upload -r test dist/*Does not work:
setup.pycontainslong_description_content_type='text/markdown',setup.py bdist_wheel upload -r testPacakges:
PyPI only renders rst(reStructuredText) file so if you have README.md then you have to convert into README.rst file after that you will be able to upload the file on PyPI.
Refer below site for install pandoc: [https://pandoc.org/installing.html]
run below command for convert file into .rst file
python setup.py sdistpandoc --from=markdown --to=rst --output=README.rst README.mdcheck whether twine is able to render .rst file or not;
twine check dist/*Let me know if you encounter any other problems.
It works if your
setuptools is upgraded to version 38.6.0 or newer
twine is upgraded to version 1.11.0 or newer
wheel is upgraded to version 0.31.0 or newer
I think one good option would be to make
readme-renderermore gracefully fail, see https://github.com/pypa/readme_renderer/issues/102Having the same issue. I have all requirements updated:
setup.py:
PKG_INFO:
Here is the error output when upload:
Any idea? It seems that only the wheel file (
.whl) can be uploaded successful.You might try using the latest version of twine to handle the upload. Also, more metadata is available when you upload a wheel first, IIRC.