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

Switch to furo sphinx docs theme #3088

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

martinhoyer
Copy link
Collaborator

@martinhoyer martinhoyer commented Jul 16, 2024

The currently used theme is not being updated and it's dependencies are causing issues, like #3087

This is a proof of concept of using the Furo theme, which is being used, among others, by pip, Python Developer’s Guide and black.

https://github.com/pradyunsg/furo
https://pradyunsg.me/furo/

Removing usage of rst2man and relying on sphinx builder to create manpage. This would be also a good opportunity to improve the man page, perhaps with additional pages and such.

We could also introduce sphinx-design, for which furo is the showpiece theme:https://sphinx-design.readthedocs.io/en/furo-theme/

Having markdown support would be a boon as well: https://myst-parser.readthedocs.io/en/latest/

Perhaps we could add https://github.com/executablebooks/sphinx-copybutton

Pull Request Checklist

  • implement the feature
  • write the documentation

@martinhoyer martinhoyer added the documentation Improvements or additions to documentation label Jul 16, 2024
@martinhoyer martinhoyer self-assigned this Jul 16, 2024
@martinhoyer martinhoyer force-pushed the furo-theme branch 2 times, most recently from cb57e18 to 48ad1b6 Compare July 16, 2024 10:32
Comment on lines +181 to +182
"(cat {root}/docs/header.txt; echo; tail -n+8 {root}/docs/overview.rst) > {root}/docs/man.rst",
"sed '/versionadded::/d' -i {root}/docs/man.rst",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding these to the sphinx setup or the Makefile?

tmt/docs/conf.py

Lines 316 to 327 in a08a4be

def generate_tmt_docs(app: Sphinx, config: Any) -> None:
""" Run `make generate` to populate the auto-generated sources """
conf_dir = Path(app.confdir)
subprocess.run(["make", "generate"], cwd=conf_dir, check=True)
def setup(app: Sphinx) -> None:
# Generate sources after loading configuration. That should build
# everything, including the logo, before Sphinx starts checking
# whether all input files exist.
app.connect("config-inited", generate_tmt_docs)

Probably combining exclude_patterns = [r"man/*"] and manpages would work. I don't see config options for specific builder overrides.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, whatever works. This is just a PoC of rendering the manpage in the same way as the current setup, just without rst2man.

@psss
Copy link
Collaborator

psss commented Jul 19, 2024

I like the current documentation theme and I'd probably suggest not to change the look that often. We've switched to renku in #2464 which is last November, so less than year. Unless there are a real blockers in further improvements (like the man page rendering) I would stick with renku at least for a while. Saying all this, the proposed furo theme does not look bad either.

@martinhoyer
Copy link
Collaborator Author

@psss I'm sure it can be configured to look/feel a bit more like the current theme, if it's about aesthetics.

Unless there are a real blockers in further improvements

I mean, we're already forced to use specific versions of packages, only a matter of time until something breaks again. Let alone being able to take advantage of development in newer sphinx versions, etc.

@LecrisUT
Copy link
Contributor

From experience, themes can lag behind sphinx backend. I had issues on the book-theme needing to update a whole chain. furo I know it's well maintained, and I think renku would be good too

@martinhoyer
Copy link
Collaborator Author

I think renku would be good too

Looking at the repo activity...I'm not sure about that.

happz and others added 5 commits July 29, 2024 14:24
Recently added `custom.css` erases the theme itself, reverting colors
and everything to defaults. Use different filename for our custom
additions.
Comment on lines +207 to +215
# Dark by default
html_theme_options = {
"light_css_variables": {
"color-scheme": "dark",
},
"dark_css_variables": {
"color-scheme": "dark",
},
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me furo already automatically enables dark mode for example on: https://scikit-build-core.readthedocs.io/en/latest/. I have it enabled system wide on the desktop (and firefox by proxy I guess)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the documentation, it's light by default, but switches to dark automatically when browser is set to prefer dark.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welp, no reason to complicate things. When I've had an epaper device, the dark-theme sites were unreadable, so in some edge cases it's better to let the system/browser set what it prefers, and let the users set it up or buy a good pair of sunglasses.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, agree, I'm just playing with it while in Draft. Also not happy with introducing js :)

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

Successfully merging this pull request may close these issues.

4 participants