executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
751 stars 197 forks source link

2.0.0: documentation build fails with `'Module' object has no attribute 'doc'` #826

Closed kloczek closed 11 months ago

kloczek commented 11 months ago

What version of myst-parser are you using?

2.0.0

What version dependencies are you using?

Here is list of installed modules in build env

```console Package Version ----------------------------- ------- alabaster 0.7.13 astroid 3.0.1 Babel 2.13.1 beautifulsoup4 4.12.2 build 1.0.3 charset-normalizer 3.3.2 contourpy 1.0.7 cppclean 0.13 cycler 0.12.1 distro 1.8.0 docutils 0.20.1 exceptiongroup 1.1.3 fonttools 4.44.0 gpg 1.23.0 idna 3.4 imagesize 1.4.1 importlib-metadata 6.8.0 iniconfig 2.0.0 installer 0.7.0 Jinja2 3.1.2 kiwisolver 1.4.5 latexcodec 2.0.1 linkify-it-py 2.0.2 markdown-it-py 3.0.0 MarkupSafe 2.1.3 matplotlib 3.6.3 mdit-py-plugins 0.4.0 mdurl 0.1.2 numpy 1.24.4 olefile 0.46 packaging 23.2 Pillow 10.1.0 pluggy 1.3.0 pybtex 0.24.0 pybtex-docutils 1.0.3 Pygments 2.16.1 pyparsing 3.1.1 pyproject_hooks 1.0.0 pytest 7.4.3 pytest-datadir 1.5.0 pytest_param_files 0.6.0 pytest-regressions 2.5.0 python-dateutil 2.8.2 pytz 2023.3 PyYAML 6.0.1 requests 2.31.0 ruamel.yaml 0.18.2 ruamel.yaml.clib 0.2.7 setuptools 68.2.2 six 1.16.0 snowballstemmer 2.2.0 soupsieve 2.5 Sphinx 7.1.2 sphinx-autodoc2 0.4.2 sphinx-copybutton 0.5.2 sphinx_pyscript 0.1.0 sphinx_pytest 0.2.0 sphinx-togglebutton 0.3.2 sphinxcontrib-applehelp 1.0.4 sphinxcontrib-bibtex 2.6.1 sphinxcontrib-devhelp 1.0.5 sphinxcontrib-htmlhelp 2.0.4 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.9 sphinxext-opengraph 0.8.2 sphinxext-rediraffe 0.2.7 tomli 2.0.1 typing_extensions 4.8.0 uc-micro-py 1.0.2 urllib3 1.26.18 wheel 0.41.3 zipp 3.17.0 ```

What operating system are you using?

Linux

Describe the Bug

Looks like documentation build fails with exception like below

```console + /usr/bin/sphinx-build -n -T -b man docs build/sphinx/man Running Sphinx v7.1.2 making output directory... done myst v2.0.0: MdParserConfig(commonmark_only=False, gfm_only=False, enable_extensions={'smartquotes', 'html_image', 'substitution', 'dollarmath', 'replacements', 'strikethrough', 'attrs_inline', 'attrs_block', 'fieldlist', 'linkify', 'colon_fence', 'amsmath', 'html_admonition', 'tasklist', 'deflist'}, disable_syntax=[], all_links_external=False, url_schemes=('http', 'https', 'mailto', 'ftp', 'wiki', 'doi', 'gh-pr', 'gh-issue', 'gh-user'), ref_domains=None, fence_as_directive=set(), number_code_blocks=['typescript'], title_to_header=False, heading_anchors=2, heading_slug_func=None, html_meta={}, footnote_transition=True, words_per_minute=200, substitutions={role: ..., directive: ...}, linkify_fuzzy_links=True, dmath_allow_labels=True, dmath_allow_space=True, dmath_allow_digits=True, dmath_double_inline=True, update_mathjax=True, mathjax_classes='tex2jax_process|mathjax_process|math|output_area', enable_checkboxes=True, suppress_warnings=[], highlight_code_blocks=True) [Autodoc2] Analysing package...[ 4%] myst_parser.__init__ Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/sphinx/events.py", line 96, in emit results.append(listener.handler(self.app, *args)) File "/usr/lib/python3.8/site-packages/autodoc2/sphinx/extension.py", line 76, in run_autodoc mod_path = run_autodoc_package(app, config, i) File "/usr/lib/python3.8/site-packages/autodoc2/sphinx/extension.py", line 164, in run_autodoc_package for data in analyse_module(mod_path, mod_name): File "/usr/lib/python3.8/site-packages/autodoc2/analysis.py", line 41, in analyse_module yield from walk_node( File "/usr/lib/python3.8/site-packages/autodoc2/analysis.py", line 105, in walk_node yield from func(node, state) File "/usr/lib/python3.8/site-packages/autodoc2/analysis.py", line 116, in yield_module "doc": fix_docstring_indent(node.doc), AttributeError: 'Module' object has no attribute 'doc' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 285, in build_main app = Sphinx(args.sourcedir, args.confdir, args.outputdir, File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 268, in __init__ self._init_builder() File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 339, in _init_builder self.events.emit('builder-inited') File "/usr/lib/python3.8/site-packages/sphinx/events.py", line 107, in emit raise ExtensionError(__("Handler %r for event %r threw an exception") % sphinx.errors.ExtensionError: Handler for event 'builder-inited' threw an exception (exception: 'Module' object has no attribute 'doc') Extension error (autodoc2.sphinx.extension): Handler for event 'builder-inited' threw an exception (exception: 'Module' object has no attribute 'doc') ```

Expected Behavior

Documentation build should be OK.

To Reproduce

Just execute for example sphinx-build -n -T -b man docs build/sphinx/man in source tree.