Search code examples
pythonpypi

Uploading package to pypi using twine: Invalid URI


I followed the official documentation for uploading packages to PyPI, as well as the information provided in PyPI readme, but I get a HTTP 400 error each time:

$ twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy
Enter your username: Sinistag
Enter your password:
Uploading paulla.check_dns_sync-0.1.dev0.py3-none-any.whl
HTTPError: 400 Client Error: home_page: Invalid URI for url: https://upload.pypi.org/legacy

What is going on ?


Solution

  • The problem was with the package url defined in setup.py

    Invalid URI means the url field in the setup() function is not a valid url. It should be something like url="https://github.com/namespace/repo" for example

    This is the url to the package code, and the new pypi repo doesn't accept package with wrong url.

    see this issue on twine's repo