Reputation: 7679
I have the following two classes:
class Test1():
"""Test1()"""
def fn_test1():
"""fn_test1 """
print "Hello1"
.
class Test2():
"""Test2()"""
def fn_test2():
"""fn_test2 """
print "Hello2"
These classes are stored in different folders which is shown below:
$ tree -A
.
├── docs
│ ├── _build
│ ├── conf.py
│ ├── index.rst
│ ├── make.bat
│ ├── Makefile
│ ├── _static
│ ├── _templates
│ └── Test1.rst
└── src
└── standard
├── test1
│ └── Test1.py
└── test2
└── Test2.py
I tried to run sphinx-apidoc, but it only finds Test1.rst with the following command:
$ sphinx-apidoc -f -A "Author" -H "Test project" -V "version 1.0" -R "release 2014" -F -d 4 -e -P -o docs /home/u/tmp/sphinx/src/standard/*
Creating file docs/Test1.rst.
Creating file docs/conf.py.
Creating file docs/index.rst.
Creating file docs/Makefile.
Creating file docs/make.bat.
If I remove * it finds nothing:
$ sphinx-apidoc -f -A "Author" -H "Test project" -V "version 1.0" -R "release 2014" -F -d 4 -e -P -o docs /home/u/tmp/sphinx/src/standard/
Creating file docs/conf.py.
Creating file docs/index.rst.
Creating file docs/Makefile.
Creating file docs/make.bat.
How is it possible to call sphinx-apidoc that it finds Test1.py and Test2.py?
Upvotes: 3
Views: 2705
Reputation: 53
Python packaging depends on directories tree. So from what you've done, standard is a package with two "subpackages", test1 and test2. Each subpackage contains a module, either Test1 or Test2.
You must add an (possibly) empty file called __init__.py to each directory containing a package and run
sphinx-apidoc -f -A "Author" -H "Test project" -V "version 1.0" -R "release 2014" -F -d 4 -e -P -o docs /home/u/tmp/sphinx/src/standard/
without the * sign.
Upvotes: 1