Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A guide for updating packages on PyPi

Tags:

pypi

I used this guide to install a new package on PyPi.

Now, I want to update the package. Since I found no guide for this, I tried to do it myself: I updated the version from "1.0.0.dev1" to "1.0.0.dev2" and re-installed. It did not work: I got:

Uploading tee_table-1.0.0.dev1-py3-none-any.whl

HTTPError: 400 Client Error: File already exists. See https://pypi.org/help/#file-name-reuse for url: https://upload.pypi.org/legacy/

I also read this question but the information seems outdated (from 2012).

Is there a simple user guide that describes how to upload a new version of a package to PyPi?

like image 811
Erel Segal-Halevi Avatar asked Oct 08 '18 10:10

Erel Segal-Halevi


2 Answers

I found out what my problem was - I did not delete the old files in the dist folder, so the uploader tried to upload them before the new files, and failed. The solution was to:

  1. Delete all files in the dist folder.

  2. Update the version number in the setup.py file.

  3. Re-create the wheels:

    python3 setup.py sdist bdist_wheel
    
  4. Re-upload the new files:

    twine upload dist/*
    
like image 98
Erel Segal-Halevi Avatar answered Sep 28 '22 05:09

Erel Segal-Halevi


Sorry if i am replying too late but came across the same problem and found a way not to delete the existing dist folder:

after updating the version in setup.py and recreating the wheel file,

twine upload --skip-existing dist/*

will skip the distribution that already exist and upload the newer ones

like image 25
anil keshav Avatar answered Sep 28 '22 06:09

anil keshav