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.
Make sure you have the following installed on your system:
jq
curl
tar
- Clone the repo
- Make the script executable
cd ~
git clone https://github.com/sirouk/git-pypi-checker
cd ./git-pypi-checker
chmod +x fetch_and_diff.sh
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.
- To fetch the latest release from both GitHub and PyPI:
Latest example:
./fetch_and_diff.sh myorg myrepo mypackage 1.2.3
- 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
- Fetch and check diff on all releases:
Attempt to fetch and recursively check all versions:
./fetch_and_diff.sh opentensor bittensor bittensor all
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
The script will output the following information:
- A summary of the GitHub and PyPI sources fetched.
- 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.