Delete all of your forked repositories on Github.
Project description
Fork Purger
>> Delete all of your forked repositories on Github <<
Installation
-
Install using pip:
pip install fork-purger
Exploration
-
Create and collect your Github user access token.
-
Inspect the
--help
menu. Run:fork-purger --help
This will print the following:
+-+-+-+-+ +-+-+-+-+-+-+ |F|o|r|k| |P|u|r|g|e|r| +-+-+-+-+ +-+-+-+-+-+-+ Usage: fork-purger [OPTIONS] Options: --username TEXT Your Github username. [required] --token TEXT Your Github access token with delete permission. [required] --debug / --no-debug See full traceback in case of HTTP error. --delete Delete the forked repos. --help Show this message and exit.
-
By default,
fork-purger
runs in dry mode and doesn't do anything other than just listing the repositories that are about to be deleted. Run:fork-purger --username <gh-username> --token <gh-access-token>
You'll see the following output:
+-+-+-+-+ +-+-+-+-+-+-+ |F|o|r|k| |P|u|r|g|e|r| +-+-+-+-+ +-+-+-+-+-+-+ These forks will be deleted: ============================= https://api.github.com/repos/<gh-username>/ddosify https://api.github.com/repos/<gh-username>/delete-github-forks https://api.github.com/repos/<gh-username>/dependabot-core https://api.github.com/repos/<gh-username>/fork-purger
-
To delete the listed repositories, run the CLI with the
--delete
flag:fork-purger --username <gh-username> --token <gh-access-token> --delete
The output should look similar to this:
+-+-+-+-+ +-+-+-+-+-+-+ |F|o|r|k| |P|u|r|g|e|r| +-+-+-+-+ +-+-+-+-+-+-+ Deleting forked repos: ======================= Deleting... https://api.github.com/repos/<gh-username>/ddosify Deleting... https://api.github.com/repos/<gh-username>/delete-github-forks Deleting... https://api.github.com/repos/<gh-username>/dependabot-core Deleting... https://api.github.com/repos/<gh-username>/fork-purger
-
In case of exceptions, if you need more information, you can run the CLI with the
--debug
flag. This will print out the Python stack trace on the stdout.fork-purger --username <gh-username> --token <gh-access-token> --delete --debug
Architecture
Internally, fork-purger
leverages Python's coroutine objects to collect the URLs of the forked repositories from GitHub and delete them asynchronously. Asyncio coordinates this workflow in a producer-consumer orientation which is choreographed in the orchestrator
function. The following diagram can be helpful to understand how the entire workflow operates:
Here, the square boxes are async functions and each one of them is dedicated to carrying out a single task.
In the first step, an async function calls a GitHub GET API to collect the URLs of the forked repositories. The enqueue
function then aggregates those URLs and puts them in a queue
. The dequeue
function pops the URLs from the queue
and sends them to multiple worker functions to achieve concurrency. Finally, the worker functions leverage a DELETE API to purge the forked repositories.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fork_purger-1.0.1.tar.gz
.
File metadata
- Download URL: fork_purger-1.0.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75e616ba9262b6acd7dcaeea1b8fd5651b4d477d869d7194d126c075b168453b |
|
MD5 | 5e94d11cb50ec7ea86a2f470d7eafa9f |
|
BLAKE2b-256 | f3e13ec1873ae05401ece449e7e9555d6d6a53dcfda8a1bf8f7dc8d7fe929452 |
File details
Details for the file fork_purger-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: fork_purger-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42c43f38ddc45ef84ffc3b4a8935801e9e46bfdcc8f2e684f6d418180818bbe8 |
|
MD5 | f4b6d0d87eed1433e069627319dd5101 |
|
BLAKE2b-256 | 04dce1edaf39d02d0437fd21dc765fa603a88f56c30a0af0da18f8cedd3fcd00 |