gpt4 book ai didi

python - 狮身人面像 : How to generate documentation using Sphinx

转载 作者:行者123 更新时间:2023-11-29 09:50:56 26 4
gpt4 key购买 nike

当我们输入命令sphinx-quickstart时,我们要输入很多次值。
例如:

> Root path for the documentation [.]:
> Separate source and build directories (y/n) [n]:
> Name prefix for templates and static dir [_]:
> Project name:
> Author name(s):
> Project version []:
> Project release []:
> Project language [en]:
> Source file suffix [.rst]:
> Name of your master document (without suffix) [index]:
> Do you want to use the epub builder (y/n) [n]:
> autodoc: automatically insert docstrings from modules (y/n) [n]:
> doctest: automatically test code snippets in doctest blocks (y/n) [n]:
> intersphinx: link between Sphinx documentation of different projects (y/n) [n]:
> todo: write "todo" entries that can be shown or hidden on build (y/n) [n]:
> coverage: checks for documentation coverage (y/n) [n]:
> imgmath: include math, rendered as PNG or SVG images (y/n) [n]:
> mathjax: include math, rendered in the browser by MathJax (y/n) [n]:
> ifconfig: conditional inclusion of content based on config values (y/n) [n]:
> viewcode: include links to the source code of documented Python objects (y/n) [n]:
> githubpages: create .nojekyll file to publish the document on GitHub pages (y/n) [n]:
> Create Makefile? (y/n) [y]:
> Create Windows command file? (y/n) [y]:

有什么办法可以让我们不必再从事这项令人厌烦的工作吗?
例如任何 bash 脚本或 python 脚本?

相关参数是:

> Project name: My Project
> Author name(s): My Name
> Project version []: 1
> autodoc: automatically insert docstrings from modules (y/n) [n]: y
> doctest: automatically test code snippets in doctest blocks (y/n) [n]: y
> viewcode: include links to the source code of documented Python objects (y/n) [n]: y

其余的都是空字符串。

我的尝试

printf '\n\n\nMyProject\nBhishan Poudel\n1\n\n\n\n\n\ny\ny\n\n\n\n\n\n\ny\n\n\n\n' | sphinx-quickstart

尝试 2

# run_sphinx_quickstart.py
#!/usr/bin/env python3
import subprocess

sphinx_args = {
'Root_path' : '',
'Separate_source' : '',
'Name_prefix' : '',
'Project_name' : 'My Project',
'Author_name' : 'Bhishan Poudel',
'Project_version' : '1',
'Project_release' : '',
'Project_language' : 'en',
'Source_file' : '.rst',
'master_document' : 'index',
'epub' : '',
'autodoc' : 'y',
'doctest' : 'y',
'intersphinx' : 'n',
'todo' : 'n',
'coverage' : 'n',
'imgmath' : 'n',
'mathjax' : 'n',
'ifconfig' : 'n',
'viewcode' : 'y',
'githubpages' : 'n',
'Makefile' : 'y',
'Windows_Makefile ': 'n' }

for k,v in sphinx_args.items():
print(k,'\t\t:', v)


subprocess.call('sphink-quickstart', shell=True)

# I don't know how to caputre the outputs of shell commands!!

我们将不胜感激。

相关链接:

最佳答案

您可以调用 sphinx-quickstart -q使用您喜欢的选项。

关于python - 狮身人面像 : How to generate documentation using Sphinx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44915906/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com