Discussion:
[Docutils-users] python setup.py check --restructuredtext --strict --metadata fails for valid document with syntax highlighting
Marc Abramowitz
2014-12-15 20:46:31 UTC
Permalink
python setup.py check --restructuredtext --strict --metadata fails with:

warning: check: Could not finish the parsing.

if the RST document uses code or code-block directives.

This is annoying because the document is valid, but it appears to be invalid
and confuses people.
I filed a ticket for this (with a patch included):

https://sourceforge.net/p/docutils/bugs/270/

Marc
David Goodger
2014-12-16 15:13:49 UTC
Permalink
Post by Marc Abramowitz
warning: check: Could not finish the parsing.
if the RST document uses code or code-block directives.
This is annoying because the document is valid, but it appears to be invalid
and confuses people.
https://sourceforge.net/p/docutils/bugs/270/
"code-block" is not a standard Docutils reST directive, so I don't see
how the document could be valid. "code-block" should always break.
Maybe it's a Sphinx extension, and your environment has that
installed. Did you try with just the "code" directive?

-1 on the patch. It makes assumptions that may not always be true. If
the bug is in Python's distutils, that's where the fix should be. But
first, make sure your document is truly valid.
--
David Goodger <http://python.net/~goodger>

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
David Goodger
2014-12-16 16:34:51 UTC
Permalink
[CC'ing to Docutils-users. Please "reply-all", not just to me.]
First off, thanks David, for taking the time to respond!
Post by David Goodger
"code-block" is not a standard Docutils reST directive
Apologies. I'm not too familiar with docutils proper so I may have confused
docutils with Sphinx. But does the following not mean that "code-block" is
an alias for "code"?
*
https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/docutils/parsers/rst/languages/en.py
You're right, my apologies. I forgot to look there for aliases, and
forgot that "code-block" is standard. Please ignore that part.
Post by David Goodger
It makes assumptions that may not always be true
Yeah, this is my first time touching docutils so I am not surprised. I'm
willing to work on it though. Do you think that if you were specific about
what those assumptions are that the patch could be made to be acceptable?
It would have to be *really* specific. E.g., Docutils would have to
check that it was called by distutils only.

The problem in your patch is, you're introducing a dependency on the
stock RST parser, and client code might be using an alternate parser
(modified, or different) or none. I don't want to screw 3rd-party code
that uses Docutils, just to fix Python's bug. This smells kludgey.

I don't understand why the issue is happening. Maybe it is a Docutils
bug, I don't know.
Or
is there nothing that can be done on the docutils side, because...
Post by David Goodger
If the bug is in Python's distutils, that's where the fix should be
Yes, I agree in principle and I mentioned in the sourceforge ticket that
this might be more of a distutils problem. The thing is that even if we
correct the problem in distutils (which I think is present at least as far
back as Python 2.7 and as recent as Python 3.4), it won't be available to
users until Python 3.5 is released and it will only be available to Python 3
users; Python 2 folks will be out of luck. So while I agree that fixing the
problem in distutils might be the more correct approach, I'm also thinking
about "practicality beats purity".
That said, I did submit a patch to CPython at
http://bugs.python.org/issue23063 and I'll try to push that through, but
like I said, it will only be for Python 3.5 I think. Whereas if we can do
something in docutils, then folks can easily upgrade docutils and be able to
validate more of their RST documents.
Maybe somebody else can investigate. I don't have much time for
Docutils these days.

David Goodger
Post by David Goodger
Post by Marc Abramowitz
warning: check: Could not finish the parsing.
if the RST document uses code or code-block directives.
This is annoying because the document is valid, but it appears to be invalid
and confuses people.
https://sourceforge.net/p/docutils/bugs/270/
"code-block" is not a standard Docutils reST directive, so I don't see
how the document could be valid. "code-block" should always break.
Maybe it's a Sphinx extension, and your environment has that
installed. Did you try with just the "code" directive?
-1 on the patch. It makes assumptions that may not always be true. If
the bug is in Python's distutils, that's where the fix should be. But
first, make sure your document is truly valid.
--
David Goodger <http://python.net/~goodger>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
Marcelo Huerta
2014-12-16 17:23:11 UTC
Permalink
Post by David Goodger
I don't have much time for
Docutils these days.
Not to be an alarmist or anything, but should we be worried about Docutils'
future, given this?
--
o-=< Marcelo >=-o


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
Marc Abramowitz
2014-12-16 22:28:36 UTC
Permalink
Post by David Goodger
You're right, my apologies. I forgot to look there for aliases, and
forgot that "code-block" is standard. Please ignore that part.
No problem. Thanks for confirming.
Post by David Goodger
It would have to be *really* specific. E.g., Docutils would have to
check that it was called by distutils only.
OK, I updated the patch at https://sourceforge.net/p/docutils/bugs/270/ to
do this.
Post by David Goodger
Maybe somebody else can investigate. I don't have much time for
Docutils these days.
Sure. Is there someone you might suggest? I thought perhaps GÃŒnter Milde
(cc'd), since he seems to have touched that file a lot.

Marc
Post by David Goodger
[CC'ing to Docutils-users. Please "reply-all", not just to me.]
First off, thanks David, for taking the time to respond!
Post by David Goodger
"code-block" is not a standard Docutils reST directive
Apologies. I'm not too familiar with docutils proper so I may have
confused
docutils with Sphinx. But does the following not mean that "code-block"
is
an alias for "code"?
*
https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/docutils/parsers/rst/languages/en.py
You're right, my apologies. I forgot to look there for aliases, and
forgot that "code-block" is standard. Please ignore that part.
Post by David Goodger
It makes assumptions that may not always be true
Yeah, this is my first time touching docutils so I am not surprised. I'm
willing to work on it though. Do you think that if you were specific
about
what those assumptions are that the patch could be made to be acceptable?
It would have to be *really* specific. E.g., Docutils would have to
check that it was called by distutils only.
The problem in your patch is, you're introducing a dependency on the
stock RST parser, and client code might be using an alternate parser
(modified, or different) or none. I don't want to screw 3rd-party code
that uses Docutils, just to fix Python's bug. This smells kludgey.
I don't understand why the issue is happening. Maybe it is a Docutils
bug, I don't know.
Or
is there nothing that can be done on the docutils side, because...
Post by David Goodger
If the bug is in Python's distutils, that's where the fix should be
Yes, I agree in principle and I mentioned in the sourceforge ticket that
this might be more of a distutils problem. The thing is that even if we
correct the problem in distutils (which I think is present at least as
far
back as Python 2.7 and as recent as Python 3.4), it won't be available to
users until Python 3.5 is released and it will only be available to
Python 3
users; Python 2 folks will be out of luck. So while I agree that fixing
the
problem in distutils might be the more correct approach, I'm also
thinking
about "practicality beats purity".
That said, I did submit a patch to CPython at
http://bugs.python.org/issue23063 and I'll try to push that through, but
like I said, it will only be for Python 3.5 I think. Whereas if we can do
something in docutils, then folks can easily upgrade docutils and be
able to
validate more of their RST documents.
Maybe somebody else can investigate. I don't have much time for
Docutils these days.
David Goodger
Post by David Goodger
Post by Marc Abramowitz
python setup.py check --restructuredtext --strict --metadata fails
warning: check: Could not finish the parsing.
if the RST document uses code or code-block directives.
This is annoying because the document is valid, but it appears to be invalid
and confuses people.
https://sourceforge.net/p/docutils/bugs/270/
"code-block" is not a standard Docutils reST directive, so I don't see
how the document could be valid. "code-block" should always break.
Maybe it's a Sphinx extension, and your environment has that
installed. Did you try with just the "code" directive?
-1 on the patch. It makes assumptions that may not always be true. If
the bug is in Python's distutils, that's where the fix should be. But
first, make sure your document is truly valid.
--
David Goodger <http://python.net/~goodger>
Loading...