Beginners Question on auto doc and scripts in the folder.

201 views
Skip to first unread message

Sambid Wasti

unread,
Apr 23, 2021, 11:45:24 AM4/23/21
to sphinx-users
Hi all,

I am a new user of Sphinx documentation. Most of my learning has been through various tutorials. I had few questions which i have not been able to find answers.

Currently, I have a code.rst file where i have few automodules.
 
..automodule:: testsphinx
    :members:

..automodule:: testsphinx1
  :members:

and so on.

My question is is there a way to automodule all the scripts in the folder? Is there a autofolder? Currently, there are multiple scripts in a folder. At the moment I am manually finding scripts and generating the automodule segment for each. Is there a way to automate it? I am still struggling with this so i havent reached to documenting classes properly but I would assume that i will have to manually write auto-class.

There was also the sphinx-autogen that generates a rst file. I am not 100% sure how that works or if i can use that at the moment.

Any help is appreciated.
-Sam   


Komiya Takeshi

unread,
Apr 25, 2021, 6:29:34 AM4/25/21
to sphinx...@googlegroups.com
Hi,

How about using sphinx-apidoc? It generates reST files from python
scripts by searching directories.
https://www.sphinx-doc.org/en/master/man/sphinx-apidoc.html

Thanks,
Takeshi KOMIYA

2021年4月24日(土) 0:45 Sambid Wasti <wa...@cua.edu>:
> --
> 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/d8a18cac-46ab-4e04-b147-27222b69cd66n%40googlegroups.com.

Sambid Wasti

unread,
Apr 27, 2021, 4:25:13 PM4/27/21
to sphinx-users
Hi Takeshi Komiya,

Thank you. This did point me in the right direction but I am running into few issues.     

Lets say i have a folder name 'father', and two sub folders, 'child1' and 'child2'. 'child1' is the python package with scripts. 'child2' is additional scripts thats not part of the package.     

Currently when i run this, it is only creating a module of child1 but not child2. It creates an rst file child1.rst which has all the modules in there from child1.  
I am using > sphinx-apidoc -Ff inputfolder -o outputfolder to get all config files.

Also, is there a way to add extensions or set the html theme while generating this? At the moment, i am generating this and editing the file. Eventually, I will remove the force 'f' and 'F', but I would assume if there was any edits on the scripts, i will have to re-run it with 'f' and 'F'.

Best,
Sam

Sambid Wasti

unread,
Apr 27, 2021, 4:53:46 PM4/27/21
to sphinx-users
So i just resolved the issue. It looks like the sphinx-apidoc ignores folders without the __init__.py. As soon as i created that, it imported.

I found the solution here:
Reply all
Reply to author
Forward
0 new messages