You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PyPI reStructuredText README description validation fails even though the README passes the twine check --strict command. When I on 2024-08-17 tried to upload a new version of my package to PyPI I ran the command twine upload dist/* and the "dist" directory contains the new and all previous versions of my package. When twine processed a previous version of my package that previously successfully uploaded to PyPI I got the error message listed below.
Response from https://test.pypi.org/legacy/:
400 The description failed to render for 'text/x-rst'. See https://test.pypi.org/help/#description-content-type for more information.
INFO <html>
<head>
<title>400 The description failed to render for 'text/x-rst'. See https://test.pypi.org/help/#description-content-type for more information.</title>
</head>
<body>
<h1>400 The description failed to render for 'text/x-rst'. See https://test.pypi.org/help/#description-content-type for more information.</h1>
The server could not comply with the request since it is either malformed or otherwise incorrect.<br/><br/>
The description failed to render for 'text/x-rst'. See https://test.pypi.org/help/#description-content-type for more information.
</body>
</html>
ERROR HTTPError: 400 Bad Request from https://test.pypi.org/legacy/
The description failed to render for 'text/x-rst'. See https://test.pypi.org/help/#description-content-type for more information.
The error message does not say where in that the malformed or otherwise incorrect content occur. With a lot of trial and error I found the validation error was caused by the :scale: parameter to the image:: directive in my README.rst. When I removed the :scale: parameter the validation passed and the version was accepted by PyPI. I had specified :scale: 100% so removing it made no difference to the rendering of the document. When I uploaded a new version of my package last time (2024-08-04) the :scale: parameter was accepted by the PyPI reStructuredText validation. The package I uploaded then was streamlit-passwordless v0.6.0
Expected behavior
The PyPI reStructuredText validation should output a better error message of what caused the validation to fail and match the validation of the twine check --strict command.
Steps to reproduce
Create a new Python package containing a README.rst with the content below:
My Package Name
===============
|conda-forge|
.. |conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/streamlit_passwordless?style=plastic:alt:conda-forge - Version:scale:100%:target:https://anaconda.org/conda-forge/streamlit_passwordless
Build a a distribution of the package with the command python -m build
Run the command twine check --strict dist/* and the validation should pass.
Run the command twine upload --repository testpypi --verbose dist/*
Observe the error.
Remove :scale: 100% from README.rst and rebuild the package with python -m build
Repeat step 3 and 4
No error about " The description failed to render" should occur.
Describe the bug
The PyPI reStructuredText README description validation fails even though the README passes the
twine check --strict
command. When I on 2024-08-17 tried to upload a new version of my package to PyPI I ran the commandtwine upload dist/*
and the "dist" directory contains the new and all previous versions of my package. When twine processed a previous version of my package that previously successfully uploaded to PyPI I got the error message listed below.The error message does not say where in that the malformed or otherwise incorrect content occur. With a lot of trial and error I found the validation error was caused by the
:scale:
parameter to theimage::
directive in my README.rst. When I removed the:scale:
parameter the validation passed and the version was accepted by PyPI. I had specified:scale: 100%
so removing it made no difference to the rendering of the document. When I uploaded a new version of my package last time (2024-08-04) the:scale:
parameter was accepted by the PyPI reStructuredText validation. The package I uploaded then was streamlit-passwordless v0.6.0Expected behavior
The PyPI reStructuredText validation should output a better error message of what caused the validation to fail and match the validation of the
twine check --strict
command.Steps to reproduce
Create a new Python package containing a README.rst with the content below:
Build a a distribution of the package with the command
python -m build
Run the command
twine check --strict dist/*
and the validation should pass.Run the command
twine upload --repository testpypi --verbose dist/*
Observe the error.
Remove
:scale: 100%
from README.rst and rebuild the package withpython -m build
Repeat step 3 and 4
No error about " The description failed to render" should occur.
My platform
OS : Ubuntu 24.04
python : v3.12.3 (conda)
python-build: v0.10.0
twine : v5.1.1
The text was updated successfully, but these errors were encountered: