Skip to content

Doc: Fix search for sphinx >=1.8 #12216

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

Merged

Conversation

ImportanceOfBeingErnest
Copy link
Member

@ImportanceOfBeingErnest ImportanceOfBeingErnest commented Sep 22, 2018

PR Summary

Sphinx 1.8 broke the matplolib search as seen in #12183. The issue is sphinx-doc/sphinx#5460 but it will not be fixed from the sphinx side. Instead they propose a solution as seen in readthedocs/sphinx_rtd_theme#672.

This makes it necessary to change the layout.html manually to include some new javascript file that defines some variables that are needed by the javascript that does the searching.

This PR is changing the layout.html in the same manner, such that the seach is functional again.
Here is the link to the operational search.

At the moment sphinx 1.8.0 is excluded in the requirements, but since 1.8.1 is out already, it'll be used by automatically by test environments etc. It remains to be discussed whether sphinx should be pinned to 1.7.9 until the remaining issues (related to the change of :math:) are fixed.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@ImportanceOfBeingErnest ImportanceOfBeingErnest added this to the v3.0.0-doc milestone Sep 22, 2018
@ImportanceOfBeingErnest ImportanceOfBeingErnest changed the title Fix search for sphinx >=1.8 Doc: Fix search for sphinx >=1.8 Sep 22, 2018
{%- for scriptfile in script_files %}
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
{%- endfor %}
{% if sphinx_version >= "1.8.0" %}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think comparing versions as strings is a bad idea. For example, if Sphinx 1.10.0 is released, that version would be considered lower than 1.8.0 with such comparison.

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 took over the proposed fix (readthedocs/sphinx_rtd_theme#672).
I don't know if Sphinx has a hard policy on using one digit versioning, but at least it looks like 1.8.x is planned to be followed by 2.0.0.

In the matplotlib python code we use constructs like

from PIL import PILLOW_VERSION
from distutils.version import LooseVersion
if LooseVersion(PILLOW_VERSION) >= "3.4":

But I'm not familiar enough with the macro language that is used in the html document to judge on whether this could be used there as well.

Copy link
Contributor

@anntzer anntzer Oct 14, 2018

Choose a reason for hiding this comment

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

LooseVersion() will actually parse the version string to do a proper comparison, so it's not the same as here.
Doesn't mean we can't move forward on this as a practical solution.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Even though string comparison for a version is not great, I think this is good enough given that sphinx 1.8 is likely followed by 2.0. The worst that can happen anyway is that this will break again.

So, I'm 👍 with moving this forward. Btw. can we then remove sphinx!=1.8.0 again? Would be less clutter in the doc_requirements.

@tacaswell
Copy link
Member

I agree that doing better version parsing would be ideal, but am happy with this as a practical solution.

@ImportanceOfBeingErnest
Copy link
Member Author

This is the same solution that also went into readthedocs/sphinx_rtd_theme#672. It was confirmed that there is no plan to release something like "1.10", so this should be safe as it is.

Concerning "remove sphinx!=1.8.0", I guess that makes sense, but there is still the question what to do about the incorrect rendering of math symbols.

@timhoffm timhoffm merged commit e6aaa2d into matplotlib:master Oct 15, 2018
@timhoffm
Copy link
Member

I didn’t find the math issue. So your’re saying that this needs a fix as well - or pinning to sphinx<1.8.0 for the time being?

Anyway, I’m merging this because it’s a separate topic.

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Oct 15, 2018
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Oct 15, 2018
dstansby added a commit that referenced this pull request Oct 15, 2018
…216-on-v3.0.x

Backport PR #12216 on branch v3.0.x (Doc: Fix search for sphinx >=1.8)
dstansby added a commit that referenced this pull request Oct 15, 2018
…216-on-v3.0.0-doc

Backport PR #12216 on branch v3.0.0-doc (Doc: Fix search for sphinx >=1.8)
@ImportanceOfBeingErnest
Copy link
Member Author

@timhoffm "The math issue" is the second item in #12183. It will need a fix, but there were several proposals around, so I don't know what the status is.

@ImportanceOfBeingErnest ImportanceOfBeingErnest deleted the fix-search-for-sphinx18 branch October 15, 2018 12:02
@timhoffm
Copy link
Member

Math issue is now tracked in #12532.

thoo added a commit to thoo/matplotlib that referenced this pull request Oct 18, 2018
* master: (51 commits)
  Disable sticky edge accumulation if no autoscaling.
  Avoid quadratic behavior when accumulating stickies.
  Rectified plot error (matplotlib#12501)
  endless looping GIFs with PillowWriter (matplotlib#11789)
  TST: add test for re-normalizing image
  FIX: colorbar re-check norm before draw for autolabels
  Fix search for sphinx >=1.8 (matplotlib#12216)
  Fix some flake8 issues
  Don't handle impossible values for `align` in hist()
  DOC: add section about test / doc dependencies
  DOC: clarify time windows for support
  TST: test colorbar tick labels correct
  FIX: make minor ticks formatted with science formatter as well
  DOC: clarify what 'minor version' means
  Adjust the widths of the messages during the build.
  Simplify radar_chart example.
  Fix duplicate condition in pathpatch3d example (matplotlib#12495)
  Fix typo in documentation
  FIX: make unused spines invisible
  Kill FontManager.update_fonts.
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants