Delete latest version of PyPI package (or re-upload in order to overwrite)?
10:28 14 Dec 2025

PyPI newb here.

I just updated a package because I wanted to add a script entry point.

There's a script in the root directory called "deploy.py". It has one function, main(), called if the file is "__main__".

So I put this in pyproject.toml:

[project.scripts]
deploy = "deploy"

... then built, and uploaded.

This led to an error about "method name missing" ... I tried again:

[project.scripts]
deploy = "deploy:main"

and then did

> pip install -e .
> deploy 

which ran the method.

But in fact I want to run that method from another project, which has installed the package in its virtual environment. But I had installed the new version of the package with the erroneous script directive, i.e. the first above.

Without changing the version number, is there a way to overwrite the version held at PyPI? Either by a forced re-publishing and overwriting the bad package at PyPI? ... or by deleting the latest version and then republishing with the same version?

I read that you can't delete a package at PyPI and then publish a completely new and different package with the same name. Maybe there are limitations on doing this kind of thing?

python version pypi