GangCaoLab / CoolBox

Jupyter notebook based genomic data visualization toolkit.
https://gangcaolab.github.io/CoolBox/index.html
GNU General Public License v3.0
224 stars 37 forks source link

error in doctool: `param` does not have a `name` attribute #60

Closed rekado closed 2 years ago

rekado commented 2 years ago

I tried to import coolbox.core.track.base.Track but was greeted with an error in the documentation merging code:

Python 3.8.2 (default, Jan  1 1970, 00:00:01) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
matplotlib.use('Agg')
>>> from coolbox.core.track.base import Track
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/gnu/store/r24m8kciwvj5ppps4sygx4l2k86d798d-profile/lib/python3.8/site-packages/coolbox/core/track/__init__.py", line 1, in <module>
    from .bam import Track
  File "/gnu/store/r24m8kciwvj5ppps4sygx4l2k86d798d-profile/lib/python3.8/site-packages/coolbox/core/track/bam.py", line 9, in <module>
    from .base import Track
  File "/gnu/store/r24m8kciwvj5ppps4sygx4l2k86d798d-profile/lib/python3.8/site-packages/coolbox/core/track/base.py", line 15, in <module>
    class Track(object, metaclass=NumpyDocInheritor):
  File "/gnu/store/r24m8kciwvj5ppps4sygx4l2k86d798d-profile/lib/python3.8/site-packages/coolbox/utilities/doctool.py", line 43, in __new__
    __doc__ = mcs.class_doc_inherit(p_cls_doc, __doc__)
  File "/gnu/store/r24m8kciwvj5ppps4sygx4l2k86d798d-profile/lib/python3.8/site-packages/coolbox/utilities/doctool.py", line 127, in class_doc_inherit
    return mcs.build(p_doc, c_doc)
  File "/gnu/store/r24m8kciwvj5ppps4sygx4l2k86d798d-profile/lib/python3.8/site-packages/coolbox/utilities/doctool.py", line 117, in build
    c_param_names = {param.name for param in c_params}
  File "/gnu/store/r24m8kciwvj5ppps4sygx4l2k86d798d-profile/lib/python3.8/site-packages/coolbox/utilities/doctool.py", line 117, in <setcomp>
    c_param_names = {param.name for param in c_params}
AttributeError: 'tuple' object has no attribute 'name'

This is using the latest release of CoolBox.

rekado commented 2 years ago

The contents of c_params are:

[('properties_dict', 'dict', ["The properties(features) of this track. For example 'height', 'color'..."]), ('name', 'str, optional', ['The name of Track.', '(Default: "{self.__class__.__name__}.{self.__class__._counts}")']), ('title', 'str, optional', ['Title of ax']), ('height', 'int, optional', ['Height of ax']), ('color', 'str, optional;', ['Color of ax'])]
[('file', 'str', ['Path to .bam .sam file.']), ('length_ratio_thresh', 'float', ['Length ratio threshold of show alignments. (Default 0.01)'])]

As can be seen, the second entry does not have a name field.

rekado commented 2 years ago

The second entry appears to come from BAM(Track) in coolbox/core/track/bam.py; so it looks like the doc fields of Track are not inherited in BAM.

rekado commented 2 years ago

Turns out that this problem was due to an older version of numpydoc. Sorry for the noise!