# PyPI Bulk Release Version Cleanup Utility
[![PyPI Cleanup Version](https://img.shields.io/pypi/v/pypi-cleanup?logo=pypi)](https://pypi.org/project/pypi-cleanup/)
[![PyPI Cleanup Python Versions](https://img.shields.io/pypi/pyversions/pypi-cleanup?logo=pypi)](https://pypi.org/project/pypi-cleanup/)
[![Build Status](https://img.shields.io/github/actions/workflow/status/arcivanov/pypi-cleanup/pypi-cleanup.yml?branch=master)](https://github.com/arcivanov/pypi-cleanup/actions/workflows/pypi-cleanup.yml)
[![PyPI Cleanup Downloads Per Day](https://img.shields.io/pypi/dd/pypi-cleanup?logo=pypi)](https://pypi.org/project/pypi-cleanup/)
[![PyPI Cleanup Downloads Per Week](https://img.shields.io/pypi/dw/pypi-cleanup?logo=pypi)](https://pypi.org/project/pypi-cleanup/)
[![PyPI Cleanup Downloads Per Month](https://img.shields.io/pypi/dm/pypi-cleanup?logo=pypi)](https://pypi.org/project/pypi-cleanup/)
## Overview
PyPI Bulk Release Version Cleanup Utility (`pypi-cleanup`) is designed to bulk-delete releases from PyPI that match
specified patterns.
This utility is most useful when CI/CD method produces a swarm of temporary
[.devN pre-releases](https://www.python.org/dev/peps/pep-0440/#developmental-releases) in between versioned releases.
Being able to cleanup past .devN junk helps PyPI cut down on the storage requirements and keeps release history neatly
organized.
## WARNING
THIS UTILITY IS DESTRUCTIVE AND CAN POTENTIALLY WRECK YOUR PROJECT RELEASES AND MAKE THE PROJECT INACCESSIBLE ON PYPI.
This utility is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY,
or FITNESS FOR A PARTICULAR PURPOSE.
## Details
The default package release version selection pattern is `r".*dev\d+$"`.
Authentication password may be passed via environment variable
`PYPI_CLEANUP_PASSWORD`. Otherwise, you will be prompted to enter it.
Authentication with TOTP is supported.
### Examples:
```bash
$ pypi-cleanup --help
usage: pypi-cleanup [-h] [-u USERNAME] -p PACKAGES [-t URL] [-r PATTERNS | --leave-most-recent-only] [--query-only] [--do-it] [--delete-project] [-y] [-d DAYS] [-v]
PyPi Package Cleanup Utility v0.1.8
options:
-h, --help show this help message and exit
-u USERNAME, --username USERNAME
authentication username (default: None)
-p PACKAGES, --package PACKAGES
PyPI package name (default: None)
-t URL, --host URL PyPI <proto>://<host> prefix (default: https://pypi.org/)
-r PATTERNS, --version-regex PATTERNS
regex to use to match package versions to be deleted (default: None)
--leave-most-recent-only
delete all releases except the *most recent* one, i.e. the one containing the most recently created files (default: False)
--query-only only queries and processes the package, no login required (default: False)
--do-it actually perform the destructive delete (default: False)
--delete-project actually perform the destructive delete that will remove all versions of the project (default: False)
-y, --yes confirm extremely dangerous destructive delete (default: False)
-d DAYS, --days DAYS only delete releases **matching specified patterns** where all files are older than X days (default: 0)
-v, --verbose be verbose (default: 0)
```
#### Query-Only Mode
Query-only mode is a safe mode that simply displays all package versions matches and exits, without requiring authentication or removing safeties:
```bash
$ pypi-cleanup -p karellen-llvm-core -p karellen-llvm-clang -r '.*rc\d.*' --query-only
INFO:root:Running in QUERY-ONLY mode
INFO:root:Will use the following patterns [re.compile('.*rc\\d.*')] on package 'karellen-llvm-core'
INFO:root:Found the following releases of package 'karellen-llvm-core' to delete:
INFO:root: 19.1.0.0rc1.post62
INFO:root: 19.1.0.0rc2
INFO:root: 19.1.0.0rc2.post43
INFO:root: 19.1.0.0rc2.post45
INFO:root: 19.1.0.0rc2.post52
INFO:root: 19.1.0.0rc2.post59
INFO:root: 19.1.0.0rc2.post69
INFO:root: 19.1.0.0rc3
INFO:root: 19.1.0.0rc3.post12
INFO:root: 19.1.0.0rc3.post50
INFO:root: 19.1.0.0rc3.post53
INFO:root: 19.1.0.0rc4
INFO:root: 19.1.0.0rc4.post6
INFO:root: 19.1.0.0rc4.post13
INFO:root: 19.1.0.0rc4.post18
INFO:root:Query-only mode - exiting
```
#### Regular Cleanup of Development Artifacts
First without the `--do-it` confirmation, i.e. in DRY RUN mode, including authentication and getting as close as possible to deleting without actually doing it:
```bash
$ pypi-cleanup -u arcivanov -p pybuilder
INFO:root:Running in DRY RUN mode
INFO:root:Will use the following patterns [re.compile('.*\\.dev\\d+$')] on package 'pybuilder'
INFO:root:Found the following releases of package 'pybuilder' to delete:
INFO:root: 0.13.13.dev20240604074936
INFO:root: 0.13.14.dev20240814015648
Password:
Authentication code: 933344
INFO:root:Would be deleting 'pybuilder' version 0.13.13.dev20240604074936, but not doing it!
INFO:root:Would be deleting 'pybuilder' version 0.13.14.dev20240814015648, but not doing it!
```
Now to actually delete the specificed packages
```bash
$ pypi-cleanup -u arcivanov -p pybuilder --do-it
WARNING:root:!!! POSSIBLE DESTRUCTIVE OPERATION !!!
INFO:root:Will use the following patterns [re.compile('.*\\.dev\\d+$')] on package 'pybuilder'
INFO:root:Found the following releases of package 'pybuilder' to delete:
INFO:root: 0.13.13.dev20240604074936
INFO:root: 0.13.14.dev20240814015648
Password:
Authentication code: 123456
WARNING:root:!!! WILL ACTUALLY DELETE THINGS - LAST CHANCE TO CHANGE YOUR MIND !!!
WARNING:root:Sleeping for 5 seconds - Ctrl-C to abort!
INFO:root:Deleting 'pybuilder' version 0.13.13.dev20240604074936
INFO:root:Deleted 'pybuilder' version 0.13.13.dev20240604074936
INFO:root:Deleting 'pybuilder' version 0.13.14.dev20240814015648
INFO:root:Deleted 'pybuilder' version 0.13.14.dev20240814015648
```
#### Using Custom Regex Pattern
```bash
$ pypi-cleanup -u arcivanov -p geventmp -r '.*\\.dev1$'
WARNING:root:
WARNING:
You're using custom patterns: [re.compile('.*\\\\.dev1$')].
If you make a mistake in your patterns you can potentially wipe critical versions irrecoverably.
Make sure to test your patterns before running the destructive cleanup.
Once you're satisfied the patterns are correct re-run with `-y`/`--yes` to confirm you know what you're doing.
Goodbye.
```
```bash
$ pypi-cleanup -u arcivanov -p geventmp -r '.*\\.dev1$' -y
Password:
WARNING:root:RUNNING IN DRY-RUN MODE
INFO:root:Will use the following patterns [re.compile('.*\\.dev1$')] on package geventmp
Authentication code: 123456
INFO:root:Deleting geventmp version 0.0.1.dev1
```
#### Deleting All Versions Except The Most Recent One
List all versions that are going to be deleted except for the most recent one:
```bash
$ pypi-cleanup -p pypi-cleanup --leave-most-recent-only --query-only
INFO:root:Running in QUERY-ONLY mode
INFO:root:Will only leave the MOST RECENT version of the package 'pypi-cleanup'
INFO:root:Leaving the MOST RECENT version for 'pypi-cleanup': 0.1.7 - 2024-06-25T05:53:47.930884+0000
INFO:root:Found the following releases of package 'pypi-cleanup' to delete:
INFO:root: 0.0.1
INFO:root: 0.0.2
INFO:root: 0.0.3
INFO:root: 0.1.0
INFO:root: 0.1.1
INFO:root: 0.1.2
INFO:root: 0.1.3
INFO:root: 0.1.4
INFO:root: 0.1.5
INFO:root: 0.1.6
INFO:root:Query-only mode - exiting
```
Proceeding with deletion of everything except the most recent version requires pulling safeties:
```bash
$ pypi-cleanup -p pypi-cleanup --leave-most-recent-only
WARNING:root:
WARNING:
You're trying to delete ALL versions of the package EXCEPT for the *most recent one*, i.e.
the one with the most recent (by the wall clock) files, disregarding the actual version numbers
or versioning schemes!
You can potentially wipe critical versions irrecoverably.
Make sure this is what you really want before running the destructive cleanup.
Once you're sure you want to delete all versions except the most recent one,
re-run with `-y`/`--yes` to confirm you know what you're doing.
Goodbye.
```
#### Deleting Multiple Packages
Specify multiple packages by adding additional `-p` arguments as follows:
```bash
$ pypi-cleanup -p karellen-llvm-core -p karellen-llvm-clang -p karellen-llvm-lldb -p karellen-llvm-toolchain-tools -r '.*rc\d.*' -y -u karellen --do-it
WARNING:root:!!! POSSIBLE DESTRUCTIVE OPERATION !!!
INFO:root:Will use the following patterns [re.compile('.*rc\\d.*')] on package 'karellen-llvm-core'
INFO:root:Will use the following patterns [re.compile('.*rc\\d.*')] on package 'karellen-llvm-clang'
INFO:root:Will use the following patterns [re.compile('.*rc\\d.*')] on package 'karellen-llvm-lldb'
INFO:root:Will use the following patterns [re.compile('.*rc\\d.*')] on package 'karellen-llvm-toolchain-tools'
INFO:root:Found the following releases of package 'karellen-llvm-core' to delete:
INFO:root: 19.1.0.0rc1.post62
INFO:root: 19.1.0.0rc2
INFO:root: 19.1.0.0rc2.post43
INFO:root: 19.1.0.0rc2.post45
INFO:root: 19.1.0.0rc2.post52
INFO:root: 19.1.0.0rc2.post59
INFO:root: 19.1.0.0rc2.post69
INFO:root: 19.1.0.0rc3
INFO:root: 19.1.0.0rc3.post12
INFO:root: 19.1.0.0rc3.post50
INFO:root: 19.1.0.0rc3.post53
INFO:root: 19.1.0.0rc4
INFO:root: 19.1.0.0rc4.post6
INFO:root: 19.1.0.0rc4.post13
INFO:root: 19.1.0.0rc4.post18
INFO:root:Found the following releases of package 'karellen-llvm-clang' to delete:
INFO:root: 19.1.0.0rc1.post62
INFO:root: 19.1.0.0rc2
INFO:root: 19.1.0.0rc2.post43
INFO:root: 19.1.0.0rc2.post45
INFO:root: 19.1.0.0rc2.post52
INFO:root: 19.1.0.0rc2.post59
INFO:root: 19.1.0.0rc2.post69
INFO:root: 19.1.0.0rc3
INFO:root: 19.1.0.0rc3.post12
INFO:root: 19.1.0.0rc3.post50
INFO:root: 19.1.0.0rc3.post53
INFO:root: 19.1.0.0rc4
INFO:root: 19.1.0.0rc4.post6
INFO:root: 19.1.0.0rc4.post13
INFO:root: 19.1.0.0rc4.post18
INFO:root:Found the following releases of package 'karellen-llvm-lldb' to delete:
INFO:root: 19.1.0.0rc4.post6
INFO:root: 19.1.0.0rc4.post13
INFO:root: 19.1.0.0rc4.post18
INFO:root:Found the following releases of package 'karellen-llvm-toolchain-tools' to delete:
INFO:root: 19.1.0.0rc1.post62
INFO:root: 19.1.0.0rc2
INFO:root: 19.1.0.0rc2.post43
INFO:root: 19.1.0.0rc2.post45
INFO:root: 19.1.0.0rc2.post52
INFO:root: 19.1.0.0rc2.post59
INFO:root: 19.1.0.0rc2.post69
INFO:root: 19.1.0.0rc3
INFO:root: 19.1.0.0rc3.post12
INFO:root: 19.1.0.0rc3.post50
INFO:root: 19.1.0.0rc3.post53
INFO:root: 19.1.0.0rc4
INFO:root: 19.1.0.0rc4.post6
INFO:root: 19.1.0.0rc4.post13
INFO:root: 19.1.0.0rc4.post18
Password:
Authentication code: 123456
WARNING:root:!!! WILL ACTUALLY DELETE THINGS - LAST CHANCE TO CHANGE YOUR MIND !!!
WARNING:root:Sleeping for 5 seconds - Ctrl-C to abort!
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc1.post62
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc1.post62
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc2
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc2
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc2.post43
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc2.post43
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc2.post45
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc2.post45
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc2.post52
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc2.post52
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc2.post59
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc2.post59
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc2.post69
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc2.post69
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc3
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc3
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc3.post12
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc3.post12
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc3.post50
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc3.post50
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc3.post53
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc3.post53
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc4
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc4
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc4.post6
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc4.post6
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc4.post13
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc4.post13
INFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc4.post18
INFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc4.post18
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc1.post62
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc1.post62
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc2
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc2
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc2.post43
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc2.post43
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc2.post45
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc2.post45
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc2.post52
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc2.post52
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc2.post59
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc2.post59
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc2.post69
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc2.post69
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc3
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc3
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc3.post12
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc3.post12
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc3.post50
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc3.post50
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc3.post53
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc3.post53
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc4
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc4
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc4.post6
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc4.post6
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc4.post13
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc4.post13
INFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc4.post18
INFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc4.post18
INFO:root:Deleting 'karellen-llvm-lldb' version 19.1.0.0rc4.post6
INFO:root:Deleted 'karellen-llvm-lldb' version 19.1.0.0rc4.post6
INFO:root:Deleting 'karellen-llvm-lldb' version 19.1.0.0rc4.post13
INFO:root:Deleted 'karellen-llvm-lldb' version 19.1.0.0rc4.post13
INFO:root:Deleting 'karellen-llvm-lldb' version 19.1.0.0rc4.post18
INFO:root:Deleted 'karellen-llvm-lldb' version 19.1.0.0rc4.post18
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc1.post62
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc1.post62
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post43
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post43
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post45
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post45
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post52
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post52
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post59
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post59
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post69
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post69
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3.post12
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3.post12
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3.post50
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3.post50
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3.post53
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3.post53
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4.post6
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4.post6
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4.post13
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4.post13
INFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4.post18
INFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4.post18
```
Raw data
{
"_id": null,
"home_page": "https://github.com/arcivanov/pypi-cleanup",
"name": "pypi-cleanup",
"maintainer": "Arcadiy Ivanov",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "arcadiy@ivanov.biz",
"keywords": "PyPI cleanup build dev tool release version",
"author": "Arcadiy Ivanov",
"author_email": "arcadiy@ivanov.biz",
"download_url": "https://files.pythonhosted.org/packages/67/83/dce5485c269629e0f3de65b32865da76ea523b44e0440332c69b4c80f0aa/pypi_cleanup-0.1.8.tar.gz",
"platform": null,
"description": "# PyPI Bulk Release Version Cleanup Utility\n\n[![PyPI Cleanup Version](https://img.shields.io/pypi/v/pypi-cleanup?logo=pypi)](https://pypi.org/project/pypi-cleanup/)\n[![PyPI Cleanup Python Versions](https://img.shields.io/pypi/pyversions/pypi-cleanup?logo=pypi)](https://pypi.org/project/pypi-cleanup/)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/arcivanov/pypi-cleanup/pypi-cleanup.yml?branch=master)](https://github.com/arcivanov/pypi-cleanup/actions/workflows/pypi-cleanup.yml)\n[![PyPI Cleanup Downloads Per Day](https://img.shields.io/pypi/dd/pypi-cleanup?logo=pypi)](https://pypi.org/project/pypi-cleanup/)\n[![PyPI Cleanup Downloads Per Week](https://img.shields.io/pypi/dw/pypi-cleanup?logo=pypi)](https://pypi.org/project/pypi-cleanup/)\n[![PyPI Cleanup Downloads Per Month](https://img.shields.io/pypi/dm/pypi-cleanup?logo=pypi)](https://pypi.org/project/pypi-cleanup/)\n\n## Overview\n\nPyPI Bulk Release Version Cleanup Utility (`pypi-cleanup`) is designed to bulk-delete releases from PyPI that match\nspecified patterns.\nThis utility is most useful when CI/CD method produces a swarm of temporary\n[.devN pre-releases](https://www.python.org/dev/peps/pep-0440/#developmental-releases) in between versioned releases.\n\nBeing able to cleanup past .devN junk helps PyPI cut down on the storage requirements and keeps release history neatly\norganized.\n\n## WARNING\n\nTHIS UTILITY IS DESTRUCTIVE AND CAN POTENTIALLY WRECK YOUR PROJECT RELEASES AND MAKE THE PROJECT INACCESSIBLE ON PYPI.\n\nThis utility is provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY,\nor FITNESS FOR A PARTICULAR PURPOSE.\n\n## Details\n\nThe default package release version selection pattern is `r\".*dev\\d+$\"`.\n\nAuthentication password may be passed via environment variable\n`PYPI_CLEANUP_PASSWORD`. Otherwise, you will be prompted to enter it.\n\nAuthentication with TOTP is supported.\n\n### Examples:\n\n```bash\n$ pypi-cleanup --help\nusage: pypi-cleanup [-h] [-u USERNAME] -p PACKAGES [-t URL] [-r PATTERNS | --leave-most-recent-only] [--query-only] [--do-it] [--delete-project] [-y] [-d DAYS] [-v]\n\nPyPi Package Cleanup Utility v0.1.8\n\noptions:\n -h, --help show this help message and exit\n -u USERNAME, --username USERNAME\n authentication username (default: None)\n -p PACKAGES, --package PACKAGES\n PyPI package name (default: None)\n -t URL, --host URL PyPI <proto>://<host> prefix (default: https://pypi.org/)\n -r PATTERNS, --version-regex PATTERNS\n regex to use to match package versions to be deleted (default: None)\n --leave-most-recent-only\n delete all releases except the *most recent* one, i.e. the one containing the most recently created files (default: False)\n --query-only only queries and processes the package, no login required (default: False)\n --do-it actually perform the destructive delete (default: False)\n --delete-project actually perform the destructive delete that will remove all versions of the project (default: False)\n -y, --yes confirm extremely dangerous destructive delete (default: False)\n -d DAYS, --days DAYS only delete releases **matching specified patterns** where all files are older than X days (default: 0)\n -v, --verbose be verbose (default: 0)\n```\n\n#### Query-Only Mode\n\nQuery-only mode is a safe mode that simply displays all package versions matches and exits, without requiring authentication or removing safeties:\n\n```bash\n$ pypi-cleanup -p karellen-llvm-core -p karellen-llvm-clang -r '.*rc\\d.*' --query-only\nINFO:root:Running in QUERY-ONLY mode\nINFO:root:Will use the following patterns [re.compile('.*rc\\\\d.*')] on package 'karellen-llvm-core'\nINFO:root:Found the following releases of package 'karellen-llvm-core' to delete:\nINFO:root: 19.1.0.0rc1.post62\nINFO:root: 19.1.0.0rc2\nINFO:root: 19.1.0.0rc2.post43\nINFO:root: 19.1.0.0rc2.post45\nINFO:root: 19.1.0.0rc2.post52\nINFO:root: 19.1.0.0rc2.post59\nINFO:root: 19.1.0.0rc2.post69\nINFO:root: 19.1.0.0rc3\nINFO:root: 19.1.0.0rc3.post12\nINFO:root: 19.1.0.0rc3.post50\nINFO:root: 19.1.0.0rc3.post53\nINFO:root: 19.1.0.0rc4\nINFO:root: 19.1.0.0rc4.post6\nINFO:root: 19.1.0.0rc4.post13\nINFO:root: 19.1.0.0rc4.post18\nINFO:root:Query-only mode - exiting\n```\n\n#### Regular Cleanup of Development Artifacts\n\nFirst without the `--do-it` confirmation, i.e. in DRY RUN mode, including authentication and getting as close as possible to deleting without actually doing it:\n\n```bash\n$ pypi-cleanup -u arcivanov -p pybuilder\nINFO:root:Running in DRY RUN mode\nINFO:root:Will use the following patterns [re.compile('.*\\\\.dev\\\\d+$')] on package 'pybuilder'\nINFO:root:Found the following releases of package 'pybuilder' to delete:\nINFO:root: 0.13.13.dev20240604074936\nINFO:root: 0.13.14.dev20240814015648\nPassword: \nAuthentication code: 933344\nINFO:root:Would be deleting 'pybuilder' version 0.13.13.dev20240604074936, but not doing it!\nINFO:root:Would be deleting 'pybuilder' version 0.13.14.dev20240814015648, but not doing it!\n```\n\nNow to actually delete the specificed packages\n```bash\n$ pypi-cleanup -u arcivanov -p pybuilder --do-it\nWARNING:root:!!! POSSIBLE DESTRUCTIVE OPERATION !!!\nINFO:root:Will use the following patterns [re.compile('.*\\\\.dev\\\\d+$')] on package 'pybuilder'\nINFO:root:Found the following releases of package 'pybuilder' to delete:\nINFO:root: 0.13.13.dev20240604074936\nINFO:root: 0.13.14.dev20240814015648\nPassword: \nAuthentication code: 123456\nWARNING:root:!!! WILL ACTUALLY DELETE THINGS - LAST CHANCE TO CHANGE YOUR MIND !!!\nWARNING:root:Sleeping for 5 seconds - Ctrl-C to abort!\nINFO:root:Deleting 'pybuilder' version 0.13.13.dev20240604074936\nINFO:root:Deleted 'pybuilder' version 0.13.13.dev20240604074936\nINFO:root:Deleting 'pybuilder' version 0.13.14.dev20240814015648\nINFO:root:Deleted 'pybuilder' version 0.13.14.dev20240814015648\n```\n\n#### Using Custom Regex Pattern\n\n```bash\n$ pypi-cleanup -u arcivanov -p geventmp -r '.*\\\\.dev1$'\nWARNING:root:\nWARNING:\n You're using custom patterns: [re.compile('.*\\\\\\\\.dev1$')].\n If you make a mistake in your patterns you can potentially wipe critical versions irrecoverably.\n Make sure to test your patterns before running the destructive cleanup.\n Once you're satisfied the patterns are correct re-run with `-y`/`--yes` to confirm you know what you're doing.\n Goodbye.\n```\n\n```bash\n$ pypi-cleanup -u arcivanov -p geventmp -r '.*\\\\.dev1$' -y\nPassword:\nWARNING:root:RUNNING IN DRY-RUN MODE\nINFO:root:Will use the following patterns [re.compile('.*\\\\.dev1$')] on package geventmp\nAuthentication code: 123456\nINFO:root:Deleting geventmp version 0.0.1.dev1\n```\n\n#### Deleting All Versions Except The Most Recent One\n\nList all versions that are going to be deleted except for the most recent one:\n\n```bash\n$ pypi-cleanup -p pypi-cleanup --leave-most-recent-only --query-only\nINFO:root:Running in QUERY-ONLY mode\nINFO:root:Will only leave the MOST RECENT version of the package 'pypi-cleanup'\nINFO:root:Leaving the MOST RECENT version for 'pypi-cleanup': 0.1.7 - 2024-06-25T05:53:47.930884+0000\nINFO:root:Found the following releases of package 'pypi-cleanup' to delete:\nINFO:root: 0.0.1\nINFO:root: 0.0.2\nINFO:root: 0.0.3\nINFO:root: 0.1.0\nINFO:root: 0.1.1\nINFO:root: 0.1.2\nINFO:root: 0.1.3\nINFO:root: 0.1.4\nINFO:root: 0.1.5\nINFO:root: 0.1.6\nINFO:root:Query-only mode - exiting\n```\n\nProceeding with deletion of everything except the most recent version requires pulling safeties: \n\n```bash\n$ pypi-cleanup -p pypi-cleanup --leave-most-recent-only\nWARNING:root:\nWARNING:\n You're trying to delete ALL versions of the package EXCEPT for the *most recent one*, i.e.\n the one with the most recent (by the wall clock) files, disregarding the actual version numbers\n or versioning schemes!\n\n You can potentially wipe critical versions irrecoverably.\n Make sure this is what you really want before running the destructive cleanup.\n Once you're sure you want to delete all versions except the most recent one,\n re-run with `-y`/`--yes` to confirm you know what you're doing.\n Goodbye.\n```\n\n#### Deleting Multiple Packages\n\nSpecify multiple packages by adding additional `-p` arguments as follows:\n\n```bash\n$ pypi-cleanup -p karellen-llvm-core -p karellen-llvm-clang -p karellen-llvm-lldb -p karellen-llvm-toolchain-tools -r '.*rc\\d.*' -y -u karellen --do-it\nWARNING:root:!!! POSSIBLE DESTRUCTIVE OPERATION !!!\nINFO:root:Will use the following patterns [re.compile('.*rc\\\\d.*')] on package 'karellen-llvm-core'\nINFO:root:Will use the following patterns [re.compile('.*rc\\\\d.*')] on package 'karellen-llvm-clang'\nINFO:root:Will use the following patterns [re.compile('.*rc\\\\d.*')] on package 'karellen-llvm-lldb'\nINFO:root:Will use the following patterns [re.compile('.*rc\\\\d.*')] on package 'karellen-llvm-toolchain-tools'\nINFO:root:Found the following releases of package 'karellen-llvm-core' to delete:\nINFO:root: 19.1.0.0rc1.post62\nINFO:root: 19.1.0.0rc2\nINFO:root: 19.1.0.0rc2.post43\nINFO:root: 19.1.0.0rc2.post45\nINFO:root: 19.1.0.0rc2.post52\nINFO:root: 19.1.0.0rc2.post59\nINFO:root: 19.1.0.0rc2.post69\nINFO:root: 19.1.0.0rc3\nINFO:root: 19.1.0.0rc3.post12\nINFO:root: 19.1.0.0rc3.post50\nINFO:root: 19.1.0.0rc3.post53\nINFO:root: 19.1.0.0rc4\nINFO:root: 19.1.0.0rc4.post6\nINFO:root: 19.1.0.0rc4.post13\nINFO:root: 19.1.0.0rc4.post18\nINFO:root:Found the following releases of package 'karellen-llvm-clang' to delete:\nINFO:root: 19.1.0.0rc1.post62\nINFO:root: 19.1.0.0rc2\nINFO:root: 19.1.0.0rc2.post43\nINFO:root: 19.1.0.0rc2.post45\nINFO:root: 19.1.0.0rc2.post52\nINFO:root: 19.1.0.0rc2.post59\nINFO:root: 19.1.0.0rc2.post69\nINFO:root: 19.1.0.0rc3\nINFO:root: 19.1.0.0rc3.post12\nINFO:root: 19.1.0.0rc3.post50\nINFO:root: 19.1.0.0rc3.post53\nINFO:root: 19.1.0.0rc4\nINFO:root: 19.1.0.0rc4.post6\nINFO:root: 19.1.0.0rc4.post13\nINFO:root: 19.1.0.0rc4.post18\nINFO:root:Found the following releases of package 'karellen-llvm-lldb' to delete:\nINFO:root: 19.1.0.0rc4.post6\nINFO:root: 19.1.0.0rc4.post13\nINFO:root: 19.1.0.0rc4.post18\nINFO:root:Found the following releases of package 'karellen-llvm-toolchain-tools' to delete:\nINFO:root: 19.1.0.0rc1.post62\nINFO:root: 19.1.0.0rc2\nINFO:root: 19.1.0.0rc2.post43\nINFO:root: 19.1.0.0rc2.post45\nINFO:root: 19.1.0.0rc2.post52\nINFO:root: 19.1.0.0rc2.post59\nINFO:root: 19.1.0.0rc2.post69\nINFO:root: 19.1.0.0rc3\nINFO:root: 19.1.0.0rc3.post12\nINFO:root: 19.1.0.0rc3.post50\nINFO:root: 19.1.0.0rc3.post53\nINFO:root: 19.1.0.0rc4\nINFO:root: 19.1.0.0rc4.post6\nINFO:root: 19.1.0.0rc4.post13\nINFO:root: 19.1.0.0rc4.post18\nPassword: \nAuthentication code: 123456\nWARNING:root:!!! WILL ACTUALLY DELETE THINGS - LAST CHANCE TO CHANGE YOUR MIND !!!\nWARNING:root:Sleeping for 5 seconds - Ctrl-C to abort!\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc1.post62\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc1.post62\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc2\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc2\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc2.post43\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc2.post43\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc2.post45\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc2.post45\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc2.post52\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc2.post52\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc2.post59\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc2.post59\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc2.post69\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc2.post69\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc3\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc3\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc3.post12\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc3.post12\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc3.post50\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc3.post50\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc3.post53\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc3.post53\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc4\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc4\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc4.post6\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc4.post6\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc4.post13\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc4.post13\nINFO:root:Deleting 'karellen-llvm-core' version 19.1.0.0rc4.post18\nINFO:root:Deleted 'karellen-llvm-core' version 19.1.0.0rc4.post18\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc1.post62\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc1.post62\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc2\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc2\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc2.post43\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc2.post43\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc2.post45\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc2.post45\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc2.post52\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc2.post52\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc2.post59\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc2.post59\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc2.post69\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc2.post69\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc3\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc3\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc3.post12\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc3.post12\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc3.post50\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc3.post50\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc3.post53\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc3.post53\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc4\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc4\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc4.post6\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc4.post6\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc4.post13\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc4.post13\nINFO:root:Deleting 'karellen-llvm-clang' version 19.1.0.0rc4.post18\nINFO:root:Deleted 'karellen-llvm-clang' version 19.1.0.0rc4.post18\nINFO:root:Deleting 'karellen-llvm-lldb' version 19.1.0.0rc4.post6\nINFO:root:Deleted 'karellen-llvm-lldb' version 19.1.0.0rc4.post6\nINFO:root:Deleting 'karellen-llvm-lldb' version 19.1.0.0rc4.post13\nINFO:root:Deleted 'karellen-llvm-lldb' version 19.1.0.0rc4.post13\nINFO:root:Deleting 'karellen-llvm-lldb' version 19.1.0.0rc4.post18\nINFO:root:Deleted 'karellen-llvm-lldb' version 19.1.0.0rc4.post18\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc1.post62\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc1.post62\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post43\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post43\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post45\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post45\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post52\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post52\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post59\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post59\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post69\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc2.post69\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3.post12\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3.post12\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3.post50\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3.post50\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3.post53\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc3.post53\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4.post6\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4.post6\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4.post13\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4.post13\nINFO:root:Deleting 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4.post18\nINFO:root:Deleted 'karellen-llvm-toolchain-tools' version 19.1.0.0rc4.post18\n```\n",
"bugtrack_url": null,
"license": "Apache License, Version 2.0",
"summary": "PyPI Bulk Release Version Cleanup Utility",
"version": "0.1.8",
"project_urls": {
"Bug Tracker": "https://github.com/arcivanov/pypi-cleanup/issues",
"Documentation": "https://github.com/arcivanov/pypi-cleanup",
"Homepage": "https://github.com/arcivanov/pypi-cleanup",
"Source Code": "https://github.com/arcivanov/pypi-cleanup"
},
"split_keywords": [
"pypi",
"cleanup",
"build",
"dev",
"tool",
"release",
"version"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "dcf7bddb82af555ad0899dec20352d4f9923a3c541be68a6466a5db26d35a663",
"md5": "50a397cc23d2654199d113f70d7120c1",
"sha256": "f3111ee273816ed5b1bc4626514caff524cdd70c9e09c09c3c66884a85ef2815"
},
"downloads": -1,
"filename": "pypi_cleanup-0.1.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "50a397cc23d2654199d113f70d7120c1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 14865,
"upload_time": "2024-09-20T21:44:11",
"upload_time_iso_8601": "2024-09-20T21:44:11.244379Z",
"url": "https://files.pythonhosted.org/packages/dc/f7/bddb82af555ad0899dec20352d4f9923a3c541be68a6466a5db26d35a663/pypi_cleanup-0.1.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6783dce5485c269629e0f3de65b32865da76ea523b44e0440332c69b4c80f0aa",
"md5": "40dca4a6ed96dabc74912a99368571eb",
"sha256": "309fda274824818603957ec24f7a7b5793fbd65131394f428ee1d4f54963f99e"
},
"downloads": -1,
"filename": "pypi_cleanup-0.1.8.tar.gz",
"has_sig": false,
"md5_digest": "40dca4a6ed96dabc74912a99368571eb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 19392,
"upload_time": "2024-09-20T21:44:12",
"upload_time_iso_8601": "2024-09-20T21:44:12.728179Z",
"url": "https://files.pythonhosted.org/packages/67/83/dce5485c269629e0f3de65b32865da76ea523b44e0440332c69b4c80f0aa/pypi_cleanup-0.1.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-20 21:44:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "arcivanov",
"github_project": "pypi-cleanup",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pypi-cleanup"
}