To obtain the hash of the most recent git commit of a Python package, follow these steps:
git log -n 1
. This will display the details of the most recent commit, including the hash.Alternatively, if you have the package installed locally on your machine and want to obtain the hash of the most recent commit of the installed version, you can run the following command in your terminal or command prompt:
pip show <package_name> | grep Version | awk '{print $2}' | xargs -I {} sh -c "echo {}; cat /path/to/site-packages/<package_name>.egg-info/GITSHA"
Replace <package_name>
with the name of the Python package you want to obtain the hash for and replace /path/to/site-packages/
with the path to the directory where the package is installed on your machine. This command will display the version of the installed package followed by the hash of the most recent git commit.
Asked: 2023-07-10 10:16:17 +0000
Seen: 13 times
Last updated: Jul 10 '23