NiklasRosenstein / pydoc-markdown

Create Python API documentation in Markdown format.
http://niklasrosenstein.github.io/pydoc-markdown/
Other
462 stars 105 forks source link

AttributeError: '_Module' object has no attribute 'is_module' #187

Closed casperdcl closed 3 years ago

casperdcl commented 3 years ago

Probably a Python3.9 issue. From https://github.com/tqdm/tqdm/runs/2659177454:

$ pydoc-markdown --build --site-dir _site
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.5/x64/bin/pydoc-markdown", line 8, in <module>
    sys.exit(cli())
  ...
  File "/opt/hostedtoolcache/Python/3.9.5/x64/lib/python3.9/site-packages/pydoc_markdown/contrib/loaders/python.py", line 114, in <listcomp>
    [x.name for x in discovered_items if x.is_module()],
AttributeError: '_Module' object has no attribute 'is_module'
mdlopresti commented 3 years ago

Same error here, but I am running python 3.8

$> pydoc-markdown
Traceback (most recent call last):
  File "/usr/local/bin/pydoc-markdown", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pydoc_markdown/main.py", line 337, in cli
    session.render(pydocmd)
  File "/usr/local/lib/python3.8/site-packages/pydoc_markdown/main.py", line 134, in render
    modules = config.load_modules()
  File "/usr/local/lib/python3.8/site-packages/pydoc_markdown/__init__.py", line 134, in load_modules
    modules.extend(loader.load())
  File "/usr/local/lib/python3.8/site-packages/pydoc_markdown/contrib/loaders/python.py", line 114, in load
    [x.name for x in discovered_items if x.is_module()],
  File "/usr/local/lib/python3.8/site-packages/pydoc_markdown/contrib/loaders/python.py", line 114, in <listcomp>
    [x.name for x in discovered_items if x.is_module()],
AttributeError: '_Package' object has no attribute 'is_module'

$> python --version
Python 3.8.7
casperdcl commented 3 years ago

Actually https://github.com/tqdm/tqdm/runs/2274399493 succeeded 2 months ago on Python3.9.2 so does indeed look like a pydoc-markdown error.

bziemons commented 3 years ago

Downgrading docspec-python to 0.1.0 seems to work for me.

m-birke commented 3 years ago

Ive got the same problem. With no changes on May 21 it worked, since May 22 no longer.

@bziemons thanks! this also works for me (May 21 is exactly the date, where docspec-python 0.1.1 was released

m-birke commented 3 years ago

@NiklasRosenstein

maybe the requirement should look like 'docspec-python ==0.1.0' for now?

bziemons commented 3 years ago

that would still break all older pydoc-markdown versions. I think it would be more wise to yank docspec-python 0.1.1 from pypi and push that version as 0.2.0 instead.

NiklasRosenstein commented 3 years ago

Hey folks, thanks for reporting this. and sorry for the troubles! I yanked docspec-python 0.1.1 from PyPI and re-published it as 0.2.0. Also Pydoc-Markdown 3.13.0 now directly depends on docspec-python~0.2.0 and the respective code has been fixed.