python-poetry / python-poetry/poetry
Be more specific about error messages when `UploadError` is thrown.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my question is not covered.
Feature Request
I have been using poetry for quite a while now. I really appreciate the features that came with it right out the box, from building performance to the sleek modern interface. However, I struggled a bit with publishing my little lovely package to PyPI.
So basically, I used in my readme file the raw directive, later on, I realized that this directive is not allowed on PyPi. But how did I realize that? you may ask. The answer should be, I think, using poetry. Unfortunately, poetry didn't help though.
➜ poetry check
All set!
Trying to publish the dist to PyPi threw the following exception:
➜ poetry publish
Username: harmouch
Password:
Publishing frozndict (1.0.0) to PyPI
- Uploading frozndict-1.0.0-py3-none-any.whl 100%
UploadError
HTTP Error 400: The description failed to render for 'text/x-rst'. See https://pypi.org/help/#description-content-type for more information.
at ~/.poetry/lib/poetry/publishing/uploader.py:216 in _upload
212│ self._register(session, url)
213│ except HTTPError as e:
214│ raise UploadError(e)
215│
→ 216│ raise UploadError(e)
217│
218│ def _do_upload(
219│ self, session, url, dry_run=False
220│ ): # type: (requests.Session, str, Optional[bool]) -> None
make: *** [Makefile:67: release] Error 1
from the error message:
HTTP Error 400: The description failed to render for 'text/x-rst'. See https://pypi.org/help/#description-content-type for more information.
I thought that the issue is related to the description value of my pyproject.toml.
Trying fuzzy values for description didn't help me out.
Then, I thought, well maybe twine can help me figure out the issue. And it did:
➜ twine check dist/*
Checking dist/frozndict-1.0.0-py3-none-any.whl: FAILED
`long_description` has syntax errors in markup and would not be rendered on PyPI.
line 5: Warning: "raw" directive disabled.
Checking dist/frozndict-1.0.0.tar.gz: FAILED
`long_description` has syntax errors in markup and would not be rendered on PyPI.
line 5: Warning: "raw" directive disabled.
With twine, it is crystal clear that the issue is related to the raw directives being used.
Did some cleanups, and I was successfully able to publish my package to PyPi. 🎉
Takeaway:
- Improvements should be made to the error messages thrown while publishing a package, making it kind of similar to
twine.
All in all, poetry rocks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in poetry/publishing/uploader.py around line 216, where the reported UploadError is raised, and compare its output with the twine check messages shown in the issue. Done means publishing reports a more specific explanation of the package description or markup failure instead of only the generic HTTP 400 response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, release
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100