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 #10666: Prepare for removal of sphinx.util.compat module at Sphinx 1.7 #10668

Merged
merged 2 commits into from
Jun 21, 2017

Conversation

jfbu
Copy link
Contributor

@jfbu jfbu commented Jun 21, 2017

Since Sphinx 1.6, the sphinx.util.compat.Directive class is deprecated. And the entire sphinx.util.compat module will be removed at 1.7. This PR follows Sphinx CHANGES tip about using docutils.parsers.rst.Directive instead.

Relates #10666

if sphinx.version_info < (1, 5, 7):
from sphinx.util.compat import Directive
else:
from docutils.parsers.rst import Directive
Copy link
Member

Choose a reason for hiding this comment

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

Do we know in what version of docutils this was introduced?

Copy link
Contributor Author

@jfbu jfbu Jun 21, 2017

Choose a reason for hiding this comment

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

I checked it was there in Docutils 0.10.1 before pushing the PR, I will check now exact version (probably from dawn of time ;-) )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I find it in docutils-0.5 and in docutils-0.6 it is declared as inheriting from object (earlier it was just class Directive).

Anyway, Sphinx 1.3 has docutils>=0.11 in its setup.py requirements. And I think IPython currently requires Sphinx>=1.3.

However I admit I am not familiar with why there was a wrapper to Directive in sphinx.util.compat before 1.6, I will check a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In fact at Sphinx 1.3, the sphinx.util.compat module simply contained:

from docutils.parsers.rst import Directive  # noqa

and there was no monkey-patched done. Thus I feel doing this directly from IPython is safe, and arguably testing for Sphinx version is superfluous.

@jfbu
Copy link
Contributor Author

jfbu commented Jun 21, 2017

@takluyver Thanks, your comment prompted me into looking at what happened exactly in sphinx.util.compat regarding Directive. In fact it has always been since Sphinx 1.3 (required by IPython currently) done like this:

from docutils.parsers.rst import Directive

and there was no other Directive related code there. Hence I made my life more miserable when I checked Sphinx version.

@takluyver
Copy link
Member

Thanks for taking the time to dig into both projects. I'm happy that we can simply switch the import to use docutils without a version check.

@takluyver takluyver merged commit 815a455 into ipython:master Jun 21, 2017
@takluyver
Copy link
Member

@meeseeksdev backport

lumberbot-app bot pushed a commit that referenced this pull request Jun 21, 2017
…mpat module at Sphinx 1.7

Since Sphinx 1.6, the ``sphinx.util.compat.Directive`` class is deprecated. And the entire ``sphinx.util.compat`` module will be removed at 1.7. This PR follows [Sphinx CHANGES](http://www.sphinx-doc.org/en/master/changes.html) tip about using ``docutils.parsers.rst.Directive`` instead.

Relates  10666
takluyver added a commit that referenced this pull request Jun 21, 2017
@jfbu jfbu deleted the fix_sphinxutilcompat_import branch June 21, 2017 13:45
@Carreau Carreau added the backported PR that have been backported by MrMeeseeks label Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported PR that have been backported by MrMeeseeks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants