-
Notifications
You must be signed in to change notification settings - Fork 69
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
Drop usage of internal API when conditionally including assets #198
Conversation
updates: - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.6.0](pre-commit/pre-commit-hooks@v4.3.0...v4.6.0) - [github.com/mgedmin/check-manifest: 0.48 → 0.49](mgedmin/check-manifest@0.48...0.49) - [github.com/psf/black: 22.3.0 → 24.8.0](psf/black@22.3.0...24.8.0) - [github.com/PyCQA/pylint: v2.14.3 → v3.2.6](pylint-dev/pylint@v2.14.3...v3.2.6)
just realized I forgot to update pytests - should be green now |
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.
My Python skills don't suffice to review the changes in detail, but they look sensible.
I've tested the updated version and everything works as expected, and the warnings are gone.
Thanks a lot!
@foster999 |
Thanks for this @kartben 😄
Yes please, might as well sort this at the same time! Failing that, I'd be happy to drop the codecov step in the Actions config for now. Could you also drop the lines in the change for backwards compatibility with old sphinx (and if needed update the setup.py) please? I've tried to move towards only officially supporting the latest major version of dependencies, as older versions of sphinx-tabs can be used with older dependencies This part of the code has been rewritten to and from this approach a few times, so I'd also like to understand why it was changed from the approach you've written here last time. I'll try and look back when I get chance, but it would be great if you could review older revisions/PRs to this part of the code to try to understand this also please |
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.
LGTM, thanks!
I've pushed the change so let's see
Done
I tried to look back in time a little bit but I couldn't really find a time where it ever was done like I am proposing in this patch. It's true that adding to all pages has apparently been done in different ways in the past, but I couldn't find occurrences of the "only add when used" approach. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #198 +/- ##
==========================================
+ Coverage 97.26% 98.52% +1.26%
==========================================
Files 2 2
Lines 219 203 -16
==========================================
- Hits 213 200 -13
+ Misses 6 3 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Thanks for adding those bits and taking a look back. I think you're right - the old method just added them regardless of use, so the method being replaced here was likely a solution to that As others have confirmed the issue is resolved, I'll get it merged and released once everything is passing Edit: just looks like a formatting issue from pre-commit, then we're good to go |
codecov-action v1 is really old, bump to v4. Signed-off-by: Benjamin Cabé <[email protected]>
Fixes executablebooks#197 by reversing the logic of how JS/CSS assets are added to pages. Rather than adding assets to the app and using undocumented API to *remove* them when not needed, do the exact opposite and only add them to the local html-page-context when building a page. Signed-off-by: Benjamin Cabé <[email protected]>
Drop the code that was used to support Sphinx version < 1.8, released 6 years ago. Signed-off-by: Benjamin Cabé <[email protected]>
`bad-continuation` has been removed from pylint See pylint-dev/pylint#3571 Signed-off-by: Benjamin Cabé <[email protected]>
@foster999 I think we should be back on track.
|
@foster999 if/when you get a chance to take another look that'd be great as the warning is polluting our build logs making it harder to spot any real issue. Thanks! |
Sorry for the huge delay getting round to this! Now included in version 3.4.6 |
Awesome, thanks! Do you have a sense of when this will be available through pypi? Thanks! |
Deployment failed for that one, but it's now up on PyPI as 3.4.7 |
@foster999, no worries at all, thanks for your work as maintainer and also thanks again @kartben for the PR! |
We are disconnecting the html-page-context event from sphinx-tabs, which was used to delete the static files from html files that didn't use sphinx-tabs. But in executablebooks/sphinx-tabs#198 this was changed to instead decide if the page should have the static files or not. Since we are removing that event, sphinx-tabs never gets to inject the static files, this breaks sphinx-tabs for projects using hoverxref. We no longer need to disconnect that signal, since we are overriding the html assets policy to `always`, which sphnx-tabs respects already executablebooks/sphinx-tabs#132 (more than 3 years ago).
We are disconnecting the html-page-context event from sphinx-tabs, which was used to delete the static files from html files that didn't use sphinx-tabs. But in executablebooks/sphinx-tabs#198 this was changed to instead decide if the page should have the static files or not. Since we are removing that event, sphinx-tabs never gets to inject the static files, this breaks sphinx-tabs for projects using hoverxref. We no longer need to disconnect that signal, since we are overriding the html assets policy to `always`, which sphnx-tabs respects already executablebooks/sphinx-tabs#132 (more than 3 years ago).
Fixes #197 by reversing the logic of how JS/CSS assets are added to pages.
Rather than adding assets to the app and using undocumented API to remove them when not needed, do the exact opposite and only add them to the local html-page-context when building a page that uses the directive.