Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitsummary-0.3.5.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitsummary-0.3.5-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

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

Hashes for gitsummary-0.3.5.tar.gz
Algorithm Hash digest
SHA256 f8291f8895c777e06fb6e846fc65247b7302c79e44c9a2c6b5e0ee15aea15fa2
MD5 0b7125705b193625698b12dcfce642e8
BLAKE2b-256 c58c24fbaf5d8bf88829f4cf696c8c7312f186679fb764eae2dc76a4bf704c7d

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for gitsummary-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 72b7cacd80b7b40f08bc2da5eae5b4146c84717c566c9276bb363c254cb79adb
MD5 ea9515009cccf56caddb0ff79e3d91bd
BLAKE2b-256 329749606a6f876e5494e7ca2b8fa664b835057f10a817539b8e66cce462afb2

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page