Coder Social home page Coder Social logo

sphinx-last-updated-by-git's Introduction

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

This is a little Sphinx extension that does exactly that. It also checks for included files and other dependencies and uses their "last updated" time if it's more recent. For each file, the "author date" of the Git commit where it was last changed is taken to be its "last updated" time. Uncommitted changes are ignored.

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

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!
Options
  • 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.
  • By default, timestamps are displayed using the local time zone. You can specify a datetime.timezone object (or any tzinfo subclass instance) with the configuration option git_last_updated_timezone. You can also use any string recognized by babel, e.g. git_last_updated_timezone = 'Pacific/Auckland'.
  • By default, the "last updated" timestamp is added as an HTML <meta> tag. This can be disabled by setting the configuration option git_last_updated_metatags to False.
  • Files can be excluded from the last updated date calculation by passing a list of exclusion patterns to the configuration option git_exclude_patterns. These patterns are checked on both source files and dependencies and are treated the same way as Sphinx's exclude_patterns.
  • Individual commits can be excluded from the last updated date calculation by passing a list of commit hashes to the configuration option git_exclude_commits.
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 a warning is shown during the build).

    This might happen on https://readthedocs.org/ because they use shallow clones by default. To avoid this problem, you can edit your config file .readthedocs.yml:

    version: 2
    build:
      os: "ubuntu-22.04"
      tools:
        python: "3"
      jobs:
        post_checkout:
          - git fetch --unshallow || true

    For more details, read the docs.

    This might also happen when using Github Actions, because actions/checkout also uses shallow clones by default. This can be changed by using fetch-depth: 0:

    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

    If you only want to get rid of the warning (without actually fixing the problem), use this in your conf.py:

    suppress_warnings = ['git.too_shallow']
    
  • If depedency file does not exist, a warning is being emitted.

    If you only want to get rid of the warning (without actually fixing the problem), use this in your conf.py:

    suppress_warnings = ['git.dependency_not_found']
    
  • When a project on https://readthedocs.org/ using their default theme sphinx_rtd_theme was created before October 20th 2020, the date will not be displayed in the footer.

    One work-around is to enable the (undocumented) feature flag USE_SPHINX_LATEST.

    Another work-around is to override the defaults by means of a requirements.txt file containing something like this:

    sphinx>=2
    sphinx_rtd_theme>=0.5
    

    See also issue #1.

  • In Sphinx versions 5.0 and 5.1, there has been a regression in how dependencies are determined. This could lead to spurious dependencies which means that some "last changed" dates were wrong. This has been fixed in Sphinx version 5.2 and above.

    See also issue #40.

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

sphinx-last-updated-by-git's People

Contributors

dependabot[bot] avatar dolfinus avatar lmoureaux avatar mgeier avatar n-peugnet avatar tenzer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sphinx-last-updated-by-git's Issues

Somehow I don't get it to work...

Could you please provide an example how to use it ?
I don't get it to work !!

In my config.py, I've
import zoneinfo
and
git_last_updated_timezone = 'FR'
I've added "tzdata" in my requirements.txt file.

I get these errors in the log:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/zoneinfo/_common.py", line 12, in load_tzdata
    return resources.files(package_name).joinpath(resource_name).open("rb")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/pathlib.py", line 1044, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/tzdata/zoneinfo/FR'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/babel/dates.py", line 247, in get_timezone
    return zoneinfo.ZoneInfo(zone)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/zoneinfo/_common.py", line 24, in load_tzdata
    raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key FR'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/sphinx/events.py", line 94, in emit
    results.append(listener.handler(self.app, *args))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/sphinx_last_updated_by_git.py", line 267, in _config_inited
    config.git_last_updated_timezone = get_timezone(
                                       ^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/babel/dates.py", line 251, in get_timezone
    raise LookupError(f"Unknown timezone {zone}") from exc
LookupError: Unknown timezone FR

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/sphinx/cmd/build.py", line 276, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/sphinx/application.py", line 247, in __init__
    self.events.emit('config-inited', self.config)
  File "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/sphinx/events.py", line 105, in emit
    raise ExtensionError(__("Handler %r for event %r threw an exception") %
sphinx.errors.ExtensionError: Handler <function _config_inited at 0x7efc3ad65080> for event 'config-inited' threw an exception (exception: Unknown timezone FR)

Extension error (sphinx_last_updated_by_git):
Handler <function _config_inited at 0x7efc3ad65080> for event 'config-inited' threw an exception (exception: Unknown timezone FR)
make: *** [Makefile:20: dirhtml] Error 2
Error: Process completed with exit code 2.

Sorry, if it's a stupid question !
Thx for your help.

0.3.4: pytest is failing

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

I'm gueassing that at least some units are fsailing because I'm usimg as input resourcee autogenerated tar ball from git tag so source tree does not have .git/ directory with git metadata. Should I try to initialize tit repo as work around?

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-sphinx-last-updated-by-git-0.3.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-sphinx-last-updated-by-git-0.3.4-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.16, pytest-7.2.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4, configfile: pytest.ini
plugins: cov-4.0.0
collected 19 items

tests/test_example_repo.py FFFFFFFFFFFFFFF                                                                                                                                            [ 78%]
tests/test_singlehtml.py F                                                                                                                                                            [ 84%]
tests/test_untracked.py FFF                                                                                                                                                           [100%]/usr/lib64/python3.8/site-packages/coverage/inorout.py:507: CoverageWarning: Module sphinx_last_updated_by_git was never imported. (module-not-imported)
  self.warn(f"Module {pkg} was never imported.", slug="module-not-imported")
/usr/lib64/python3.8/site-packages/coverage/control.py:858: CoverageWarning: No data was collected. (no-data-collected)
  self._warn("No data was collected.", slug="no-data-collected")
WARNING: Failed to generate report: No data to report.

/usr/lib/python3.8/site-packages/pytest_cov/plugin.py:297: CovReportWarning: Failed to generate report: No data to report.

  self.cov_controller.finish()


========================================================================================= FAILURES ==========================================================================================
______________________________________________________________________________________ test_repo_full _______________________________________________________________________________________

    def test_repo_full():
>       data = run_sphinx('repo_full')

tests/test_example_repo.py:47:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

subdir = 'repo_full', kwargs = {}, srcdir = PosixPath('/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full'), outdir = '/tmp/tmpw5hhx3z4'
args = ['/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full', '/tmp/tmpw5hhx3z4', '-W', '-v'], result = 2, @py_assert2 = 0, @py_assert1 = False
@py_format4 = '2 == 0'

    def run_sphinx(subdir, **kwargs):
        srcdir = Path(__file__).parent / subdir
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v']
            args.extend('-D{}={}'.format(k, v) for k, v in kwargs.items())
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_example_repo.py:38: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)
______________________________________________________________________________ test_untracked_no_dependencies _______________________________________________________________________________

    def test_untracked_no_dependencies():
>       data = run_sphinx(
            'repo_full',
            git_untracked_check_dependencies=0,
        )

tests/test_example_repo.py:52:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

subdir = 'repo_full', kwargs = {'git_untracked_check_dependencies': 0}, srcdir = PosixPath('/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full')
outdir = '/tmp/tmpziev_e0t'
args = ['/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full', '/tmp/tmpziev_e0t', '-W', '-v', '-Dgit_untracked_check_dependencies=0'], result = 2
@py_assert2 = 0, @py_assert1 = False, @py_format4 = '2 == 0'

    def run_sphinx(subdir, **kwargs):
        srcdir = Path(__file__).parent / subdir
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v']
            args.extend('-D{}={}'.format(k, v) for k, v in kwargs.items())
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_example_repo.py:38: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)
______________________________________________________________________________ test_untracked_show_sourcelink _______________________________________________________________________________

    def test_untracked_show_sourcelink():
>       data = run_sphinx(
            'repo_full',
            git_untracked_show_sourcelink=1,
        )

tests/test_example_repo.py:63:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

subdir = 'repo_full', kwargs = {'git_untracked_show_sourcelink': 1}, srcdir = PosixPath('/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full')
outdir = '/tmp/tmp7zmv3wrw', args = ['/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full', '/tmp/tmp7zmv3wrw', '-W', '-v', '-Dgit_untracked_show_sourcelink=1']
result = 2, @py_assert2 = 0, @py_assert1 = False, @py_format4 = '2 == 0'

    def run_sphinx(subdir, **kwargs):
        srcdir = Path(__file__).parent / subdir
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v']
            args.extend('-D{}={}'.format(k, v) for k, v in kwargs.items())
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_example_repo.py:38: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)
____________________________________________________________________ test_untracked_no_dependencies_and_show_sourcelink _____________________________________________________________________

    def test_untracked_no_dependencies_and_show_sourcelink():
>       data = run_sphinx(
            'repo_full',
            git_untracked_check_dependencies=0,
            git_untracked_show_sourcelink=1,
        )

tests/test_example_repo.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

subdir = 'repo_full', kwargs = {'git_untracked_check_dependencies': 0, 'git_untracked_show_sourcelink': 1}
srcdir = PosixPath('/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full'), outdir = '/tmp/tmpeaci9giv'
args = ['/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full', '/tmp/tmpeaci9giv', '-W', '-v', '-Dgit_untracked_check_dependencies=0', '-Dgit_untracked_show_sourcelink=1']
result = 2, @py_assert2 = 0, @py_assert1 = False, @py_format4 = '2 == 0'

    def run_sphinx(subdir, **kwargs):
        srcdir = Path(__file__).parent / subdir
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v']
            args.extend('-D{}={}'.format(k, v) for k, v in kwargs.items())
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_example_repo.py:38: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)
_____________________________________________________________________________________ test_repo_shallow _____________________________________________________________________________________

capsys = <_pytest.capture.CaptureFixture object at 0x7f05d99b5fa0>

    def test_repo_shallow(capsys):
        with pytest.raises(AssertionError):
            run_sphinx('repo_shallow')
>       assert 'too shallow' in capsys.readouterr().err
E       assert 'too shallow' in '\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in bui... doesn\'t contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_shallow)\n'
E        +  where '\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in bui... doesn\'t contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_shallow)\n' = CaptureResult(out='Running Sphinx v6.1.3\n', err='\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/sit...doesn\'t contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_shallow)\n').err
E        +    where CaptureResult(out='Running Sphinx v6.1.3\n', err='\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/sit...doesn\'t contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_shallow)\n') = <bound method CaptureFixture.readouterr of <_pytest.capture.CaptureFixture object at 0x7f05d99b5fa0>>()
E        +      where <bound method CaptureFixture.readouterr of <_pytest.capture.CaptureFixture object at 0x7f05d99b5fa0>> = <_pytest.capture.CaptureFixture object at 0x7f05d99b5fa0>.readouterr

tests/test_example_repo.py:88: AssertionError
_____________________________________________________________________________ test_repo_shallow_without_warning _____________________________________________________________________________

    def test_repo_shallow_without_warning():
>       data = run_sphinx(
            'repo_shallow',
            suppress_warnings='git.too_shallow,',
        )

tests/test_example_repo.py:92:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

subdir = 'repo_shallow', kwargs = {'suppress_warnings': 'git.too_shallow,'}, srcdir = PosixPath('/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_shallow')
outdir = '/tmp/tmpjkbfcflz'
args = ['/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_shallow', '/tmp/tmpjkbfcflz', '-W', '-v', '-Dsuppress_warnings=git.too_shallow,'], result = 2
@py_assert2 = 0, @py_assert1 = False, @py_format4 = '2 == 0'

    def run_sphinx(subdir, **kwargs):
        srcdir = Path(__file__).parent / subdir
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v']
            args.extend('-D{}={}'.format(k, v) for k, v in kwargs.items())
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_example_repo.py:38: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_shallow)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_shallow)
___________________________________________________________________________________ test_custom_timezone ____________________________________________________________________________________

    def test_custom_timezone():
>       data = run_sphinx(
            'repo_full',
            git_last_updated_timezone='Africa/Ouagadougou',
        )

tests/test_example_repo.py:103:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

subdir = 'repo_full', kwargs = {'git_last_updated_timezone': 'Africa/Ouagadougou'}, srcdir = PosixPath('/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full')
outdir = '/tmp/tmpoz8w63za'
args = ['/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full', '/tmp/tmpoz8w63za', '-W', '-v', '-Dgit_last_updated_timezone=Africa/Ouagadougou'], result = 2
@py_assert2 = 0, @py_assert1 = False, @py_format4 = '2 == 0'

    def run_sphinx(subdir, **kwargs):
        srcdir = Path(__file__).parent / subdir
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v']
            args.extend('-D{}={}'.format(k, v) for k, v in kwargs.items())
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_example_repo.py:38: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)
________________________________________________________________________________________ test_no_git ________________________________________________________________________________________

capsys = <_pytest.capture.CaptureFixture object at 0x7f05d9949e50>

    def test_no_git(capsys):
        path_backup = os.environ['PATH']
        os.environ['PATH'] = ''
        try:
            with pytest.raises(AssertionError):
                run_sphinx('repo_full')
>           assert '"git" command not found' in capsys.readouterr().err
E           assert '"git" command not found' in '\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in bui...ory doesn\'t contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)\n'
E            +  where '\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in bui...ory doesn\'t contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)\n' = CaptureResult(out='Running Sphinx v6.1.3\n', err='\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/sit...ry doesn\'t contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)\n').err
E            +    where CaptureResult(out='Running Sphinx v6.1.3\n', err='\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/sit...ry doesn\'t contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)\n') = <bound method CaptureFixture.readouterr of <_pytest.capture.CaptureFixture object at 0x7f05d9949e50>>()
E            +      where <bound method CaptureFixture.readouterr of <_pytest.capture.CaptureFixture object at 0x7f05d9949e50>> = <_pytest.capture.CaptureFixture object at 0x7f05d9949e50>.readouterr

tests/test_example_repo.py:116: AssertionError
__________________________________________________________________________________ test_no_git_no_warning ___________________________________________________________________________________

capsys = <_pytest.capture.CaptureFixture object at 0x7f05d98e20d0>

    def test_no_git_no_warning(capsys):
        path_backup = os.environ['PATH']
        os.environ['PATH'] = ''
        try:
>           data = run_sphinx(
                'repo_full',
                suppress_warnings='git.command_not_found')

tests/test_example_repo.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

subdir = 'repo_full', kwargs = {'suppress_warnings': 'git.command_not_found'}, srcdir = PosixPath('/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full')
outdir = '/tmp/tmpdh8c_m0_'
args = ['/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full', '/tmp/tmpdh8c_m0_', '-W', '-v', '-Dsuppress_warnings=git.command_not_found'], result = 2
@py_assert2 = 0, @py_assert1 = False, @py_format4 = '2 == 0'

    def run_sphinx(subdir, **kwargs):
        srcdir = Path(__file__).parent / subdir
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v']
            args.extend('-D{}={}'.format(k, v) for k, v in kwargs.items())
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_example_repo.py:38: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)
___________________________________________________________________________ test_exclude_patterns_srcdir_relative ___________________________________________________________________________

    def test_exclude_patterns_srcdir_relative():
>       data = run_sphinx(
            'repo_full',
            git_exclude_patterns='I 🖤 Unicode.rst',
        )

tests/test_example_repo.py:135:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

subdir = 'repo_full', kwargs = {'git_exclude_patterns': 'I 🖤 Unicode.rst'}, srcdir = PosixPath('/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full')
outdir = '/tmp/tmpl3d4ibcj'
args = ['/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full', '/tmp/tmpl3d4ibcj', '-W', '-v', '-Dgit_exclude_patterns=I 🖤 Unicode.rst'], result = 2
@py_assert2 = 0, @py_assert1 = False, @py_format4 = '2 == 0'

    def run_sphinx(subdir, **kwargs):
        srcdir = Path(__file__).parent / subdir
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v']
            args.extend('-D{}={}'.format(k, v) for k, v in kwargs.items())
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_example_repo.py:38: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)
________________________________________________________________________________ test_exclude_patterns_glob _________________________________________________________________________________

    def test_exclude_patterns_glob():
>       data = run_sphinx(
            'repo_full',
            git_exclude_patterns='*.rst',
        )

tests/test_example_repo.py:146:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

subdir = 'repo_full', kwargs = {'git_exclude_patterns': '*.rst'}, srcdir = PosixPath('/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full')
outdir = '/tmp/tmp81nengcp', args = ['/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full', '/tmp/tmp81nengcp', '-W', '-v', '-Dgit_exclude_patterns=*.rst']
result = 2, @py_assert2 = 0, @py_assert1 = False, @py_format4 = '2 == 0'

    def run_sphinx(subdir, **kwargs):
        srcdir = Path(__file__).parent / subdir
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v']
            args.extend('-D{}={}'.format(k, v) for k, v in kwargs.items())
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_example_repo.py:38: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)
_____________________________________________________________________________ test_exclude_patterns_deps_dates ______________________________________________________________________________

    def test_exclude_patterns_deps_dates():
>       data = run_sphinx(
            'repo_full',
            git_exclude_patterns='example_module.py',
        )

tests/test_example_repo.py:160:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

subdir = 'repo_full', kwargs = {'git_exclude_patterns': 'example_module.py'}, srcdir = PosixPath('/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full')
outdir = '/tmp/tmpbznz_oj9'
args = ['/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full', '/tmp/tmpbznz_oj9', '-W', '-v', '-Dgit_exclude_patterns=example_module.py'], result = 2
@py_assert2 = 0, @py_assert1 = False, @py_format4 = '2 == 0'

    def run_sphinx(subdir, **kwargs):
        srcdir = Path(__file__).parent / subdir
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v']
            args.extend('-D{}={}'.format(k, v) for k, v in kwargs.items())
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_example_repo.py:38: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)
________________________________________________________________________________ test_exclude_commits_dates _________________________________________________________________________________

    def test_exclude_commits_dates():
>       data = run_sphinx(
            'repo_full',
            git_exclude_commits='6bb90c6027c3788d3891f833f017dbf8d229e432')

tests/test_example_repo.py:172:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

subdir = 'repo_full', kwargs = {'git_exclude_commits': '6bb90c6027c3788d3891f833f017dbf8d229e432'}
srcdir = PosixPath('/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full'), outdir = '/tmp/tmpl5_blqcq'
args = ['/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full', '/tmp/tmpl5_blqcq', '-W', '-v', '-Dgit_exclude_commits=6bb90c6027c3788d3891f833f017dbf8d229e432']
result = 2, @py_assert2 = 0, @py_assert1 = False, @py_format4 = '2 == 0'

    def run_sphinx(subdir, **kwargs):
        srcdir = Path(__file__).parent / subdir
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v']
            args.extend('-D{}={}'.format(k, v) for k, v in kwargs.items())
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_example_repo.py:38: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)
_______________________________________________________________________________ test_exclude_commits_warning ________________________________________________________________________________

capsys = <_pytest.capture.CaptureFixture object at 0x7f05d98e2a00>

    def test_exclude_commits_warning(capsys):
        with pytest.raises(AssertionError):
            run_sphinx(
                'repo_full',
                git_exclude_commits='23d25d0b7ac4604b7a9545420b2f9de84daabe73')
>       assert 'unhandled files' in capsys.readouterr().err
E       assert 'unhandled files' in '\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in bui...ory doesn\'t contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)\n'
E        +  where '\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in bui...ory doesn\'t contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)\n' = CaptureResult(out='Running Sphinx v6.1.3\n', err='\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/sit...ry doesn\'t contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)\n').err
E        +    where CaptureResult(out='Running Sphinx v6.1.3\n', err='\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/sit...ry doesn\'t contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)\n') = <bound method CaptureFixture.readouterr of <_pytest.capture.CaptureFixture object at 0x7f05d98e2a00>>()
E        +      where <bound method CaptureFixture.readouterr of <_pytest.capture.CaptureFixture object at 0x7f05d98e2a00>> = <_pytest.capture.CaptureFixture object at 0x7f05d98e2a00>.readouterr

tests/test_example_repo.py:187: AssertionError
___________________________________________________________________________ test_exclude_commits_without_warning ____________________________________________________________________________

    def test_exclude_commits_without_warning():
>       data = run_sphinx(
            'repo_full',
            suppress_warnings='git.unhandled_files',
            git_exclude_commits='23d25d0b7ac4604b7a9545420b2f9de84daabe73')

tests/test_example_repo.py:191:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

subdir = 'repo_full', kwargs = {'git_exclude_commits': '23d25d0b7ac4604b7a9545420b2f9de84daabe73', 'suppress_warnings': 'git.unhandled_files'}
srcdir = PosixPath('/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full'), outdir = '/tmp/tmpzkpzg6_a'
args = ['/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full', '/tmp/tmpzkpzg6_a', '-W', '-v', '-Dsuppress_warnings=git.unhandled_files', '-Dgit_exclude_commits=23d25d0b7ac4604b7a9545420b2f9de84daabe73']
result = 2, @py_assert2 = 0, @py_assert1 = False, @py_format4 = '2 == 0'

    def run_sphinx(subdir, **kwargs):
        srcdir = Path(__file__).parent / subdir
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v']
            args.extend('-D{}={}'.format(k, v) for k, v in kwargs.items())
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_example_repo.py:38: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)
______________________________________________________________________________________ test_singlehtml ______________________________________________________________________________________

    def test_singlehtml():
        srcdir = Path(__file__).parent / 'repo_full'
        with tempfile.TemporaryDirectory() as outdir:
            args = [str(srcdir), outdir, '-W', '-v', '-b', 'singlehtml']
            result = build_main(args)
>           assert result == 0
E           assert 2 == 0

tests/test_singlehtml.py:12: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 171, in read
    raise ConfigError(__("config directory doesn't contain a conf.py file (%s)") %
sphinx.errors.ConfigError: config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)

Configuration error:
config directory doesn't contain a conf.py file (/home/tkloczko/rpmbuild/BUILD/sphinx-last-updated-by-git-0.3.4/tests/repo_full)
___________________________________________________________________________________ test_without_git_repo ___________________________________________________________________________________

capsys = <_pytest.capture.CaptureFixture object at 0x7f05d992fa60>

    def test_without_git_repo(capsys):
        with tempfile.TemporaryDirectory() as srcdir:
            assert create_and_run(srcdir) is None
>           assert 'Error getting data from Git' in capsys.readouterr().err
E           assert 'Error getting data from Git' in '\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in bui...vided next time.\nA bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!\n'
E            +  where '\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in bui...vided next time.\nA bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!\n' = CaptureResult(out='Running Sphinx v6.1.3\n', err='\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/sit...ided next time.\nA bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!\n').err
E            +    where CaptureResult(out='Running Sphinx v6.1.3\n', err='\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/sit...ided next time.\nA bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!\n') = <bound method CaptureFixture.readouterr of <_pytest.capture.CaptureFixture object at 0x7f05d992fa60>>()
E            +      where <bound method CaptureFixture.readouterr of <_pytest.capture.CaptureFixture object at 0x7f05d992fa60>> = <_pytest.capture.CaptureFixture object at 0x7f05d992fa60>.readouterr

tests/test_untracked.py:41: AssertionError
___________________________________________________________________________ test_without_git_repo_without_warning ___________________________________________________________________________

    def test_without_git_repo_without_warning():
        with tempfile.TemporaryDirectory() as srcdir:
            data = create_and_run(srcdir, suppress_warnings='git.subprocess_error')
>       assert data == ['None', 'undefined']
E       AssertionError: assert None == ['None', 'undefined']

tests/test_untracked.py:47: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 219, in __init__
    self.setup_extension(extension)
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 398, in setup_extension
    self.registry.load_extension(self, extname)
  File "/usr/lib/python3.8/site-packages/sphinx/registry.py", line 443, in load_extension
    mod = import_module(extname)
  File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__init__.py", line 26, in <module>
    from sphinx.util import progress_message
  File "<frozen importlib._bootstrap>", line 1039, in _handle_fromlist
  File "/usr/lib/python3.8/site-packages/sphinx/deprecation.py", line 46, in __getattr__
    warnings.warn(f"The alias '{self._modname}.{name}' is deprecated, "
sphinx.deprecation.RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.util.display.progress_message' instead. Check CHANGES for Sphinx API modifications.

Exception occurred:
  File "/usr/lib/python3.8/site-packages/sphinx/deprecation.py", line 46, in __getattr__
    warnings.warn(f"The alias '{self._modname}.{name}' is deprecated, "
sphinx.deprecation.RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.util.display.progress_message' instead. Check CHANGES for Sphinx API modifications.
The full traceback has been saved in /tmp/sphinx-err-y_l4m0kw.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
________________________________________________________________________________ test_untracked_source_files ________________________________________________________________________________

    def test_untracked_source_files():
        test_dir = Path(__file__).parent
        with tempfile.TemporaryDirectory(dir=str(test_dir)) as srcdir:
            data = create_and_run(srcdir)
>       assert data == ['None', 'undefined']
E       AssertionError: assert None == ['None', 'undefined']

tests/test_untracked.py:54: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
Running Sphinx v6.1.3
----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 219, in __init__
    self.setup_extension(extension)
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 398, in setup_extension
    self.registry.load_extension(self, extname)
  File "/usr/lib/python3.8/site-packages/sphinx/registry.py", line 443, in load_extension
    mod = import_module(extname)
  File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3.8/site-packages/sphinxcontrib/htmlhelp/__init__.py", line 26, in <module>
    from sphinx.util import progress_message
  File "<frozen importlib._bootstrap>", line 1039, in _handle_fromlist
  File "/usr/lib/python3.8/site-packages/sphinx/deprecation.py", line 46, in __getattr__
    warnings.warn(f"The alias '{self._modname}.{name}' is deprecated, "
sphinx.deprecation.RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.util.display.progress_message' instead. Check CHANGES for Sphinx API modifications.

Exception occurred:
  File "/usr/lib/python3.8/site-packages/sphinx/deprecation.py", line 46, in __getattr__
    warnings.warn(f"The alias '{self._modname}.{name}' is deprecated, "
sphinx.deprecation.RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.util.display.progress_message' instead. Check CHANGES for Sphinx API modifications.
The full traceback has been saved in /tmp/sphinx-err-4g_dqkil.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

---------- coverage: platform linux, python 3.8.16-final-0 -----------

================================================================================== short test summary info ==================================================================================
FAILED tests/test_example_repo.py::test_repo_full - assert 2 == 0
FAILED tests/test_example_repo.py::test_untracked_no_dependencies - assert 2 == 0
FAILED tests/test_example_repo.py::test_untracked_show_sourcelink - assert 2 == 0
FAILED tests/test_example_repo.py::test_untracked_no_dependencies_and_show_sourcelink - assert 2 == 0
FAILED tests/test_example_repo.py::test_repo_shallow - assert 'too shallow' in '\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in bui... doesn\'t contain a conf.py file (/home...
FAILED tests/test_example_repo.py::test_repo_shallow_without_warning - assert 2 == 0
FAILED tests/test_example_repo.py::test_custom_timezone - assert 2 == 0
FAILED tests/test_example_repo.py::test_no_git - assert '"git" command not found' in '\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in bui...ory doesn\'t contain a conf...
FAILED tests/test_example_repo.py::test_no_git_no_warning - assert 2 == 0
FAILED tests/test_example_repo.py::test_exclude_patterns_srcdir_relative - assert 2 == 0
FAILED tests/test_example_repo.py::test_exclude_patterns_glob - assert 2 == 0
FAILED tests/test_example_repo.py::test_exclude_patterns_deps_dates - assert 2 == 0
FAILED tests/test_example_repo.py::test_exclude_commits_dates - assert 2 == 0
FAILED tests/test_example_repo.py::test_exclude_commits_warning - assert 'unhandled files' in '\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in bui...ory doesn\'t contain a conf.py file...
FAILED tests/test_example_repo.py::test_exclude_commits_without_warning - assert 2 == 0
FAILED tests/test_singlehtml.py::test_singlehtml - assert 2 == 0
FAILED tests/test_untracked.py::test_without_git_repo - assert 'Error getting data from Git' in '\nTraceback (most recent call last):\n  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 279, in bui...vided next time.\nA bug...
FAILED tests/test_untracked.py::test_without_git_repo_without_warning - AssertionError: assert None == ['None', 'undefined']
FAILED tests/test_untracked.py::test_untracked_source_files - AssertionError: assert None == ['None', 'undefined']
==================================================================================== 19 failed in 0.94s =====================================================================================

Here is list of installed modules in build env

Package                       Version
----------------------------- -----------------
alabaster                     0.7.13
attrs                         22.2.0
Babel                         2.12.1
build                         0.10.0
charset-normalizer            3.1.0
coverage                      7.2.1
distro                        1.8.0
docutils                      0.19
exceptiongroup                1.0.0
gpg                           1.18.0-unknown
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.1.0
iniconfig                     2.0.0
Jinja2                        3.1.2
libcomps                      0.1.19
MarkupSafe                    2.1.2
packaging                     23.0
pip                           23.0.1
pluggy                        1.0.0
Pygments                      2.14.0
pyproject_hooks               1.0.0
pytest                        7.2.2
pytest-cov                    4.0.0
python-dateutil               2.8.2
pytz                          2023.2
requests                      2.28.2
rpm                           4.17.0
setuptools                    65.6.3
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        6.1.3
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2.dev20230202
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1.dev20230128
sphinxcontrib-qthelp          1.0.3.dev20230128
sphinxcontrib-serializinghtml 1.1.5
tomli                         2.0.1
urllib3                       1.26.15
wheel                         0.38.4
zipp                          3.15.0

Not working as expected for older projects using the PyData theme

I think other themes might be affected too, such as the PyData theme – I have not been able to make this work, neither locally nor on readthedocs (pybamm-team/PyBaMM#3089). @mgeier could you please help investigate this? Here is a link to the PR build and the build logs. I did bump up the Sphinx version to >= 6 in docs/requirements.txt (it was >=1.5 earlier).

However, I can see that other projects have been able to make this extension work with the same theme, maybe this is an issue with our configuration? It is almost similar to others' configurations – so I don't see any conflicts. Or, is it because they are newer projects unlike ours (i.e., post-October 2020) and we have to request the aforementioned feature flag(s) in this thread from readthedocs?

Originally posted by @agriyakhetarpal in #1 (comment)

Slowdown due to many invocations of git

Getting the git dates takes nearly as long as to read in the entire source code.

It should be possible to change the implementation to issue a few git commands for the entire project upfront to avoid invoking git multiple times per folder.

Problems with signed commits

Hi,

My commits are PGP signed.

HTML building failed with:

getting Git timestamps for source files... [  3%] ~/src/myProject/SubDir                                                 
Extension error (sphinx_last_updated_by_git):
Handler <function _env_updated at 0x7f928d993040> for event 'env-updated' threw an exception (exception: unexpected git output in ~/src/myProject/SubDir: b'gpg: Signature made So 17 Apr 2022 19:44:16 CEST\n')
make: *** [Makefile:57: html] Error 2

Workaround:

git config log.showSignature false

Is there any way to detect if this extension is enabled?

Hiya! 👋🏽

I'm working on a new theme and I'd like to ship a clean integration with this extension in that theme. The way that would work is that the "last_updated" content would be placed in a different location, if this extension is enabled (as part of a "article footer" instead of the "site footer").

For doing something like that in the theme's templates/Python code, it needs some way to detect that this extension is enabled and being used. Is there any way, that you know of, for detecting this?

x-ref: pradyunsg/lutra#10

Uncommitted files cause error in other Sphinx extensions, because context["sourcename"] is removed

Thanks for this neat extension to Sphinx.

I use Sphinx with the Sphinx Book Theme and the sphinx-last-updated-by-git extension. When I create a new file in my documentation project that is not yet committed to the Git repository and I run make html, I see the following traceback:

[app] emitting event: 'html-page-context'('usage', 'page.html', {'embedded': False, 'project': '…
 
[app] emitting event: 'build-finished'(ExtensionError("Handler <function add_header_buttons at 0x7ff53dcfd4c0> for event 'html-page-contex
sitemap.xml was generated for URL / in /home/…/docs/_build/html/sitemap.xml

Traceback (most recent call last):
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx/events.py", line 94, in emit
    results.append(listener.handler(self.app, *args))
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx_book_theme/header_buttons/__init__.py", line 152, in add_header_buttons
    "url": f'{pathto("_sources", 1)}/{context["sourcename"]}',
KeyError: 'sourcename'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx/cmd/build.py", line 276, in build_main
    app.build(args.force_all, filenames)
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx/application.py", line 330, in build
    self.builder.build_update()
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 286, in build_update
    self.build(to_build,
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 350, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 524, in write
    self._write_serial(sorted(docnames))
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 534, in _write_serial
    self.write_doc(docname, doctree)
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx/builders/html/__init__.py", line 625, in write_doc
    self.handle_page(docname, ctx, event_arg=doctree)
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx/builders/html/__init__.py", line 1026, in handle_page
    newtmpl = self.app.emit_firstresult('html-page-context', pagename,
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx/application.py", line 457, in emit_firstresult
    return self.events.emit_firstresult(event, *args,
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx/events.py", line 112, in emit_firstresult
    for result in self.emit(name, *args, allowed_exceptions=allowed_exceptions):
  File "/home/…/.virtualenvs/documentation/lib/python3.9/site-packages/sphinx/events.py", line 102, in emit
    raise ExtensionError(__("Handler %r for event %r threw an exception") %
sphinx.errors.ExtensionError: Handler <function add_header_buttons at 0x7ff53dcfd4c0> for event 'html-page-context' threw an exception (exception: 'sourcename')

Extension error (sphinx_book_theme.header_buttons):
Handler <function add_header_buttons at 0x7ff53dcfd4c0> for event 'html-page-context' threw an exception (exception: 'sourcename')
make: *** [Makefile:23: html] Fehler 2

The traceback seems to show that the error comes from Sphinx Book theme. The theme expects to sourcename key in the context in src/sphinx_book_theme/header_buttons/init.py#L152. But, the sourcename key is removed from the context for uncommitted files in https://github.com/mgeier/sphinx-last-updated-by-git/blob/master/src/sphinx_last_updated_by_git.py#L222.

What is the purpose of removing the sourcename key and thus breaking other extensions that rely on it? Are there other alternatives to get the same outcome for sphinx-last-updated-by-git extension without breaking other extensions?

I replaced the line with context['sourcename'] = None. The build works and the resulting page looks fine to me.

A workaround in configuration is git_untracked_show_sourcelink = True.

The behavior is quite annoying during writing and with sphinx-autobuild activated. Of course, the problem resolves once the file is added to the Git repository. It took me quite some time to hunt down the root cause. Maybe, this helps somebody else, even if this issue is closed without a resulting fix in the source code.

My environment:

  • Python 3.9.2 on Debian Bullseye
  • Sphinx: 4.5.0
  • sphinx-last-updated-by-git: 0.3.2
  • sphinx-book-theme: 0.3.2

if combining sphinx-last-updated-by-git with nbsphinx-link there is an obvious error occuring: The external linked file is not included in git and the path is therefore invalid

Not really an issue for sphinx-last-updated-by-git because of the out-of-scope use via nbsphinx-link, nevertheless this may be important for some users and future reference.

sphinx-last-updated-by-git and nbsphinx-link are just not compatible with each other.

Traceback (most recent call last):
  File "c:\users\fleischer\appdata\local\esri\conda\envs\monitoring\lib\site-packages\sphinx\cmd\build.py", line 276, in build_main
    app.build(args.force_all, filenames)
  File "c:\users\fleischer\appdata\local\esri\conda\envs\monitoring\lib\site-packages\sphinx\application.py", line 349, in build
    self.builder.build_update()
  File "c:\users\fleischer\appdata\local\esri\conda\envs\monitoring\lib\site-packages\sphinx\builders\__init__.py", line 299, in build_update
    len(to_build))
  File "c:\users\fleischer\appdata\local\esri\conda\envs\monitoring\lib\site-packages\sphinx\builders\__init__.py", line 311, in build
    updated_docnames = set(self.read())
  File "c:\users\fleischer\appdata\local\esri\conda\envs\monitoring\lib\site-packages\sphinx\builders\__init__.py", line 424, in read
    for retval in self.events.emit('env-updated', self.env):
  File "c:\users\fleischer\appdata\local\esri\conda\envs\monitoring\lib\site-packages\sphinx\events.py", line 99, in emit
    results.append(callback(self.app, *args))
  File "c:\users\fleischer\appdata\local\esri\conda\envs\monitoring\lib\site-packages\sphinx_last_updated_by_git.py", line 166, in _env_updated
    update_file_dates(git_dir, dep_dates[git_dir])
  File "c:\users\fleischer\appdata\local\esri\conda\envs\monitoring\lib\site-packages\sphinx_last_updated_by_git.py", line 40, in update_file_dates
    stderr=subprocess.PIPE,
  File "c:\users\fleischer\appdata\local\esri\conda\envs\monitoring\lib\subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "c:\users\fleischer\appdata\local\esri\conda\envs\monitoring\lib\subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
  File "c:\users\fleischer\appdata\local\esri\conda\envs\monitoring\lib\subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "c:\users\fleischer\appdata\local\esri\conda\envs\monitoring\lib\subprocess.py", line 1017, in _execute_child
    startupinfo)
NotADirectoryError: [WinError 267] Der Verzeichnisname ist ungültig

Doesn't work on the production websites when using with GitHub pages

I configured the extension and deployed it. It works fine on the local builds and gives proper results. But when I pushed by changes on GitHub, the GitHub actions workflow was giving warning and failing the build because of the shallow depth as mentioned in the README. So to patch the error and failing builds, I added suppress_warnings = ["git.too_shallow"] in my conf.py file. The build was successful but the deployed pages didn't show the last updated footer as it was showing on my local build. Not sure why.

This is where it is not rendering. Please check the footer.

Show Commit Hashes

I'm currently misusing html_last_updated_fmt for my whole project and set it for the whole project. (Source)

git_cmd = "git log --pretty=format:'%ad, commit %h' --date=local -n1"
html_last_updated_fmt = os.popen(git_cmd).read()

This shows the same date and commit on all pages.


While using this repository, the commit information is completely gone. As far as I can see in the code, it should be easily retrievable, since you're already working with commit hashes all the time.

I've replaced this for now with your repo. But the Revision is now missing.

def _html_page_context(app, pagename, templatename, context, doctree):
context['last_updated'] = None

Could you add there also a revision (the commit hash) into the html contex, too?

Popular Themes could pick this up then automatically:

https://github.com/readthedocs/sphinx_rtd_theme/blob/0da22b885be387b79f7552c92be00fd14d11228a/sphinx_rtd_theme/footer.html#L27-L43

Dates are incorrect when building the docs in GitLab

Hi there!

I'm trying to get accurate timestamps in the docs. We build them in GitLab; I set CICD to always perform full clones, so the entire git history is history is available. Nonetheless, dates always span a week time at most, so they're false.

I've read somewhere that git-restore-mtime might solve the issue? I don't see how, though. Do you know what else could be at play here?

We use Sphinx 5.1.1.

Thanks!

Is listing last modified pages possible?

First of all, I would like to thank all the developers for this beautiful plugin.

I want to list the last changed pages with their links on one page of the document I created, for example, 10 most recently updated pages. For example, with the todo plugin, when a todolist directive is used, all todos in the project are listed.

Is there a similar feature for this plugin (I couldn't see it in the documentation)? Or can it be added?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.