1

My problem is that I can't upload my module to PyPI. When I run twine upload dist/easy-email-0.0.1.tar.gz I get HTTPError: 400 Client Error: 'Easy-email-0.0.1.tar.gz' is an invalid value for Download-URL. Error: Invalid URI see https://packaging.python.org/specifications/core-metadata for url: https://test.pypi.org/legacy/

What am I doing wrong?

Here is the setup.py:

from distutils.core import setup

setup(
    name = 'easy-email',
    packages = ['easy-email'],
    version = '0.0.1',  # Ideally should be same as your GitHub release tag varsion
    description = 'Send emails in python!',
    author = 'myname',
    author_email = 'myemail',
    url = 'https://github.com/marmadukeandbob05/Easy-Email/',
    download_url = 'Easy-Email-0.0.1.tar.gz',
    keywords = ['email', 'gmail'],
    classifiers = [],
)
1
  • 2
    Maybe like people can downvote also could, at least, explain why with a comment. Commented Feb 5, 2018 at 19:17

1 Answer 1

1

Your download_url is invalid, it is not a valid URL. Note that you don't need to set that value at all when uploading your installation archive to PyPI, because the download URL is on PyPI.

Only set download_url when you are going to host your packages elsewhere, not on PyPI. You would have to use a full URL, so one that starts with http:// or https://, and pip or easy_install would then follow that URL from PyPI to find the installation archive. You'd only use the twine register to register the metadata and just not use twine upload at all.

The error message linked you to the documentation for the field:

A string containing the URL from which this version of the distribution can be downloaded.

Bold emphasis mine; Easy-Email-0.0.1.tar.gz is not a URL. It is merely a filename.

You'd use this when you want people to download the archive from a different host, for example, from GitHub. For example, if the requests project wanted people to download the release from GitHub instead of from the PyPI servers, they could use download_url = 'https://github.com/requests/requests/archive/v2.18.4.tar.gz', and then only use twine register to put the metadata on PyPI.

Sign up to request clarification or add additional context in comments.

14 Comments

But I haven't specified the download url. How do I do so?
@marmadukeandbob: you did specify the download URL, with download_url = 'Easy-Email-0.0.1.tar.gz',. Remove that entirely, rebuild your package (python setup.py sdist bdist_wheel), then register and upload again.
When I run "python setup.py sdist bdist_wheel" I get an error. It works fine with "python setup.py sdist". But when I try to upload using twine, I get "Server Response (410): Gone" Error
@marmadukeandbob: I gave an example rebuild command; if you get an error you don't have wheel support installed, that's fine. Did you try twine register first?
How do I use that?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.