sphinx-apidoc: add ability to exclude specific files or filepatterns

Created on 3 Jan 2015  路  9Comments  路  Source: sphinx-doc/sphinx

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.


apidoc enhancement

Most helpful comment

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

All 9 comments

_From James Mills on 2013-06-21 06:05:36+00:00_

+1

_From setrofim on 2013-07-15 16:16:22+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

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

Was this page helpful?
0 / 5 - 0 ratings