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

scons doc fails with: AttributeError: 'Text' object has no attribute 'data' #3121

Closed
cirosantilli opened this issue Apr 29, 2018 · 13 comments
Closed

Comments

@cirosantilli
Copy link

scons 4d2f1e1 , Ubuntu 17.10, Epydoc 3.0.1,
run scons doc, outcome:

Warning: No information available for
         SCons.Variables.ListVariable._ListVariable's base
         collections.UserList
  [....................Traceback (most recent call last):
  File "/home/ciro/.local/bin/epydoc", line 13, in <module>
    cli()
  File "/home/ciro/.local/lib/python2.7/site-packages/epydoc/cli.py",
line 965, in cli
    main(options, names)
  File "/home/ciro/.local/lib/python2.7/site-packages/epydoc/cli.py",
line 757, in main
    exclude_parse=exclude_parse)
  File "/home/ciro/.local/lib/python2.7/site-packages/epydoc/docbuilder.py",
line 275, in build_doc_index
    parse_docstring(val_doc, docindex, suppress_warnings)
  File "/home/ciro/.local/lib/python2.7/site-packages/epydoc/docstringparser.py",
line 265, in parse_docstring
    api_doc.summary, api_doc.other_docs = api_doc.descr.summary()
  File "/home/ciro/.local/lib/python2.7/site-packages/epydoc/markup/restructuredtext.py",
line 179, in summary
    try: self._document.walk(visitor)
  File "/usr/lib/python2.7/dist-packages/docutils/nodes.py", line 138, in walk
    if child.walk(visitor):
  File "/usr/lib/python2.7/dist-packages/docutils/nodes.py", line 130, in walk
    visitor.dispatch_visit(self)
  File "/usr/lib/python2.7/dist-packages/docutils/nodes.py", line
1882, in dispatch_visit
    return method(node)
  File "/home/ciro/.local/lib/python2.7/site-packages/epydoc/markup/restructuredtext.py",
line 307, in visit_paragraph
    m = self._SUMMARY_RE.match(child.data)
AttributeError: 'Text' object has no attribute 'data'
scons: *** [build/doc/HTML/scons-api/index.html] Error 1
scons: building terminated because of errors.

Same for:

./bootstrap.py doc
@mwichmann
Copy link
Collaborator

Looks like epydoc is probably at fault. See https://stackoverflow.com/questions/6704770/epydoc-attributeerror-text-object-has-no-attribute-data - particularly unfortunately that epydoc itself seems to be dead (there have been a few distro patches, but upstream doesn't seem to have had anything happen for a decade)

@bdbaddog
Copy link
Contributor

bdbaddog commented Apr 29, 2018 via email

@bdbaddog
Copy link
Contributor

bdbaddog commented Apr 29, 2018 via email

@mwichmann
Copy link
Collaborator

yeah, looks to have promise.

@mwichmann
Copy link
Collaborator

I've made some progress getting this to look reasonable. Sphinx has complaints about a very few places using reStructuredText markup it doesn't like. One set of those can be calmed by using the "napoleon" extension which accepts both the "Numpy style" and the "Google style" markup extensions - the complaints are on lines in the Numpy style. The API markup uses the :tag: format so those are never a complaint for it, but they're not as human-readable (in the code) as the other two. However, scons' Null class manages to break napoleon! ticket filed upstream sphinx-doc/sphinx#4931 - fix could be there, or we could hack the null class. Meanwhile, reasonable results being produced but with lots of investigation needed to prove the generation is complete, etc.

@mwichmann
Copy link
Collaborator

For the sake of amusement, this "fixes" the null class to meet the expectations of the sphinx plugin. It's not really in line with the intent of the pattern it implements, but they may not want to fix things for our unusual class either.

https://gist.github.com/mwichmann/9f3e6c692ee9ed435fd331706278ce17

@ptomulik
Copy link
Contributor

ptomulik commented Nov 28, 2018

https://github.com/nltk/epydoc seems to be current "official" repo for epydoc. It was updated few days ago to make it functioning under python 2.7 and 3.x. There is no new release (yet?). Not sure there will be.

Anyway, this specific issue is also fixed in the PR mentioned.

@mwichmann
Copy link
Collaborator

Nice. "resurrection", eh? I see Fedora is using something quite old: epydoc-3.0.1.20090203svn-9. That was part of what made me assume it was effectively abandoned (2009 is a long time ago!)

@ptomulik
Copy link
Contributor

Nice. "resurrection", eh? I see Fedora is using something quite old: epydoc-3.0.1.20090203svn-9. That was part of what made me assume it was effectively abandoned (2009 is a long time ago!)

Well, because it probably was abandoned. And perhaps still remains in this state. The original author seems to be quite inactive. But what can prevent others from making it alive for next few months? It's OSS. :)

@mwichmann
Copy link
Collaborator

Just so it's recorded somewhere, epydoc has been flushed from Debian and Ubuntu. The most relevant trail of info on that is in the Debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=932574. There seemed to be no appetite for keeping it alive.

@mwichmann
Copy link
Collaborator

mwichmann commented Apr 2, 2020

Swinging back to this, I ran into a hiccup with Sphinx' autodoc (from our viewpoint) that is made a lot worse by SCons allowing so much to be modifiable where it probably doesn't need to be. In this case, there are a bunch of functions/methods which would call a function to do something, but the user might want to change that function so it's passed as a kwarg with default. sphinx.ext.autodoc imports and executes what it's generating docs for, which includes expanding "constants". Thus this signature in the code:

def flatten(obj, isinstance=isinstance, StringTypes=StringTypes,
            SequenceTypes=SequenceTypes, do_flatten=do_flatten):

is rendered by autodoc like this (line breaks mine for readability here):

SCons.Util.flatten(obj, isinstance=<built-in function isinstance>,
                   StringTypes=(<class 'str'>, <class 'collections.UserString'>),
                   SequenceTypes=(<class 'list'>, <class 'tuple'>,
                                  <class 'collections.UserList'>, 
                                  <class 'collections.abc.MappingView'>), 
                   do_flatten=<function do_flatten>)

which is frankly pretty horrid...

See sphinx-doc/sphinx#759

@bdbaddog
Copy link
Contributor

bdbaddog commented Apr 9, 2020

@mwichmann - rather API docs with a TODO, than no APIDOCS.. If you have a PR push it, we'll merge and add another Issue to track resolving the above?

@bdbaddog
Copy link
Contributor

bdbaddog commented Apr 9, 2020

I'm going to close this and add a new issue to switch API docs to Sphinx and reference this Issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants