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

FIX: properly handle CSS objects in css_files #791

Merged
merged 7 commits into from
Dec 14, 2023

Conversation

agoose77
Copy link
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
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

src/sphinx_book_theme/__init__.py Outdated Show resolved Hide resolved
@@ -117,7 +131,7 @@ def hash_html_assets(app, pagename, templatename, context, doctree):
# run but the book theme CSS file won't be linked in Sphinx.
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
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
17 checks passed
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