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

📚🎨👌 Change docs theme from RTD to pydata #324

Merged
merged 4 commits into from
Jan 18, 2025

Conversation

s-weigand
Copy link
Member

@s-weigand s-weigand commented Jan 18, 2025

It is 2025 and I'm tired of getting flash banged by our docs 😅
While the RTD theme served us for a long time, they do not offer a dark theme version.
Whereas the pydata theme offers both light and dark themes as well as a more modern look in general.

While working on this I found a bug when running the link checker so I added a workaround here and opened a PR upstream to fix it.

Change summary

Checklist

  • ✔️ Passing the tests (mandatory for all PR's)

Summary by Sourcery

Update documentation theme to PyData Sphinx Theme and add an Interrogate badge.

Enhancements:

  • Work around a link-checking error in the PyData Sphinx Theme by creating the necessary directory.

Documentation:

  • Migrate documentation theme from Read the Docs to PyData Sphinx Theme.
  • Add a dark mode to the documentation.

Tests:

  • Add an Interrogate badge to track the docstring coverage.

@s-weigand s-weigand requested a review from a team as a code owner January 18, 2025 14:18
Copy link
Contributor

sourcery-ai bot commented Jan 18, 2025

Reviewer's Guide by Sourcery

This pull request migrates the documentation theme from sphinx_rtd_theme to pydata_sphinx_theme. This includes adding a workaround for a bug in pydata_sphinx_theme and adding a custom css file to fix mermaid diagram colors in dark mode. Additionally, an interrogate badge was added to the README.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Migrate documentation theme from sphinx_rtd_theme to pydata_sphinx_theme.
  • Replaced sphinx_rtd_theme with pydata_sphinx_theme in docs/conf.py.
  • Added pydata-sphinx-theme to the docs optional dependencies in pyproject.toml.
  • Removed sphinx-rtd-theme and sphinxcontrib-jquery from the docs optional dependencies in pyproject.toml.
  • Added theme options for pydata_sphinx_theme in docs/conf.py.
  • Added a logo and favicon for the new theme in docs/conf.py.
  • Added a dark mode pygments style in docs/conf.py.
  • Added a link to the github repo in docs/conf.py.
  • Added a workaround to hide empty sidebars in docs/conf.py.
docs/conf.py
pyproject.toml
Add a workaround for a bug in pydata_sphinx_theme.
  • Added a workaround to create the _static directory in the linkcheck build directory to avoid an error in pydata_sphinx_theme.
docs/conf.py
Add custom css to fix mermaid diagram colors in dark mode.
  • Added a custom css file mermaid_dark.css to overwrite the mermaid edge and marker colors in dark mode.
  • Added the custom css file to the html_css_files in docs/conf.py.
docs/conf.py
docs/_static/css/mermaid_dark.css
Add interrogate badge to README.
  • Added an interrogate badge to the README.
README.md
Update the index page to include the README.
  • Replaced the welcome message with an include of the README.md file.
docs/index.md
Remove the old readme file.
  • Removed the old readme file.
docs/readme.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@s-weigand
Copy link
Member Author

@jsnel Have a look at the new pretty docs 😄

Copy link

codecov bot commented Jan 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.04%. Comparing base (de10ba2) to head (ae2cf05).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #324   +/-   ##
=======================================
  Coverage   58.04%   58.04%           
=======================================
  Files          31       31           
  Lines        1616     1616           
  Branches      213      213           
=======================================
  Hits          938      938           
  Misses        660      660           
  Partials       18       18           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

I use a link to a the raw static image svg rather than generation a badge ourt own since it plays nicer accross where you look at the readme and pre-commit will fail below 100% anyway.
Extension error (pydata_sphinx_theme.pygments):
Handler <function overwrite_pygments_css at 0x7f93feb0e4d0> for event 'build-finished' threw an exception (exception: [Errno 2] No such file or directory: '/home/runner/work/pyglotaran-extras/pyglotaran-extras/docs/_build/linkcheck/_static/pygments.css')
make: *** [Makefile:25: linkcheck] Error 2
make: Leaving directory '/home/runner/work/pyglotaran-extras/pyglotaran-extras/docs'
Copy link
Member

@jsnel jsnel left a comment

Choose a reason for hiding this comment

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

Good to see our documentation is now safe to read for us cave dwellers. 👌🌚

@s-weigand s-weigand merged commit cf780e3 into glotaran:main Jan 18, 2025
31 checks passed
@s-weigand s-weigand deleted the change-docs-theme branch January 18, 2025 16:50
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

Successfully merging this pull request may close these issues.

2 participants