In AWS documentation is crystal clear how to delete a package version, ok.
But, how can I delete a package?
I've uploaded a package with a wrong name, I've deleted the only version of it, now I can see a package without any version but I can't find a way to remove the package with the wrong name. :(
AWS added delete-package api in codeartifact
in the version 1.26.61
(you can delete package in cli, console, APIs)
AWS Console
You can select the package and click on Delete Package
under actions.
You need to update aws-cli to make use of this.
aws codeartifact delete-package --domain <domain> --repository <repo> --package "my_package" --format <pypi | maven | npm | nuget>
Boto3
Update boto3 version to latest
pip install -U boto3
script to delete a package
import boto3
client = boto3.client("codeartifact")
response = client.delete_package(
domain='mydomain',
repository='myrepo',
format='npm'|'pypi'|'maven'|'nuget',
package='mypackage'
)