Skip to content

FIX: properly handle CSS objects in css_files#791

Merged
agoose77 merged 7 commits intomasterfrom
agoose77/fix-sphinx-726-warning
Dec 14, 2023
Merged

FIX: properly handle CSS objects in css_files#791
agoose77 merged 7 commits intomasterfrom
agoose77/fix-sphinx-726-warning

Conversation

@agoose77
Copy link
Copy Markdown
Collaborator

@agoose77 agoose77 commented Dec 12, 2023

Sphinx 7.26 (approximately) deprecates implicit string operations on the contents of context['css_files']. This, in turn, raises warnings for users that enable strict warning checks. This was observed in jupyter-book's test-suite.

This PR updates our handling to first assume objects within this list are _CascadingStyleSheet objects, and replaces the object back on the path.

choldgraf
choldgraf previously approved these changes Dec 12, 2023
Copy link
Copy Markdown
Member

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

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

This looks good to me - a minor nitpick but LGTM regardless.

Should double-check that the "unexpected warnings" test failure is real or not though

if app.config.html_theme == "sphinx_book_theme":
assets.append("styles/sphinx-book-theme.css")
hash_assets_for_files(assets, get_html_theme_path() / "static", context)
hash_assets_for_files(assets, get_html_theme_path() / "static", context, app)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This function is public, but I can't imagine anyone using it. Are you happy with the breaking change?

@agoose77 agoose77 merged commit d9623d6 into master Dec 14, 2023
@bsipocz bsipocz deleted the agoose77/fix-sphinx-726-warning branch January 18, 2026 23:23
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