本文整理汇总了Python中apigen.ApiDocWriter类的典型用法代码示例。如果您正苦于以下问题:Python ApiDocWriter类的具体用法?Python ApiDocWriter怎么用?Python ApiDocWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ApiDocWriter类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: writeapi
def writeapi(package, outdir, source_version, other_defines=True):
# Check that the package is available. If not, the API documentation is not
# (re)generated and existing API documentation sources will be used.
try:
__import__(package)
except ImportError:
abort("Can not import " + package)
module = sys.modules[package]
# Check that the source version is equal to the installed
# version. If the versions mismatch the API documentation sources
# are not (re)generated. This avoids automatic generation of documentation
# for older or newer versions if such versions are installed on the system.
installed_version = V(module.__version__)
if source_version != installed_version:
abort("Installed version does not match source version")
docwriter = ApiDocWriter(package, rst_extension='.rst',
other_defines=other_defines)
docwriter.package_skip_patterns += [r'\.%s$' % package,
r'.*test.*$',
r'.*duecredit.*$',
r'.*due.*$',
r'\.version.*$']
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, 'index', relative_to=outdir)
print('%d files written' % len(docwriter.written_modules))
示例2: ApiDocWriter
#!/usr/bin/env python
"""Script to auto-generate our API docs.
"""
# stdlib imports
import os
# local imports
from apigen import ApiDocWriter
#*****************************************************************************
if __name__ == '__main__':
package = 'pysvg'
outdir = os.path.join('api','generated')
docwriter = ApiDocWriter(package)
docwriter.package_skip_patterns += [r'\.fixes$',
r'\.externals$',
r'\.neurospin\.viz',
]
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, 'gen', relative_to='api')
print '%d files written' % len(docwriter.written_modules)
示例3: pjoin
"""Script to auto-generate our API docs.
"""
# stdlib imports
import os
import sys
# local imports
sys.path.append(os.path.abspath('sphinxext'))
from apigen import ApiDocWriter
#*****************************************************************************
if __name__ == '__main__':
pjoin = os.path.join
package = 'IPython'
outdir = pjoin('source','api','generated')
docwriter = ApiDocWriter(package,rst_extension='.rst')
# You have to escape the . here because . is a special char for regexps.
# You must do make clean if you change this!
docwriter.package_skip_patterns += [r'\.fixes$',
r'\.external$',
r'\.extensions',
r'\.kernel\.config',
r'\.attic',
r'\.quarantine',
r'\.deathrow',
r'\.config\.default',
r'\.config\.profile',
r'\.frontend',
r'\.gui',
r'\.kernel',
# For now, the zmq code has
示例4: pjoin
"""Script to auto-generate our API docs.
"""
# stdlib imports
import os
import sys
# local imports
sys.path.append(os.path.abspath("sphinxext"))
from apigen import ApiDocWriter
# *****************************************************************************
if __name__ == "__main__":
pjoin = os.path.join
package = "IPython"
outdir = pjoin("source", "api", "generated")
docwriter = ApiDocWriter(package, rst_extension=".rst")
# You have to escape the . here because . is a special char for regexps.
# You must do make clean if you change this!
docwriter.package_skip_patterns += [
r"\.external$",
# Extensions are documented elsewhere.
r"\.extensions",
r"\.config\.profile",
# Old nbformat versions
r"\.nbformat\.v[1-2]",
# Public API for this is in kernel.zmq.eventloops
r"\.kernel\.zmq\.gui",
# Magics are documented separately
r"\.core\.magics",
]
示例5: of
#!/usr/bin/env python
""" Script to auto-generate our API docs """
# stdlib imports for file name handling
import os
# local import of (largely modified) file generator
from apigen import ApiDocWriter
import sys
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir,os.pardir)))
#*****************************************************************************
if __name__ == '__main__':
package = os.path.join('pySPACE')
outdir = os.path.join('api','generated')
docwriter = ApiDocWriter(package)
docwriter.package_skip_patterns = [r'\.docs$']
docwriter.module_skip_patterns = []
docwriter.write_api_docs(outdir)
# docwriter.write_index(outdir+os.sep, 'gen', relative_to='api')
print('%d module files written' % len(docwriter.written_modules))
示例6: abort
except ImportError, e:
abort("Can not import scikits.image")
module = sys.modules[package]
# Check that the source version is equal to the installed
# version. If the versions mismatch the API documentation sources
# are not (re)generated. This avoids automatic generation of documentation
# for older or newer versions if such versions are installed on the system.
installed_version = V(module.version.version)
setup_lines = open('../setup.py').readlines()
version = 'vUndefined'
for l in setup_lines:
if l.startswith('VERSION'):
source_version = V(l.split("'")[1])
break
if source_version != installed_version:
abort("Installed version does not match source version")
outdir = 'source/api'
docwriter = ApiDocWriter(package)
docwriter.package_skip_patterns += [r'\.fixes$',
r'\.externals$',
]
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, 'api', relative_to='source/api')
print '%d files written' % len(docwriter.written_modules)
示例7: V
# for older or newer versions if such versions are installed on the system.
installed_version = V(module.__version__)
info_file = pjoin('..', package, 'info.py')
info_lines = open(info_file).readlines()
source_version = '.'.join([v.split('=')[1].strip(" '\n.")
for v in info_lines if re.match(
'^_version_(major|minor|micro|extra)', v
)])
print('***', source_version)
if source_version != installed_version:
abort("Installed version does not match source version")
docwriter = ApiDocWriter(package, rst_extension='.rst',
other_defines=other_defines)
docwriter.package_skip_patterns += [r'\.fixes$',
r'\.externals$',
r'\.reconst.eit$',
r'\.tracking\.interfaces.*$',
r'\.tracking\.gui_tools.*$',
r'.*test.*$',
r'\.utils.*$',
r'\.viz.*$',
r'\.boots\.resampling.*$',
r'\.fixes.*$',
r'\.info.*$',
r'\.pkg_info.*$',
]
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, 'index', relative_to=outdir)
示例8: __import__
#!/usr/bin/env python
"""Script to generate API docs"""
import os, sys
from apigen import ApiDocWriter
if __name__ == "__main__":
package = "pygimli"
try:
__import__(package)
except ImportError as e:
print("Can not import pygimli")
exit()
buildpath = os.path.abspath(os.path.dirname(sys.modules[__name__].__file__))
outdir = os.path.abspath(buildpath + "/pygimliapi")
if not os.path.exists(outdir):
os.makedirs(outdir)
docwriter = ApiDocWriter(package)
docwriter.package_skip_patterns += [r"\.gui$"]
docwriter.rst_extension = ".rst"
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, "index", relative_to=outdir)
print("%d files written to %s" % (len(docwriter.written_modules), os.path.abspath(outdir)))
示例9: V
# for older or newer versions if such versions are installed on the system.
installed_version = V(module.__version__)
info_lines = open('../dipy/info.py').readlines()
source_version = '.'.join([v.split('=')[1].strip(" '\n.")
for v in info_lines if re.match(
'^_version_(major|minor|micro|extra)', v
)])
print '***', source_version
if source_version != installed_version:
abort("Installed version does not match source version")
outdir = 'reference'
docwriter = ApiDocWriter(package, rst_extension='.rst')
docwriter.package_skip_patterns += [r'\.fixes$',
r'\.externals$',
r'\.reconst.eit$',
r'\.tracking\.interfaces.*$',
r'\.tracking\.gui_tools.*$',
r'.*test.*$',
r'\.utils.*$',
r'\.viz.*$',
r'\.boots\.resampling.*$',
r'\.fixes.*$',
r'\.info.*$',
r'\.pkg_info.*$',
]
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, 'index', relative_to='reference')
示例10: ApiDocWriter
#!/usr/bin/env python
"""Script to auto-generate our API docs."""
import os
from apigen import ApiDocWriter
if __name__ == '__main__':
package = 'mvpa'
outdir = os.path.join('build', 'doc', 'modref')
docwriter = ApiDocWriter(package, rst_extension='.rst')
#docwriter.package_skip_patterns += ['\\.fixes$',
# '\\.externals$']
docwriter.write_api_docs(outdir)
#docwriter.write_index(outdir, 'gen', relative_to='api')
print '%d files written' % len(docwriter.written_modules)
示例11: ApiDocWriter
#!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Script to auto-generate our API docs.
This script should run in Python 2 and Python 3
"""
# stdlib imports
import os
# local imports
from apigen import ApiDocWriter
# *****************************************************************************
if __name__ == "__main__":
package = "nipy"
outdir = os.path.join("api", "generated")
docwriter = ApiDocWriter(package)
docwriter.package_skip_patterns += [
r"\.fixes$",
r"\.externals$",
# r'\.labs\.viz',
]
# XXX: Avoid nipy.modalities.fmri.aliased due to a bug in python2.6
docwriter.module_skip_patterns += [r"\.modalities\.fmri.aliased"]
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, "gen", relative_to="api")
print("%d files written" % len(docwriter.written_modules))
示例12: open
setup_lines = open("../setup.py").readlines()
for l in setup_lines:
if l.startswith("VERSION"):
source_version = V(l.split("'")[1])
break
if source_version != installed_version:
abort("Installed version does not match source version")
if __name__ == "__main__":
package = "mpltools"
# Check that the 'image' package is available. If not, the API
# documentation is not (re)generated and existing API documentation
# sources will be used.
try:
__import__(package)
except ImportError as e:
abort("Cannot import mpltools")
# assert_source_and_install_match(package)
outdir = "source/api"
docwriter = ApiDocWriter(package)
docwriter.package_skip_patterns += [r"\.fixes$", r"\.externals$"]
docwriter.write_api_docs(outdir)
docwriter.write_index(outdir, "api", relative_to="source/api")
print("%d files written" % len(docwriter.written_modules))