pyquickhelper
pyquickhelper copied to clipboard
autosignature warnings + complicated setup
Hello,
I would like to remove warnings mostly. I describe my setup below:
I am trying this in a .rst file for the gmic-py purely compiled C/C++ Python binding which has C docstrings:
.. autosignature:: gmic.GmicImage.from_PIL :nosummary: :debug:
For it to work I had to do three things:
- add
pyquickhelperandsphinxcontrib.imagesvgto my docs/'s requirements.txt - add
import gmicand addpyquickhelper.sphinxext.sphinx_autosignatureto the extensions array variable, within mydocs/conf.py
after this, when building HTML with sphinx, I get the following log with warnings regarding a package import attempt:
(numpy291) { } AAA@N302L-G18F04:~/Productions/GMIC/gmic-py$
$ bash build_tools.bash 6b_make_doc_without_c_recompilation
🐯 Targeting G'MIC 2.9.1 (gmic.eu) as package 2.9.1-alpha2🐯
Found existing installation: gmic 2.9.1a1
Uninstalling gmic-2.9.1a1:
Successfully uninstalled gmic-2.9.1a1
Processing ./dist/gmic-2.9.1a1-cp37-cp37m-linux_x86_64.whl
Requirement already satisfied: wurlitzer in /export/home/AAA/.virtualenvs/numpy291/lib/python3.7/site-packages (from gmic==2.9.1a1) (2.0.1)
Installing collected packages: gmic
Successfully installed gmic-2.9.1a1
WARNING: You are using pip version 20.2.2; however, version 20.2.4 is available.
You should consider upgrading via the '/export/home/AAA/.virtualenvs/numpy291/bin/python3.7 -m pip install --upgrade pip' command.
Sphinx v3.2.1 en cours d'exécution
chargement de l'environnement pickled... fait
construction en cours [mo]:cibles pour les fichiers po 0 qui sont périmées
construction [html]:cibles pour les fichiers sources 7 qui sont périmées
mise-à-jour de l'environnement :0 ajouté, 7 modifié, 0 supprimé
OUTPUT FILENAME gmic_sphinxpuvos1js/5e1f69be-147c-11eb-9e0e-8cec4b8c0881.png
WILL RUN /export/home/AAA/.virtualenvs/numpy291/lib/python3.7/site-packages/gmic_sphinx/samples/sample_earth.png blur 4 output gmic_sphinxpuvos1js/5e1f69be-147c-11eb-9e0e-8cec4b8c0881.png
OUTPUT FILENAME gmic_sphinxpuvos1js/5e1f69bf-147c-11eb-9e0e-8cec4b8c0881.png
WILL RUN /export/home/AAA/.virtualenvs/numpy291/lib/python3.7/site-packages/gmic_sphinx/samples/sample_earth.png blur 4 output gmic_sphinxpuvos1js/5e1f69bf-147c-11eb-9e0e-8cec4b8c0881.png
OUTPUT FILENAME gmic_sphinxpuvos1js/5e1f69c0-147c-11eb-9e0e-8cec4b8c0881.png
WILL RUN /export/home/AAA/.virtualenvs/numpy291/lib/python3.7/site-packages/gmic_sphinx/samples/sample_earth.png blur 4 fx_bokeh 3,8,0,30,8,4,0.3,0.2,210,210,80,160,0.7,30,20,20,1,2,170,130,20,110,0.15,0 output gmic_sphinxpuvos1js/5e1f69c0-147c-11eb-9e0e-8cec4b8c0881.png
lecture des sources... [100%] numpy
WARNING: [autosignature] unable to import 'gmic.GmicImage.from_PIL' due to 'Unable to import 'gmic.GmicImage.from_PIL'. Exceptions met: function-<class 'RuntimeError'>-Unable to compile and execute 'from gmic.GmicImage import from_PIL\nmyfunc = from_PIL' due to No module named 'gmic.GmicImage'; 'gmic' is not a package given: gmic.GmicImage.from_PIL ### method-<class 'TypeError'>-'gmic.GmicImage.from_PIL' is not a method - <built-in method from_PIL of type object at 0x7ff9c43e6ee0> ### staticmethod-<class 'TypeError'>-'gmic.GmicImage.from_PIL' is not a static method - <built-in method from_PIL of type object at 0x7ff9c43e6ee0> ### property-<class 'TypeError'>-'gmic.GmicImage.from_PIL' is not a property(*) - <built-in method from_PIL of type object at 0x7ff9c43e6ee0> ### class-<class 'RuntimeError'>-Unable to compile and execute 'from gmic.GmicImage import from_PIL\nmyfunc = from_PIL' due to No module named 'gmic.GmicImage'; 'gmic' is not a package given: gmic.GmicImage.from_PIL'
WARNING: File "/export/home/AAA/Productions/GMIC/gmic-py/docs/PIL.rst", line 8
WARNING: [autosignature] object 'gmic.GmicImage.from_PIL' cannot be imported.
recherche des fichiers périmés... aucun résultat
environnement de sérialisation... fait
vérification de la cohérence... fait
document en préparation... fait
écriture... [100%] numpy
generating indices... genindex py-modindexfait
writing additional pages... searchfait
copie des images... [100%] gmic_sphinxpuvos1js/5e1f69c0-147c-11eb-9e0e-8cec4b8c0881.png
copie des fichiers statiques... ... fait
copying extra files... fait
dumping search index in English (code: en)... fait
dumping object inventory... fait
build a réussi, 3 warnings.
Les pages HTML sont dans _build/html .
the result is:

How do I:
- simplify the setup (namely import gmic in conf.py is strange.. but all is OK for me)
- remove the warnings ?
Thanks for your help!
Here is a readthedocs.io failing build:
Running Sphinx v1.8.5
loading translations [en]... done
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/gmic-py/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 472, in load_extension
mod = __import__(extname, None, None, ['setup'])
File "/home/docs/checkouts/readthedocs.org/user_builds/gmic-py/envs/latest/lib/python3.7/site-packages/pyquickhelper/sphinxext/__init__.py", line 34, in <module>
from .sphinx_tocdelay_extension import TocDelayDirective, tocdelay_node
File "/home/docs/checkouts/readthedocs.org/user_builds/gmic-py/envs/latest/lib/python3.7/site-packages/pyquickhelper/sphinxext/sphinx_tocdelay_extension.py", line 12, in <module>
from sphinx.errors import NoUri
ImportError: cannot import name 'NoUri' from 'sphinx.errors' (/home/docs/checkouts/readthedocs.org/user_builds/gmic-py/envs/latest/lib/python3.7/site-packages/sphinx/errors.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/gmic-py/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 303, in build_main
args.tags, args.verbosity, args.jobs, args.keep_going)
File "/home/docs/checkouts/readthedocs.org/user_builds/gmic-py/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 228, in __init__
self.setup_extension(extension)
File "/home/docs/checkouts/readthedocs.org/user_builds/gmic-py/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 449, in setup_extension
self.registry.load_extension(self, extname)
File "/home/docs/checkouts/readthedocs.org/user_builds/gmic-py/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 475, in load_extension
raise ExtensionError(__('Could not import extension %s') % extname, err)
sphinx.errors.ExtensionError: Could not import extension pyquickhelper.sphinxext.sphinx_autosignature (exception: cannot import name 'NoUri' from 'sphinx.errors' (/home/docs/checkouts/readthedocs.org/user_builds/gmic-py/envs/latest/lib/python3.7/site-packages/sphinx/errors.py))
Extension error:
Could not import extension pyquickhelper.sphinxext.sphinx_autosignature (exception: cannot import name 'NoUri' from 'sphinx.errors' (/home/docs/checkouts/readthedocs.org/user_builds/gmic-py/envs/latest/lib/python3.7/site-packages/sphinx/errors.py))
OK sorry the above readthedocs.io error is due to an old sphinx version by default on this platform, I managed to overcome it..
OK autosignature is now used at https://gmic-py.readthedocs.io/en/latest/PIL.html for the first two black links
I have decided to ignore the warnings for now..
To fix it, I would probably add a parameter in conf.py to disable warnings. Would that be ok for you?
yes
Thank you
I looked into the code and the logging [import_object] ... should not appear unless :debug: is added as on option to the directive. The warning WARNING: [autosignature] should not appear unless the directive does not work. I looked at https://gmic-py.readthedocs.io/en/latest/PIL.html and it looks ok. I guess I'll have to build and run the documentation to fully understand what's happening.
ok thank you for kindness Xavier I have accepted to build with warnings
čt 12. 11. 2020 v 0:51 odesílatel xavier dupré [email protected] napsal:
I looked into the code and the logging [import_object] ... should not appear unless :debug: is added as on option to the directive. The warning WARNING: [autosignature] should not appear unless the directive does not work. I looked at https://gmic-py.readthedocs.io/en/latest/PIL.html and it looks ok. I guess I'll have to build and run the documentation to fully understand what's happening.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sdpython/pyquickhelper/issues/319#issuecomment-725728330, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJU5QX4R3S74VLZVJGEZYLSPMPORANCNFSM4S3MQL4Q .