Skip to main content

Get the "last updated" time for each Sphinx page from Git

Project description

This is a little Sphinx extension that does exactly that.

It also checks for included files and other dependencies.

If a page doesn’t have a source file, its last_updated time is set to None.

If a source file is not tracked by Git (e.g. because it has been auto-generated on demand by autosummary_generate) but its dependencies are, the last_updated time is taken from them. If you don’t want this to happen, use git_untracked_check_dependencies = False.

If a source file is not tracked by Git, its HTML page doesn’t get a source link. If you do want those pages to have a sourcelink, set git_untracked_show_sourcelink = True. Of course, in this case html_copy_source and html_show_sourcelink must also be True, and the theme you are using must support source links in the first place.

The default value for html_last_updated_fmt is changed from None to the empty string.

Usage
  1. Install the Python package sphinx-last-updated-by-git

  2. Add 'sphinx_last_updated_by_git' to extensions in your conf.py

  3. Run Sphinx!

Caveats
  • When using a “Git shallow clone” (with the --depth option), the “last updated” commit for a long-unchanged file might not have been checked out. In this case, the last_updated time is set to None (and an info message is shown during the build).

    This might happen on https://readthedocs.org/ because they use shallow clones by default. The DONT_SHALLOW_CLONE feature should fix this.

  • The date might not be displayed on https://readthedocs.org/ when using the sphinx_rtd_theme (which is their default). See issue #1.

License

BSD-2-Clause (same as Sphinx itself), for more information take a look at the LICENSE file.

Similar stuff

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

sphinx-last-updated-by-git-0.1.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file sphinx-last-updated-by-git-0.1.1.tar.gz.

File metadata

  • Download URL: sphinx-last-updated-by-git-0.1.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for sphinx-last-updated-by-git-0.1.1.tar.gz
Algorithm Hash digest
SHA256 601836047d072fcbfd406cdf4d264b7266e6c2722bd128e65763382d97cf8d9e
MD5 c3a652c468ebe3f82ef01aa089b0b329
BLAKE2b-256 f015ef77d5ed895d3d3413040977833a2e6cbacea5fd480a47340f3f30606a5a

See more details on using hashes here.

File details

Details for the file sphinx_last_updated_by_git-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sphinx_last_updated_by_git-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for sphinx_last_updated_by_git-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 50f73fe56978a4b5147abbd3a50efd3212a2e1ebc1c8473b5239d096ab4f7d2c
MD5 4e778111c3cb864cd6c45ad9df2aaae7
BLAKE2b-256 501c08f846105cd100b62a2d41f3c7b0e30d106626971ec4f90dd08c92ccbb5e

See more details on using hashes here.

Supported by

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