The "WARNING: invalid signature for automodule" error

975 views
Skip to first unread message

Birgitte

unread,
Aug 28, 2019, 2:57:21 AM8/28/19
to sphinx-users
Dear sphinx-team and sphinx-users,

I am currently working on documenting some code, and keep on getting the following warning/error (this is one example of multiple):

WARNING: invalid signature for automodule ('components.component-1.orc_component_1.app)
WARNING: don'
t know which module to import for autodocumenting 'components.component-1.orc_component_1.app' (try placing a "module" or "currentmodule" directive in the document, or giving an explicit module name)

I think it has to do with "-" in the sub-directory names, without being sure. Since multiple people are working on - and using the code I can't change the directory names. Do you know if there is a way to work around this error and still get the scripts documented? Or if there are some settings in sphinx that can be changed to accommodate this?


Below I have sketched out a simplified representation of the project and how I have built the sphinx documentation:

.
|-- README.rst
|-- components
|   |-- component-1
|   |   |-- README.rst
|   |   |-- orc_component_1
|   |   |   |-- app.py
|   |   |   |-- services.py
|   |   |   `-- utils.py
|   |-- component-2
|   |   |-- README.rst
|   |   |-- orc_component_2
|   |   |   |-- app.py
|   |   |   |-- services.py
|   |   |   `
-- utils.py
|-- docs
|   |-- Makefile
|   |-- build
|   |   |-- doctrees
|   |   `-- html
|   |-- make.bat
|   `
-- source
|       |-- _static
|       |-- _templates
|       |-- components.rst
|       |-- conf.py
|       |-- index.rst
|       |-- readme_components.rst
.... and so on..



in conf.py, the sys.path is set to:

import os
import sys
sys
.path.insert(0, os.path.abspath('../..'))


the index.rst

Welcome!
========


.. toctree::
   
:maxdepth: 2
   
:caption: Modules:


components
readme
-components


Indices and tables
==================


* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`



the readme_components:

.. include:: ../../README.rst

.. include:: ../../component-1/README.rst

.. include:: ../../component-2/README.rst


The components (only the ones we want to document)


component
-1
===========


.. automodule:: components.component-1.orc_component_1.app
   
:members:


.. automodule:: components.component-1.orc_component_1.services
   
:members:


.. automodule:: components.component-1.orc_component_1.utils
   
:members:


component
-2
===========


.. and so on

Thanks!

Best wishes, Birgitte
Message has been deleted

Kevin Sheppard

unread,
Sep 4, 2019, 1:58:14 PM9/4/19
to sphinx...@googlegroups.com
A few strategies that might help:

Have you tried setting current-module before calling automodule so that you don't need the hyphen in the module?
Can you replace the hyphen with an underscore like how pip translates the two?


--
You received this message because you are subscribed to the Google Groups "sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/6d5339ea-323a-4286-81dc-6d76efda77bd%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages