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

Remove deprecations for sphinx 1.8 #57

Merged
merged 4 commits into from
Jan 15, 2019

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Jan 3, 2019

Getting ready for sphinx 2.0

Closes #35

Getting ready for sphinx 2.0
@stsewd
Copy link
Member Author

stsewd commented Jan 3, 2019

We still have access to builder.css_files and builder.script_files.

https://github.com/sphinx-doc/sphinx/blob/2b1512749a2532f5e8bc7909ca70ce6395f169fd/sphinx/builders/html.py#L258-L262

@stsewd
Copy link
Member Author

stsewd commented Jan 3, 2019

Also, I was thinking in removing this whole block

https://github.com/rtfd/readthedocs-sphinx-ext/blob/e0e3f9c85599f2afcfe8917a4f3d4436fda9e22a/readthedocs_ext/readthedocs.py#L67-L93

It's only used to support sphinx_rtd_theme < 4.0, but 4.0 was released in 2013 https://pypi.org/project/readthedocs-sphinx-ext/#history, and from the rtd side we always install kind of the latest version of the theme, so, if people have the theme pinned to <4.0, the docs will look weird, but they can fixed it with just pinind the extension too or updating the theme.

@stsewd
Copy link
Member Author

stsewd commented Jan 3, 2019

Ok, the deprecation from tests are bc of python 2, sad

@stsewd
Copy link
Member Author

stsewd commented Jan 3, 2019

And we need to consider this #35 (comment), but as I mentioned above, this is only needed for sphinx_rtd_theme < 4.0 (2013)

Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

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

Changes look good but I worth to check that we are doing what we think we are doing here :)

if sphinx.version_info < (1, 8):
app.add_stylesheet(theme_css)
else:
app.add_css_file(theme_css)
Copy link
Member

Choose a reason for hiding this comment

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

This may have a different effect since we were adding our .css file as the first element of the list.

So, all the css files added after our could override our own css classes. I'm not sure at what point add_stylesheet and/or add_css_file will add them.

In any case, we should check if inserting it at 0 position is something we really need.

Copy link
Member

Choose a reason for hiding this comment

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

I saying this because I think the order of the list is the order in which the css files are loaded in the HTML, but I'm not sure either.

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't need that for recent projects, users can always pin the extension

#57 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

So, this is a breaking change, right?

If so, we won't be able to upgrade our default version installed by RTD.

Copy link
Member Author

@stsewd stsewd Jan 4, 2019

Choose a reason for hiding this comment

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

It's breaking only for really old projects (sphinx_rtd_theme < 4.0, 2013), and supposing that they haven't updated the theme (they have the theme pinned to a version less than 4.0). And if they have a custom css rule that could interfere with the theme. I'm not really so worry about this change.

Copy link
Member

Choose a reason for hiding this comment

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

We don't need that for recent projects, users can always pin the extension

Big -1 here. Users should never need to know about our extension, asking them to pin it is definitely terrible UX :)

readthedocs_ext/readthedocs.py Show resolved Hide resolved
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

Makes sense, but I don't like changing things when we don't have to :)

)
js_file = '{}javascript/readthedocs-doc-embed.js'.format(STATIC_URL)
if sphinx.version_info < (1, 8):
app.add_javascript(js_file)
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to probably keep the logic the same as the existing logic, since there could be subtle changes in how this works across Sphinx versions.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've changed it, but we have the deprecation from 1.7 actually, https://www.sphinx-doc.org/en/1.7/extdev/appapi.html#sphinx.application.Sphinx.add_javascript was added in 0.5

@@ -90,7 +91,10 @@ def update_body(app, pagename, templatename, context, doctree):
pass

if inject_css and theme_css not in app.builder.css_files:
app.builder.css_files.insert(0, theme_css)
if sphinx.version_info < (1, 8):
app.add_stylesheet(theme_css)
Copy link
Member

Choose a reason for hiding this comment

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

Same here, I don't see a reason to change this logic.

@ericholscher ericholscher merged commit 8e54554 into readthedocs:master Jan 15, 2019
@stsewd stsewd deleted the remove-deprecations branch January 15, 2019 17:09
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.

3 participants