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

This comment has been minimized.

@takluyver

takluyver Jun 21, 2017
Member

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

This comment has been minimized.

@jfbu

jfbu Jun 21, 2017
Author Contributor

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 ;-) )

This comment has been minimized.

@jfbu

jfbu Jun 21, 2017
Author Contributor

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.

This comment has been minimized.

@jfbu

jfbu Jun 21, 2017
Author Contributor

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 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

@takluyver takluyver commented Jun 21, 2017

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
4 checks passed
4 checks passed
codecov/patch Coverage not affected when comparing 0ce5784...1a6d023
Details
codecov/project 66.96% (+0.03%) compared to 0ce5784
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@takluyver
Copy link
Member

@takluyver takluyver commented Jun 21, 2017

@meeseeksdev backport

meeseeksdev 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
Backport PR #10668 on branch 5.x
@jfbu jfbu deleted the jfbu:fix_sphinxutilcompat_import branch Jun 21, 2017
@Carreau Carreau added the backported label Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.