Skip to main content

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.

Release files for gitsummary 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitsummary 0.3.5
File Size Uploaded
gitsummary-0.3.5.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gitsummary 0.3.5
File Interpreter ABI Platform
gitsummary-0.3.5-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / gitsummary-0.3.5.tar.gz

Download URL gitsummary-0.3.5.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f8291f8895c777e06fb6e846fc65247b7302c79e44c9a2c6b5e0ee15aea15fa2
BLAKE2b-256 checksum
How to use checksums
c58c24fbaf5d8bf88829f4cf696c8c7312f186679fb764eae2dc76a4bf704c7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.

Transparency log

Release files / gitsummary-0.3.5-py3-none-any.whl

Download URL gitsummary-0.3.5-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72b7cacd80b7b40f08bc2da5eae5b4146c84717c566c9276bb363c254cb79adb
BLAKE2b-256 checksum
How to use checksums
329749606a6f876e5494e7ca2b8fa664b835057f10a817539b8e66cce462afb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files

0.2

2 release files

0.0.5

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page