ImportError: cannot import name 'Signature' from 'sphinx.util.inspect'
thierrymoudiki opened this issue · 4 comments
Hi,
I'm using this package for documenting all my Python packages, especially this one.
It worked very well on my last commit but now, when I run python3 docs/autogen.py
, I get the following error messages:
Traceback (most recent call last):
File "docs/autogen.py", line 4, in <module>
import keras_autodoc
File "/Users/t/Documents/Python_Packages/teller/venv/lib/python3.8/site-packages/keras_autodoc/__init__.py", line 1, in <module>
from .autogen import DocumentationGenerator
File "/Users/t/Documents/Python_Packages/teller/venv/lib/python3.8/site-packages/keras_autodoc/autogen.py", line 8, in <module>
from .get_signatures import get_signature
File "/Users/t/Documents/Python_Packages/teller/venv/lib/python3.8/site-packages/keras_autodoc/get_signatures.py", line 5, in <module>
from sphinx.util.inspect import Signature
ImportError: cannot import name 'Signature' from 'sphinx.util.inspect' (/Users/t/Documents/Python_Packages/teller/venv/lib/python3.8/site-packages/sphinx/util/inspect.py)
It seems like the problem comes from this file, and a change in Sphinx's API. Could you please help me in solving this issue?
I believe an older version of sphynx is needed. You can pip install an older one. I'll try to change the requirements of the package to see if that helps
@gabrieldemarmiesse Thanks for your answer, I appreciate that.
" You can pip install an older one": yes, that's what I'm trying to do manually, without much success so far
"I'll try to change the requirements of the package to see if that helps": If you have an automated way of checking Sphinx versions and APIs, that will be great
@gabrieldemarmiesse I found the following page in Sphinx docs: https://www.sphinx-doc.org/en/master/extdev/deprecated.html
More specifically -- from what I understand -- it says that sphinx.util.inspect.Signature
is deprecated and will be removed (starting in version 4.0). They suggest using either sphinx.util.inspect.signature
or sphinx.util.inspect.stringify_signature()
.
What do you suggest? Modify the setup.py
and specify a sphinx
version before 4.0? Or, using the alternatives and keep the setup.py
as it is now.
submitted a PR for this: #93