-
Notifications
You must be signed in to change notification settings - Fork 326
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
Fix error during linkcheck when trying to write pygments.css #2097
base: main
Are you sure you want to change the base?
Fix error during linkcheck when trying to write pygments.css #2097
Conversation
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](https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html) 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](pydata/pydata-sphinx-theme#2097) to fix it. ### Change summary - [📚🎨 Change docs theme from RTD to pydata](a85457a) - [📚🎨🩹 Fix mermaid edge and marker (arrow head) color in darkmode](9eb459a) - [📚✨ Add interrogate badge](3650143) - [🚇🩹 Workaround to fix pydata_sphinx_theme error on linkcheck](f5b35f9)
@@ -99,5 +99,5 @@ def overwrite_pygments_css(app: Sphinx, exception=None): | |||
|
|||
# re-write pygments.css | |||
pygments_css = Path(app.builder.outdir) / "_static" / "pygments.css" | |||
with pygments_css.open("w") as f: | |||
f.write(get_pygments_stylesheet(light_theme, dark_theme)) | |||
pygments_css.parent.mkdir(parents=True, exist_ok=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you shouldn't need parents=True
here, right? Isn't app.builder.outdir
guaranteed to exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(also please add a comment saying something like "_static folder not guaranteed to exist during linkcheck" or similar)
Hi there, I'm currently changing our docs to use your nice theme 😄
However, our CI fails during lickcheck since the parent folder where the theme tries to write
pygments.css
to does not exist during link checking.My workaround on our side is to create the expected parent path for linkcheck in our
conf.py
which lets the CI pass again.This error didn't surface here for 2 reasons: