Skip to content

Latest commit

 

History

History
80 lines (58 loc) · 2.14 KB

README.md

File metadata and controls

80 lines (58 loc) · 2.14 KB

GitHub vs PyPI: Diff Checker

Fetch and Diff Script

This script fetches the latest or a specified version of the source code from a GitHub repository and a PyPI package, unpacks the files, and performs a diff check on a specified directory within the source files.

Prerequisites

Make sure you have the following installed on your system:

  • jq
  • curl
  • tar

Script Installation

  1. Clone the repo
  2. Make the script executable
cd ~
git clone https://github.com/sirouk/git-pypi-checker
cd ./git-pypi-checker
chmod +x fetch_and_diff.sh

Running the Script

Run the script with the GitHub organization, repository name, PyPI repository name, and an optional version as arguments:

./fetch_and_diff.sh <github_org> <github_repo> <pypi_repo> [version]
  • <github_org>: The GitHub organization name.
  • <github_repo>: The GitHub repository name.
  • <pypi_repo>: The PyPI package name.
  • [version] (optional): The version to fetch. If not provided, the script will fetch the latest release.

Examples

  1. To fetch the latest release from both GitHub and PyPI:

Latest example:

./fetch_and_diff.sh myorg myrepo mypackage 1.2.3
  1. Version specific releases:

No diff example:

./fetch_and_diff.sh opentensor bittensor bittensor 7.2.0

Diff example:

./fetch_and_diff.sh opentensor bittensor bittensor 6.12.2
  1. Fetch and check diff on all releases:

Attempt to fetch and recursively check all versions:

./fetch_and_diff.sh opentensor bittensor bittensor all

Other Possible uses

When fired using the latest or version-specific method, the script will exit 1 upon any diff. This becomes a handy safeguard when chained with a subsequent update command.

For example:

./fetch_and_diff.sh opentensor bittensor bittensor latest && python3 -m pip install --upgrade bittensor

Output

The script will output the following information:

  1. A summary of the GitHub and PyPI sources fetched.
  2. The results of the diff check on the specified GitHub repo source directory.

If there are no differences between the sources, it will output a message indicating that no differences were found.