Python: How can I determine in sphinx which .rst files and directories should be used?

How can I determine in sphinx which .rst files and directories should be used?

I want to include an automatic documentation generator in my testing / assembly / documentation script. sphinx-quickstart was executed in my workspace and created an index.rst file. Since sphinx uses restructured text files for documentation, I moved around the workspace and manually created them using sphinx-autogen. As a result, he executed the tasks.rst file (see below).

When I use 'make html', I get a few warnings:

WARNING : invalid signature for automodule (u'tasks / add_to_config ')

WARNING : autodoc cannot import / find the module 'tasks.add_to_config', it reported an error: "There is no module named wl_build.tasks", check your spelling and sys.path

WARNING : I donโ€™t know which module should be imported to automatically document u'tasks / add_to_config '(try putting the "module" or "currentmodule" directive in the document or specify an explicit module name)

...

My .rst index

Welcome to build documentation! ==================================== Contents: .. toctree:: :maxdepth: 2 .. automodule:: tasks/add_to_config :members: .. automodule:: tasks/build_egg :members: 

tasks.rst

 tasks Package ============= :mod:`tasks` Package -------------------- .. automodule:: tasks.__init__ :members: :undoc-members: :show-inheritance: :mod:`add_to_config` Module --------------------------- .. automodule:: tasks.add_to_config :members: :undoc-members: :show-inheritance: :mod:`build_egg` Module ----------------------- .. automodule:: tasks.build_egg :members: :undoc-members: :show-inheritance: 
+4
source share
1 answer

Try replacing the / characters in index.rst with periods ( . )

like this:

 Welcome to build documentation! ==================================== Contents: .. toctree:: :maxdepth: 2 .. automodule:: tasks.add_to_config :members: .. automodule:: tasks.build_egg :members: 

See if that helps.

If Sphinx still cannot find the code to document, you probably need to change your PYTHONPATH or change the sys.path in the conf.py file to help Sphinx find what it is looking for.

+3
source

Source: https://habr.com/ru/post/1442932/


All Articles