pypa / twine

Utilities for interacting with PyPI
https://twine.readthedocs.io/
Apache License 2.0
1.59k stars 303 forks source link

author_email: Invalid email address. for url: https://upload.pypi.org/legacy/ #291

Closed gnulnx closed 6 years ago

gnulnx commented 6 years ago

I have been trying to clone a project and then submit to PYPI so it's downloadable via pip. Currently we are linking to the users github account and no longer want to do that. So we have cloned the repo...

I have tried changing both author and email as well as omiting them, but the error is the same in each case.

setup.py looks like this.  

#!/usr/bin/env python

import os

from setuptools import setup, find_packages

try:
    # Workaround for http://bugs.python.org/issue15881
    import multiprocessing
except ImportError:
    pass

VERSION = '0.4.6'

if __name__ == '__main__':
    setup(
        name = 'hbx-django-tastypie-mongoengine',
        version = VERSION,
        description = "MongoEngine support for django-tastypie. Fixed for Django 1.9+",
        long_description = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read(),
        author = 'wlan slovenija',
        author_email = 'open@wlan-si.net,
        url = 'https://github.com/HBS-HBX/django-tastypie-mongoengine',
        keywords = "REST RESTful tastypie mongo mongodb mongoengine django",
        license = 'AGPLv3',
        packages = find_packages(exclude=('*.tests', '*.tests.*', 'tests.*', 'tests')),
        classifiers = (
            'Development Status :: 4 - Beta',
            'Environment :: Web Environment',
            'Intended Audience :: Developers',
            'License :: OSI Approved :: GNU Affero General Public License v3',
            'Operating System :: OS Independent',
            'Programming Language :: Python',
            'Framework :: Django',
        ),
        zip_safe = False,
        install_requires = (
            'Django>=1.9.7',
            'django-tastypie>=0.13.3',
            'mongoengine>=0.10.6',
            'python-dateutil>=2.5.0',
            'lxml',
            'defusedxml',
            'PyYAML',
            'biplist',
            'python-mimeparse>=1.5.0',
        ),
        test_suite = 'tests.runtests.runtests',
        tests_require = (
            'Django>=1.9.7',
            'django-tastypie>=0.13.3',
            'mongoengine>=0.10.6',
            'python-dateutil>=2.5.0',
            'lxml',
            'defusedxml',
            'PyYAML',
            'biplist',
            'python-mimeparse>=1.5.0',
            'nose',
        ),
    )
gnulnx commented 6 years ago

.pypirc looks like this

[distutils] index-servers = pypi

[pypi] username = XXXX password = XXXX

di commented 6 years ago

@gnulnx Is this line verbatim?

author_email = 'open@wlan-si.net,

If so, it looks like you're missing a trailing single quote here.

gnulnx commented 6 years ago

@di That line is verbatim from the cloned packaged... But I have also tried changing it to my registered user and email address as well.

di commented 6 years ago

@gnulnx The cloned package doesn't seem to be missing the trailing quote to me.

gnulnx commented 6 years ago

@di My apologies.. yes the email is fully quoted.. As mentioned I tried my user/eamil combo and then changed it once I posted it here... Seems I'd rather leave the original author/email in place as our is only a clone to a specific version anyway.

gnulnx commented 6 years ago

I think the error would actually be a syntax error if I missed the quote.. where as this seems different.

di commented 6 years ago

@gnulnx If you could include the email address string that was actually giving you the error here instead, it'd be a little easier to figure out why it was giving you an error. 🙂

gnulnx commented 6 years ago

author = 'wlan slovenija', author_email = 'open@wlan-si.net',

Here is the entire unmodified setup.py

#!/usr/bin/env python

import os

from setuptools import setup, find_packages

try:
    # Workaround for http://bugs.python.org/issue15881
    import multiprocessing
except ImportError:
    pass

VERSION = '0.4.6'

if __name__ == '__main__':
    setup(
        name = 'hbx-django-tastypie-mongoengine',
        version = VERSION,
        description = "MongoEngine support for django-tastypie. Fixed for Django 1.9+",
        long_description = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read(),
        author = 'wlan slovenija',
        author_email = 'open@wlan-si.net',
        url = 'https://github.com/wlanslovenija/django-tastypie-mongoengine',
        keywords = "REST RESTful tastypie mongo mongodb mongoengine django",
        license = 'AGPLv3',
        packages = find_packages(exclude=('*.tests', '*.tests.*', 'tests.*', 'tests')),
        classifiers = (
            'Development Status :: 4 - Beta',
            'Environment :: Web Environment',
            'Intended Audience :: Developers',
            'License :: OSI Approved :: GNU Affero General Public License v3',
            'Operating System :: OS Independent',
            'Programming Language :: Python',
            'Framework :: Django',
        ),
        zip_safe = False,
        install_requires = (
            'Django>=1.9.7',
            'django-tastypie>=0.13.3',
            'mongoengine>=0.10.6',
            'python-dateutil>=2.5.0',
            'lxml',
            'defusedxml',
            'PyYAML',
            'biplist',
            'python-mimeparse>=1.5.0',
        ),
        test_suite = 'tests.runtests.runtests',
        tests_require = (
            'Django>=1.9.7',
            'django-tastypie>=0.13.3',
            'mongoengine>=0.10.6',
            'python-dateutil>=2.5.0',
            'lxml',
            'defusedxml',
            'PyYAML',
            'biplist',
            'python-mimeparse>=1.5.0',
            'nose',
        ),
    )
gnulnx commented 6 years ago

I had a minor edit.. I have changed the name of the package. :)

di commented 6 years ago

@gnulnx Are you sure that this is the email address that was in the setup.py file when you created the distribution which you tried to upload? It's a valid email address and won't fail validation.

Make sure that you're removing any previous distributions you've built before making a new one, they may still have an invalid value:

$ rm dist/*
$ python setup.py sdist
$ twine upload dist/*
gnulnx commented 6 years ago

@di that is a good question. I tried it with the original maintainer first and then changed it to mine thinking that perhaps my PYPI account wanted my email address...

This is the output from the wipe/rebuild

rm -rf dist/; python setup.py sdist; twine upload dist/*
running sdist
running egg_info
writing requirements to hbx_django_tastypie_mongoengine.egg-info/requires.txt
writing hbx_django_tastypie_mongoengine.egg-info/PKG-INFO
writing top-level names to hbx_django_tastypie_mongoengine.egg-info/top_level.txt
writing dependency_links to hbx_django_tastypie_mongoengine.egg-info/dependency_links.txt
reading manifest file 'hbx_django_tastypie_mongoengine.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.txt'
writing manifest file 'hbx_django_tastypie_mongoengine.egg-info/SOURCES.txt'
running check
creating hbx-django-tastypie-mongoengine-0.4.6
creating hbx-django-tastypie-mongoengine-0.4.6/docs
creating hbx-django-tastypie-mongoengine-0.4.6/hbx_django_tastypie_mongoengine.egg-info
creating hbx-django-tastypie-mongoengine-0.4.6/tastypie_mongoengine
creating hbx-django-tastypie-mongoengine-0.4.6/tests
creating hbx-django-tastypie-mongoengine-0.4.6/tests/test_project
creating hbx-django-tastypie-mongoengine-0.4.6/tests/test_project/test_app
creating hbx-django-tastypie-mongoengine-0.4.6/tests/test_project/test_app/api
creating hbx-django-tastypie-mongoengine-0.4.6/tests/test_project/test_app/tests
copying files to hbx-django-tastypie-mongoengine-0.4.6...
copying CONTRIBUTING.rst -> hbx-django-tastypie-mongoengine-0.4.6
copying COPYING -> hbx-django-tastypie-mongoengine-0.4.6
copying LICENSE -> hbx-django-tastypie-mongoengine-0.4.6
copying MANIFEST.in -> hbx-django-tastypie-mongoengine-0.4.6
copying README.rst -> hbx-django-tastypie-mongoengine-0.4.6
copying setup.py -> hbx-django-tastypie-mongoengine-0.4.6
copying docs/Makefile -> hbx-django-tastypie-mongoengine-0.4.6/docs
copying docs/conf.py -> hbx-django-tastypie-mongoengine-0.4.6/docs
copying docs/index.rst -> hbx-django-tastypie-mongoengine-0.4.6/docs
copying docs/installation.rst -> hbx-django-tastypie-mongoengine-0.4.6/docs
copying docs/tests.rst -> hbx-django-tastypie-mongoengine-0.4.6/docs
copying docs/usage.rst -> hbx-django-tastypie-mongoengine-0.4.6/docs
copying hbx_django_tastypie_mongoengine.egg-info/PKG-INFO -> hbx-django-tastypie-mongoengine-0.4.6/hbx_django_tastypie_mongoengine.egg-info
copying hbx_django_tastypie_mongoengine.egg-info/SOURCES.txt -> hbx-django-tastypie-mongoengine-0.4.6/hbx_django_tastypie_mongoengine.egg-info
copying hbx_django_tastypie_mongoengine.egg-info/dependency_links.txt -> hbx-django-tastypie-mongoengine-0.4.6/hbx_django_tastypie_mongoengine.egg-info
copying hbx_django_tastypie_mongoengine.egg-info/not-zip-safe -> hbx-django-tastypie-mongoengine-0.4.6/hbx_django_tastypie_mongoengine.egg-info
copying hbx_django_tastypie_mongoengine.egg-info/requires.txt -> hbx-django-tastypie-mongoengine-0.4.6/hbx_django_tastypie_mongoengine.egg-info
copying hbx_django_tastypie_mongoengine.egg-info/top_level.txt -> hbx-django-tastypie-mongoengine-0.4.6/hbx_django_tastypie_mongoengine.egg-info
copying tastypie_mongoengine/__init__.py -> hbx-django-tastypie-mongoengine-0.4.6/tastypie_mongoengine
copying tastypie_mongoengine/fields.py -> hbx-django-tastypie-mongoengine-0.4.6/tastypie_mongoengine
copying tastypie_mongoengine/paginator.py -> hbx-django-tastypie-mongoengine-0.4.6/tastypie_mongoengine
copying tastypie_mongoengine/resources.py -> hbx-django-tastypie-mongoengine-0.4.6/tastypie_mongoengine
copying tastypie_mongoengine/test_runner.py -> hbx-django-tastypie-mongoengine-0.4.6/tastypie_mongoengine
copying tests/__init__.py -> hbx-django-tastypie-mongoengine-0.4.6/tests
copying tests/manage.py -> hbx-django-tastypie-mongoengine-0.4.6/tests
copying tests/runtests.py -> hbx-django-tastypie-mongoengine-0.4.6/tests
copying tests/test_project/__init__.py -> hbx-django-tastypie-mongoengine-0.4.6/tests/test_project
copying tests/test_project/settings.py -> hbx-django-tastypie-mongoengine-0.4.6/tests/test_project
copying tests/test_project/urls.py -> hbx-django-tastypie-mongoengine-0.4.6/tests/test_project
copying tests/test_project/test_app/__init__.py -> hbx-django-tastypie-mongoengine-0.4.6/tests/test_project/test_app
copying tests/test_project/test_app/documents.py -> hbx-django-tastypie-mongoengine-0.4.6/tests/test_project/test_app
copying tests/test_project/test_app/models.py -> hbx-django-tastypie-mongoengine-0.4.6/tests/test_project/test_app
copying tests/test_project/test_app/views.py -> hbx-django-tastypie-mongoengine-0.4.6/tests/test_project/test_app
copying tests/test_project/test_app/api/__init__.py -> hbx-django-tastypie-mongoengine-0.4.6/tests/test_project/test_app/api
copying tests/test_project/test_app/api/resources.py -> hbx-django-tastypie-mongoengine-0.4.6/tests/test_project/test_app/api
copying tests/test_project/test_app/tests/__init__.py -> hbx-django-tastypie-mongoengine-0.4.6/tests/test_project/test_app/tests
copying tests/test_project/test_app/tests/test_basic.py -> hbx-django-tastypie-mongoengine-0.4.6/tests/test_project/test_app/tests
Writing hbx-django-tastypie-mongoengine-0.4.6/setup.cfg
creating dist
Creating tar archive
removing 'hbx-django-tastypie-mongoengine-0.4.6' (and everything under it)
Uploading distributions to https://pypi.python.org/pypi
Uploading hbx-django-tastypie-mongoengine-0.4.6.tar.gz

HTTPError: 410 Client Error: Gone (This API has been deprecated and removed from legacy PyPI in favor of using the APIs available in the new PyPI.org implementation of PyPI (located at https://pypi.org/). For more information about migrating your use of this API to PyPI.org, please see https://packaging.python.org/guides/migrating-to-pypi-org/#uploading. For more information about the sunsetting of this API, please see https://mail.python.org/pipermail/distutils-sig/2017-June/030766.html) for url: https://pypi.python.org/pypi
di commented 6 years ago

@gnulnx You're getting a different error now, which indicates that you're uploading to https://pypi.python.org/pypi instead of https://pypi.org/legacy.

Is there a repository line in your ~/.pypirc? Take a look at https://packaging.python.org/guides/migrating-to-pypi-org/#uploading.

gnulnx commented 6 years ago

The old settings are there, but commented out. I can try removing them

[distutils]
index-servers =
    pypi

[pypi]
username = XXX
password = XXX

#[pypi]
#repository:https://pypi.python.org/pypi
#username:XXX
#password:XXX
gnulnx commented 6 years ago

Removing commented out lines is the same result as before.

You are right it is different error this time, though I'm still not completely sure what triggered the previous error.

gnulnx commented 6 years ago

For completness sake I have also run with -u username and -p password.

I really appreciate your help on this @di.

di commented 6 years ago

@gnulnx Sorry, it's not clear to me: Is the email open@wlan-si.net still giving you a author_email: Invalid email address error? Or do you have a new error?

gnulnx commented 6 years ago

@di I am unable to upload a package to PyPi using Twine. Full stop.

As you have read I have tried your suggestions, I have posted all of setup.py and all of my .pyrc. I have tried several different command line switches and modifications (which are also posted above).

As far as I can tell I have followed the new workflow as is. I believe I have tried every suggestion you have made...

I have read all these documents: https://packaging.python.org/ https://packaging.python.org/tutorials/distributing-packages/#id30 https://packaging.python.org/tutorials/distributing-packages/

I have verified that I can login in to https://pypi.python.org with my username and password.

I can open a new issue, but it seems it might be better to leave this one open instead... Either way the problem is that twine/pypi is not accepting uploads from me. I'm not sure if this is a twine issue or a PyPI issue of it's an issue with my account, but I do believe my local environment is setup as described in the documents and our conversation.

For what it's worth I have uploaded many times to PyPi (old system) using twine and this only seems to be an issue with this package and the new workflow.

gnulnx commented 6 years ago

Resolved!!!

Ok for anyone that gets to the end of this thread here is what washappening.

Twine was installed in my local virtualenv as well as globally in /usr/local/bin/twine (version 1.6.4)

which showed twine in my virtualenv

 which twine
/Users/jfurr/.virtualenvs/hbx/bin/twine

HOWEVER.. it was using the globally installed version in /usr/local/bin/twine which was the WRONG version for the new PyPi server. ;)

More oddly though my path looks like this

PATH=/Users/jfurr/.virtualenvs/hbx/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/go/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/usr/local/mysql/bin/

As you can see my virtualenv is setup to resolve first. I have NO idea why it chose the /usr/loca/bin/twine, but when I run like this:

rm -rf dist/*; python setup.py sdist; /Users/jfurr/.virtualenvs/hbx/bin/twine upload dist/*

It works as expected.

Thanks again @di... sometimes you just gotta bounce things around before you figure it out.

gnulnx commented 6 years ago

Issue is resolved so closing.

GiggleLiu commented 6 years ago

Remove the trailing "," of author and author_email in the setup.py file works for me.