Skip to main content

Tools for data wrangling in github releases

Project description

Release Tools PyPI - Latest Version GitHub Tag

Note: These tools are being used for my personal projects and are not meant for general public use.

This project provides a set of tools to manage publishing a large number of files using GitHub releases, particularly to overcome the 1000 file limit per release by creating supplementary releases. This assumes that gh (the GitHub CLI) is installed and configured on your system, as it is used to interact with GitHub releases.

Features

  • Generate file lists: Create a CSV file containing a list of all files in a GitHub release.
  • Upload files to a release: Upload files from a local directory to a GitHub release, with an option to overwrite existing files.
  • Delete files from a release: Delete specified files from a release and its supplementary releases.

Installation

This project is packaged using Hatch. To install the tools, you can run the following command:

pip install .

This will install the gh_release_tools package and make the following command-line tools available:

  • generate-lists
  • upload-to-release
  • delete-from-release

Usage

It is recommended to run the tools using uvx to avoid dependency conflicts with other installed packages.

uvx

uvx --from gh_release_tools generate-lists --release <tag> --extension <extension>
uvx --from gh_release_tools upload-to-release --release <tag> --folder <folder> --extension <extension> [--overwrite] [--create-extra-releases]

generate-lists

This tool generates a CSV file named listing_files.csv containing a list of assets from a specified GitHub release and its associated -extra releases. The CSV file includes the file name, size, and download URL for each asset. The generated CSV is then uploaded to the base release, overwriting any existing listing_files.csv.

Usage:

generate-lists --release <tag> --extension <ext1> [--extension <ext2> ...]

Arguments:

  • --release, -r: The base name of the GitHub release (e.g., v1.0.0).
  • --extension, -e: The file extension of the assets to include in the list (e.g., .zip). This argument can be specified multiple times for different extensions.

Example:

generate-lists --release v1.0.0 --extension .zip --extension .txt

This command will generate a listing_files.csv file with a list of all .zip and .txt files from the v1.0.0 release and any releases named v1.0.0-extra<number>.

upload-to-release

This tool uploads files from a local folder to a GitHub release. It can be configured to skip files that already exist in the release or to overwrite them. It can also create new supplementary releases if the target release is full.

Usage:

upload-to-release --release <tag> --folder <folder> --extension <ext1> [--extension <ext2> ...] [--overwrite] [--create-extra-releases]

Arguments:

  • --release, -r: The git tag of the release to upload to.
  • --folder, -d: The local folder containing the files to upload.
  • --extension, -e: The file extension of the files to upload (e.g., .zip). This argument can be specified multiple times.
  • --overwrite: (Optional) Overwrite existing assets in the release.
  • --create-extra-releases, -x: (Optional) Create supplementary releases if the main release is full.

Example:

upload-to-release --release v1.0.0 --folder /path/to/files --extension .zip

This command will upload all .zip files from the /path/to/files directory to the v1.0.0 release. If a file with the same name already exists in the release, it will be skipped. To overwrite existing files, use the following command:

upload-to-release --release v1.0.0 --folder /path/to/files --extension .zip --overwrite

delete-from-release

This tool deletes specified files from a GitHub release and its associated -extra releases. You can provide a list of files to delete either as command-line arguments or in a separate text file.

Usage:

delete-from-release --release <tag> [--file-list <file>] [file1 file2 ...]

Arguments:

  • --release, -r: The base name of the GitHub release (e.g., v1.0.0).
  • --file-list, -f: (Optional) Path to a text file with a list of files to delete (one file per line).
  • files: (Optional) Space-separated list of file names to delete.

Example:

delete-from-release --release v1.0.0 --file-list files_to_delete.txt my_file.zip

This command will delete the files listed in files_to_delete.txt and my_file.zip from the v1.0.0 release and any releases named v1.0.0-extra<number>.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gh_release_tools-0.1.8.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gh_release_tools-0.1.8-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file gh_release_tools-0.1.8.tar.gz.

File metadata

  • Download URL: gh_release_tools-0.1.8.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.17

File hashes

Hashes for gh_release_tools-0.1.8.tar.gz
Algorithm Hash digest
SHA256 ea5c5b1d2cd36482d437502b0d1459470bc1c1db12a36e4ff30ee94dec827ac3
MD5 13989ea3ed2ac2aaebe5d1d0824e8912
BLAKE2b-256 b2e86716f5e0b10d6c1400c66dfb153dcb5d971553cfdb41e708fe2b65492b6a

See more details on using hashes here.

File details

Details for the file gh_release_tools-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for gh_release_tools-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d81cf1122ce577b6f88cd2c9ce13cb0b2de959ce48b4a7e5d412086b3adb0985
MD5 73eeae4d00d644fb20a197d7e1376584
BLAKE2b-256 b995688e4d911b43ea9e142aac4272a903222f4f298b02180723696209935e38

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page