1

I need to delete a python package from a private python package index (a.k.a. repository) using the command line. This repo is on artifactory, but I am not able to use the artifactory portal UI to do this.

The package was originally uploaded using twine. However, it looks like there is no delete functionality in twine.

Twine was able to succeed at the upload despite being agnostic of it being an artifactory repo... so I assume there is some kind of standardized pypi-type api...?

(This question is similar but different to How to remove a package from Pypi , because it is asking specifically about a private repo and asking specifically about a CLI solution)

1
  • 2
    Warehouse (the backend behind the current PyPI.org) doesn't have any API to delete packages. Any compatible implementation probably doesn't have it either. Commented Feb 2, 2022 at 21:32

2 Answers 2

4

if you are using a local pypi server, to delete an uploaded artifact use the following command:

curl -u <USERNAME>:<PASSWORD> --form ":action=remove_pkg" --form "name=<PACKAGE_NAME>" --form "version=<VERSION>" <PYPI_SERVER_URL>
Sign up to request clarification or add additional context in comments.

2 Comments

Which software (server implementation) does this answer refer to? Any link to documentation or reference?
I think that's aimed at pypiserver: stackoverflow.com/a/57795279
3

As you have mentioned that the package has been uploaded to the Artifactory's repository using "twine", I assume the package currently exists in a PyPI local repository of the Artifactory instance.

Since you are looking for an option to delete this artifact from the repository via the command line, please check if this REST API call to delete the artifact is an option for you.

I am sharing a sample command here for your reference.

curl -u <USERNAME>:<PASSWORD> -X DELETE "http://ARTIFACTORY_HOST:ARTIFACTORY_PORT/artifactory/admin-pypi-remote-cache/bd/"

admin-pypi-remote is my repository name and bd is the target folder/package of the deletion task.

2 Comments

Unfortunately, artifactory's response is 405 method not allowed
"HTTP 405" could have occurred either due to an incorrect repository path or if the method being used/expected is distinct. Can you please check it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.