print a one-line summary of the current git repository, the current branch, and the hash for the current branch head
Project description
gitsummary
Pure python utility to print a one-line summary of the current git repository, the current branch, and the hash for the current head.
Installation
pip install gitsummary
or
conda -c conda-forge install gitsummary
Usage
>>> import gitsummary
>>> gitsummary.print_cwd_git_version()
'some_git_repository:On branch main at rev cd813e5 (working tree clean)'
>>> gitsummary.print_cwd_git_version(print_timestamp=True)
'19 Mar 2026 11:40:47 some_git_repository:On branch main at rev cd813e5 (working tree clean)'
Returns a string containing the current git repository, the current branch, the hash of the branch head, and whether the working tree has unstaged changes to tracked files. This information is useful in scientific codes to quickly determine the origin of a plot or dataset. The string can, for example, be written in a jupyter notebook or placed in the metadata of a netcdf file.
some_git_repository is reported as the final portion of the URL of the remote 'origin'. If there is no remote named origin, it uses the full path on disk to the .git directory.
Setting print_timestamp=True prepends the current system time to the output.
Testing
Tests are managed with nox. To run the test suite:
pip install nox
nox -p 3.12
License
This project is licensed under the terms of the MIT license.
Credits
Adapted by Timothy W. Hilton from code originally written by Travis O'Brien.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitsummary-0.3.5.tar.gz.
File metadata
- Download URL: gitsummary-0.3.5.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8291f8895c777e06fb6e846fc65247b7302c79e44c9a2c6b5e0ee15aea15fa2
|
|
| MD5 |
0b7125705b193625698b12dcfce642e8
|
|
| BLAKE2b-256 |
c58c24fbaf5d8bf88829f4cf696c8c7312f186679fb764eae2dc76a4bf704c7d
|
Provenance
The following attestation bundles were made for gitsummary-0.3.5.tar.gz:
Publisher:
publish-to-test-pypi.yml on Timothy-W-Hilton/gitsummary
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitsummary-0.3.5.tar.gz -
Subject digest:
f8291f8895c777e06fb6e846fc65247b7302c79e44c9a2c6b5e0ee15aea15fa2 - Sigstore transparency entry: 1128916299
- Sigstore integration time:
-
Permalink:
Timothy-W-Hilton/gitsummary@365fed5c766b1ef0807e847528607fb891b655e5 -
Branch / Tag:
refs/tags/v0.3.5 - Owner: https://github.com/Timothy-W-Hilton
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@365fed5c766b1ef0807e847528607fb891b655e5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gitsummary-0.3.5-py3-none-any.whl.
File metadata
- Download URL: gitsummary-0.3.5-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72b7cacd80b7b40f08bc2da5eae5b4146c84717c566c9276bb363c254cb79adb
|
|
| MD5 |
ea9515009cccf56caddb0ff79e3d91bd
|
|
| BLAKE2b-256 |
329749606a6f876e5494e7ca2b8fa664b835057f10a817539b8e66cce462afb2
|
Provenance
The following attestation bundles were made for gitsummary-0.3.5-py3-none-any.whl:
Publisher:
publish-to-test-pypi.yml on Timothy-W-Hilton/gitsummary
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitsummary-0.3.5-py3-none-any.whl -
Subject digest:
72b7cacd80b7b40f08bc2da5eae5b4146c84717c566c9276bb363c254cb79adb - Sigstore transparency entry: 1128916372
- Sigstore integration time:
-
Permalink:
Timothy-W-Hilton/gitsummary@365fed5c766b1ef0807e847528607fb891b655e5 -
Branch / Tag:
refs/tags/v0.3.5 - Owner: https://github.com/Timothy-W-Hilton
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@365fed5c766b1ef0807e847528607fb891b655e5 -
Trigger Event:
push
-
Statement type: