sphinx-apidoc: add ability to exclude specific files or filepatterns
I'm using sphinx-apidoc to generate rst files for a project that contains multiple packages.
Some of these packages contain SCons scripts and helper .py files for building Python extensions.
These builder scripts are really not part of the produced extension module, so I'd like to be able to exclude them from being processed by sphinx-apidoc but currently there doesn't seem to be a way.
I'm requesting the ability to add exclude patterns so specific files can be excluded.
- Bitbucket: https://bitbucket.org/birkenfeld/sphinx/issue/944
- Originally reported by: Anonymous
- Originally created at: 2012-06-08T02:19:38.305
From James Mills on 2013-06-21 06:05:36+00:00
+1
was this ever done?
Yeah, excluding feature has been provided since sphinx-1.1 by #98.
$ sphinx-apidoc -h
Usage: sphinx-apidoc [options] -o <output_path> <module_path> [exclude_path, ...]
and do
$ sphinx-apidoc -o doc/api src/ src/spam.py src/ham.py src/egg.py
If I am trying to exclude __init__.py, it is throwing AssertionError.
I executed following command:
_sphinx-apidoc -o source/plugin ../plugins/ ../plugins/echo.py ../plugins/__init__.py -f_
error thrown:
Traceback (most recent call last):
File "/Users/srivastk/virtualenv/proton/bin/sphinx-apidoc", line 11, in <module>
sys.exit(main())
File "/Users/srivastk/virtualenv/proton/lib/python3.5/site-packages/sphinx/apidoc.py", line 343, in main
modules = recurse_tree(rootpath, excludes, opts)
File "/Users/srivastk/virtualenv/proton/lib/python3.5/site-packages/sphinx/apidoc.py", line 230, in recurse_tree
assert root == rootpath and root_package is None
AssertionError
@kanchan1991 please make another issue.
+1
See https://github.com/sphinx-doc/sphinx/issues/3177
I am trying to ignore all directories inside src and to have apidocs only for .py files in /src folder
$ sphinx-apidoc -o doc/api src/ src/*/
but its generating nothing other than module.rst