Python - pypi upload error with twine - python

I have a package for which local installation and distribution work correctly. However, when I try to upload it to pypi with twine, I get the following error message:
$ twine upload dist/mypackage.tar.gz
Uploading distributions to https://upload.pypi.org/legacy
Uploading mypackage.tar.gz
HTTPError: 400 Client Error: author_email: Invalid email address. for url: https://upload.pypi.org/legacy
By the way, I tried also commenting the author_email field in setup.py, but the error still remains and I don't think it is related to setup.py.
I tried creating .pypirc with no repository specification, as well as without using it at all.
I tried also using setup upload, but this also failed with a
$ Upload failed (410) gone: (This API has been deprecated...
As I understand pypi repos are currently in transition phase, but I can't figure out where the problem is.
I'm running twine 1.9.1. and python 3.5.2 (Ubuntu 16.04).
Hope you can help me!
[SOLVED]
It turned out that email address did not match with author name. Changing email address accordingly worked for me.

Related

How to upload Python Package to PyPi from Azure Pipeline

I have been able to setup an Azure pipeline that publishes a python package to our internal Azure Feed. Now I am trying to have it publish directly to PyPi. This is what I have done already:
I have setup a PyPi "Service Connection" in the Azure Project with the following configuration
Authentication Method = Username and Password
Python Repository Url for upload = https://upload.pypi.org/legacy
EndpointName: I wasnt too sure about this but I set it as the package name on PyPi
And I named this Service Connection PyPi.
In the pipeline I will run the following authentication task:
- task: TwineAuthenticate#1
inputs:
pythonUploadServiceConnection: 'PyPi'
Then I build the wheel for publishing.
Whenever I try to publish to the internal Azure feed it works, but when I try to upload that same package to pypi it gets stuck on this:
Uploading distributions to https://upload.pypi.org/legacy/
Are there any clear issues anyone can see that can have it get stuck trying to upload to pypi?
Twine authenticate probably isn't actually providing credentials to the twine upload command, so it's hanging waiting for user input. Try adding --non-interactive to your twine command like this twine upload --non-interactive dist/*. It will probably end up showing an error.

Python flask saml throwing saml2.sigver.SigverError Error Message

Has anyone succesfully implemented flask-saml using Windows as dev environment, Python 3.6 and Flask 1.0.2?
I was given the link to the SAML METADATA XML file by our organisation and had it configured on my flask app.
app.config.update({
'SECRET_KEY': 'changethiskeylaterthisisoursecretkey',
'SAML_METADATA_URL': 'https://<url>/FederationMetadata.xml',
})
flask_saml.FlaskSAML(app)
According to the documentation this extension will setup the following routes:
/saml/logout/: Log out from the application. This is where users go
if they click on a “Logout” button.
/saml/sso/: Log in through SAML.
/saml/acs/: After /saml/sso/ has sent you to your IdP it sends you
back to this path. Also your IdP might provide direct login without
needing the /saml/sso/ route.
When I go to one of the routes http://localhost:5000/saml/sso/ I get the error below
saml2.sigver.SigverError saml2.sigver.SigverError: Cannot find
['xmlsec.exe', 'xmlsec1.exe']
I then went to this site https://github.com/mehcode/python-xmlsec/releases/tag/1.3.5 to get xmlsec and install it. However, I'm still getting the same issue.
Here is a screenshot of how I installed xmlsec
where does not seem to find the xmlsec.exe
documentationis asking to have xmlsec1 pre-installed. What you installed is a python binding to xmlsec1.
Get a windows build of xmlsec1 from here or build it from source
And make it available in the PATH.
xmlsec won't work properly in windows, better use Linux environment
Type the below command before giving pip install xmlsec
sudo apt-get install xmlsec1

Why is Twine 1.9.1 still uploading to legacy PyPi?

I want to upload packages to pypi.org as mentioned in the Migrating to PyPI.org documentation, but Twine uploads to https://upload.pypi.org/legacy/.
It's available on pypi.python.org/pypi/mypolr, but is not found on pypi.org.
I've tried to read
several other questions, tutorials, and guides.
My pip.ini-file (I'm on Windows 10) looks like this:
[distutils]
index-servers =
pypi
[pypi]
I don't have my username or password stored, so the [pypi] section is empty (as mentioned in migration docs).
I've put the .ini-file in my user folder, and confirmed (per this answer) that it's actually using the one I've set (using environment variable PIP_CONFIG_FILE).
Afraid that I had got something wrong, I also tried without a pip.ini-file to make Twine use its defaults.
I'm using Python 3.6.3 (from Anaconda), and my tools' versions are:
Twine 1.9.1 (migration docs says it should be 1.8+)
setuptools 38.2.3 (migration docs says it should be 27+)
Whether or not it's relevant, here is some more info:
Link to my setup.py
setup is imported from setuptools and not distutils.core
README.rst is used as long description, but in the PyPi page only first 8 asterix of header is shown. (Compare this with this)
The package I upload is version is 0.2.1 (at the time of posting this)
setuptools_scm is used to fetch versions from git tags
build is made with python setup.py sdist bdist_wheel
Please let me know if there is any other information that could be useful to figure this out.
You appear to be doing everything correctly. Twine is not uploading via legacy PyPI (https://pypi.python.org). It is uploading to the new PyPI (https://pypi.org, a.k.a. "Warehouse") via the original (and so far only) PyPI API, and this API just happens to be named "legacy".
Also, your package is present on Warehouse at https://pypi.org/project/mypolr/; Warehouse search is apparently not production-ready.
The docs for Warehouse explain this confusing nomenclature. Quotes below are from the front page and from the page about the Legacy API:
Warehouse is a web application that implements the canonical Python package index (repository); its production deployment is PyPI. It replaces an older code base that powered pypi.python.org.
Legacy API
The “Legacy API” provides feature parity with pypi-legacy, hence the term “legacy”.
...
Upload API
The API endpoint served at upload.pypi.org/legacy/ is Warehouse’s emulation of the legacy PyPI upload API. This is the endpoint that tools such as twine and distutils use to upload distributions to PyPI.
In other words, as I understand it:
PyPI was once a web application hosted at pypi.python.org. That old application, which no longer runs, is now referred to by the name pypi-legacy.
PyPI is now a web application hosted at pypi.org. This new application is named Warehouse. The old pypi.python.org is now just a redirect to pypi.org.
In addition to some new endpoints, Warehouse still exposes a couple of API endpoints that pypi-legacy used to have. Because these endpoints were copied across from pypi-legacy, they are together known as the "Legacy API".
In addition to that, the upload endpoint within Warehouse's Legacy API is served from the URL path /legacy, a naming choice which again reflects the fact that it is a (partial) reimplementation of the endpoint used for uploads in pypi-legacy.
This all seems more confusing than it needs to be, but it is what it is.
In case anyone else is coming here from google, mystified why their uploads are failing, don't forget to check https://status.python.org/ to make sure there isn't an outage. Sometimes you just gotta wait :p

Deploying Python Flask on Azure Get error 500

In the following hour's i tried to deploy Python with flask on Microsoft azure platform.
I used New app "flask", assign with their server. deployed by git.
after deployment finished (its showed Unable to find vcvarsall.bat)
Then I set up on options that i am using python 3.4 version and it fixed it up.
After Deployment succeeds I tried to see the site and I got :
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
I am a beginner in deploying and I search up all over. I really wish somebody could help me find the right answer.
Thank you very much.
Based on my research on this blog which mentioned content below about your issue:
When you see "unable to find vcvarsall.bat", it means you're
installing a package that has an extension module, but only the source
code. "vcvarsall.bat" is part of the compiler in Visual Studio that is
necessary to compile the module.
I think your issue occurred because that during the flask project deployed to azure, pip has problems installing the lxml library.As mentioned in this document, lxml library is written in C which requires a compiler before it's installation.
Unfortunately,a compiler is not available on the machine running the web app in Azure App Service. So, you need to do this compilation locally.
You can follow the steps as below:
Step 1:Use pip wheel command line to generate .whl file of lxml package.In addition,you can directly download generated .whl file here.
Step2:Create the wheelhouse folder under the requments.txt file's sibling directory and put the .whl file in wheelhouse folder.
Step3: Edit your requirements.txt to add the --find-links option at the top.
--find-links wheelhouse
lxml==3.8.0
Step4:Deploy your flask project to azure.
For more details , please refer to the Troubleshooting - Package Installation chapter in the official document and wheel document.
Hope it helps you.

what does `twine upload dist/*` command do?

I apologize in advance since this seems like a basic question...
I am trying to learn using mujoco(link here), and inside its python binding Makefile it has:
upload:
rm -rf dist
python setup.py sdist
twine upload dist/*
What does twin upload dist/* command do?
In addition, this asks me for a username and password like this:
Uploading distributions to https://pypi.python.org/pypi
Enter your username: guest
Enter your password:
Uploading mujoco-py-0.5.7.tar.gz
HTTPError: 401 Client Error: You must be identified to edit package information for url: https://pypi.python.org/pypi
Makefile:2: recipe for target 'upload' failed
Is this asking for my computer username and password?
Twine is a commonly used system for uploading project builds to PyPI (the Python Package Index).
It will take care of securely transferring your project's build artifacts, in either wheel, sdist, etc. formats to PyPI or some other user defined index server.
When you specify twine upload <files>, twine will attempt to upload said files to PyPI, but in order to do so, it will require you to authenticate yourself. This is because PyPI wants to protect a project from having their advertised packages "hijacked" by a ne'er-do-well. In order for this step to proceed, you would have to give credentials that are marked as authoritative for the project that your uploaded project artifacts belong to.
It looks like the mujoco project's Makefile includes a target to ease in uploading updates of the project to PyPI by utilizing the Twine application. This target would only be meant to be used by the package maintainer(s).
Oh, and in case you were wondering, the python setup.py sdist command is what makes a source code artifact that can be uploaded to PyPI. It will place this artifact in the ./build/ directory as project-name_version.tar.gz.

Categories