repo-helper / dist-meta

Parse and create Python distribution metadata.
https://dist-meta.readthedocs.io/en/latest
MIT License
4 stars 2 forks source link

0.5.0: not ready for sphinx 5.x? #20

Open kloczek opened 2 years ago

kloczek commented 2 years ago

Looks like documentation build fails with sphinx 5.x

+ /usr/bin/sphinx-build -n -T -b man doc-source build/sphinx/man
Running Sphinx v5.0.2

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/registry.py", line 430, in load_extension
    mod = import_module(extname)
  File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3.8/site-packages/sphinx_toolbox/more_autodoc/autoprotocol.py", line 153, in <module>
    from sphinx_toolbox.more_autodoc.generic_bases import _add_generic_bases
  File "/usr/lib/python3.8/site-packages/sphinx_toolbox/more_autodoc/generic_bases.py", line 86, in <module>
    from sphinx_toolbox.more_autosummary import PatchedAutoSummClassDocumenter
  File "/usr/lib/python3.8/site-packages/sphinx_toolbox/more_autosummary/__init__.py", line 170, in <module>
    from sphinx.ext.autodoc.importer import get_module_members
ImportError: cannot import name 'get_module_members' from 'sphinx.ext.autodoc.importer' (/usr/lib/python3.8/site-packages/sphinx/ext/autodoc/importer.py)

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 272, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 223, in __init__
    self.setup_extension(extension)
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 380, in setup_extension
    self.registry.load_extension(self, extname)
  File "/usr/lib/python3.8/site-packages/sphinx/registry.py", line 443, in load_extension
    metadata = setup(app)
  File "/usr/lib/python3.8/site-packages/sphinx_toolbox/__init__.py", line 95, in setup
    app.setup_extension("sphinx_toolbox.more_autodoc.autoprotocol")
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 380, in setup_extension
    self.registry.load_extension(self, extname)
  File "/usr/lib/python3.8/site-packages/sphinx/registry.py", line 433, in load_extension
    raise ExtensionError(__('Could not import extension %s') % extname,
sphinx.errors.ExtensionError: Could not import extension sphinx_toolbox.more_autodoc.autoprotocol (exception: cannot import name 'get_module_members' from 'sphinx.ext.autodoc.importer' (/usr/lib/python3.8/site-packages/sphinx/ext/autodoc/importer.py))

Extension error:
Could not import extension sphinx_toolbox.more_autodoc.autoprotocol (exception: cannot import name 'get_module_members' from 'sphinx.ext.autodoc.importer' (/usr/lib/python3.8/site-packages/sphinx/ext/autodoc/importer.py))
kloczek commented 2 years ago

I forgot that to be able use straight sphinx-build it is necessary to apply patch like below

--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -19,6 +19,7 @@
 import os
 from datetime import datetime
 import sys
+sys.path.insert(0, os.path.abspath("../.."))
 scripts = os.path.abspath('../../scripts')
 sys.path.insert(0, scripts)
 try: