Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working as expected for older projects using the PyData theme #54

Closed
agriyakhetarpal opened this issue Jul 3, 2023 · 3 comments
Closed

Comments

@agriyakhetarpal
Copy link

agriyakhetarpal commented Jul 3, 2023

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)

@agriyakhetarpal
Copy link
Author

agriyakhetarpal commented Jul 3, 2023

Minimal reproducible example

# in docs/conf.py

extensions = [
...
"sphinx_last_updated_by_git",
]

html_theme = "pydata_sphinx_theme"

# set by default by either the theme or by Sphinx, not sure if helps
html_last_updated_fmt = "%b %d, %Y"

Here is a link to the full conf.py file for more configuration values. The project was hosted on readthedocs before October 2020.

I can confirm that I added sphinx-last-updated-by-git to docs/requirements.txt and other places where required.

Sphinx version: 6.2.1

Relevant logs

The PR build and the build logs for readthedocs are in the issue comment above. I do not see any logs, warnings, or errors relevant to sphinx-last-updated-by-git when I build the documentation locally.

Command-line information via pip:

$ pip show sphinx-last-updated-by-git                                                      
Name: sphinx-last-updated-by-git
Version: 0.3.5
Summary: Get the "last updated" time for each Sphinx page from Git
Home-page: https://github.com/mgeier/sphinx-last-updated-by-git/
Author: Matthias Geier
Author-email: Matthias.Geier@gmail.com
License: BSD-2-Clause
Location: .nox/docs/lib/python3.11/site-packages
Requires: sphinx
Required-by: 

Let me know if I need to post any more information or logs, @mgeier. Thanks a lot!

Edit: I have tried forcing sphinx_rtd_theme>=0.5 in pybamm-team/PyBaMM@b78f27c but to no avail, and I have updated the build logs. It seems that requesting readthedocs for disabling the compatibility feature should be the way to solve it

@agriyakhetarpal
Copy link
Author

agriyakhetarpal commented Jul 4, 2023

I seem to have fixed it by manually adding the "last-updated" value to the footer options of the theme. Thanks for your time, I shall be closing this as the issue was resolved.

@mgeier
Copy link
Owner

mgeier commented Jul 4, 2023

Great to hear that it works now!

If somebody else stumbles upon this, the "last updated" information can be enabled in the PyData theme by using something like this in conf.py:

html_theme_options = {
    "footer_start": [
        "copyright",
        "sphinx-version",
        "last-updated",
    ],
}

Alternatively, "footer_end" can be used.

For more options, see https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/layout.html#layout-footer


There was also an unrelated problem about "shallow clones", where many warnings like this were shown:

WARNING: Git clone too shallow

This can be fixed by updating the .readthedocs.yml file (see #55):

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants