-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Conversation
if sphinx.version_info < (1, 5, 7): | ||
from sphinx.util.compat import Directive | ||
else: | ||
from docutils.parsers.rst import Directive |
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.
Do we know in what version of docutils this was introduced?
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.
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 ;-) )
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.
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.
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.
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.
@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:
and there was no other Directive related code there. Hence I made my life more miserable when I checked Sphinx version. |
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. |
@meeseeksdev backport |
…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
Backport PR #10668 on branch 5.x
Since Sphinx 1.6, the
sphinx.util.compat.Directive
class is deprecated. And the entiresphinx.util.compat
module will be removed at 1.7. This PR follows Sphinx CHANGES tip about usingdocutils.parsers.rst.Directive
instead.Relates #10666