-1

I recently made a python library (most recent version: v1.0.0). I have made a few changes to it and want to release the next version (that is v1.0.1). I tried searching google to find the command to do so but found nothing. So I decided to run the initial commands (The ones used to publish the library) which are:

py -m build

followed by:

twine upload --repository-url dist/*

and I got this error message:

HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/ This filename has already been used, use a different version. See https://pypi.org/help/#file-name-reuse for more information.

Can someone help me by telling me what commands I should use to release the next version or provide a source to refer to?

EDIT: I saw a similar question and tried the Best Answer but it doesn't work and still gives me this error message:

HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/ This filename has already been used, use a different version. See https://pypi.org/help/#file-name-reuse for more information.

Siddhesh Agarwal
  • 159
  • 1
  • 12
  • Did you change the version in the source code of your project? – Brad Solomon Jun 18 '21 at 15:24
  • @BradSolomon not really in the "source code" per se, but in the packaging tool's metada file, ie `setup.py`, `pyproject.toml` etc etc – DeepSpace Jun 18 '21 at 15:26
  • @BradSolomon I did change the version to v1.0.1 in `setup.py` and my GitHub repository – Siddhesh Agarwal Jun 18 '21 at 15:27
  • @DeepSpace yeah. I had changed the version in my `setup.py` file but it is not working. – Siddhesh Agarwal Jun 18 '21 at 15:29
  • Does this answer your question? [How to upload new versions of project to PyPI with twine?](https://stackoverflow.com/questions/52016336/how-to-upload-new-versions-of-project-to-pypi-with-twine) – SpaceBurger Jun 18 '21 at 15:30
  • @SpaceBurger I was just seeing that answer and tried that command but it doesn't work and gives me this error message: `HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/ This filename has already been used, use a different version. See https://pypi.org/help/#file-name-reuse for more information.` I have added the details of that question to my question (by EDITing my question) as well. – Siddhesh Agarwal Jun 18 '21 at 15:38
  • Did you build your project again after changing the version ? Check if the package version is not already online, try to make a clean build and use `--skip-existing`. – SpaceBurger Jun 18 '21 at 15:45
  • @SpaceBurger I got it thanks. – Siddhesh Agarwal Jun 19 '21 at 03:13

1 Answers1

2

Okay so the way is to clear all the files like build/, dist/ and src/<LIBRARY-NAME>.egg-info and then run the commands:

$ python setup.py bdist_wheel
$ py -m build
$ twine upload --skip-existing dist/*

Running the commands in this order shall solve the problem.

Siddhesh Agarwal
  • 159
  • 1
  • 12