pybuilder的sphinx插件如何使用?
How to use the sphinx plugin of pybuilder?
我尝试使用 pybuilder 创建一个 python 包,想知道如何使用 sphinx 插件。我已经通过 sphinx-quickstart 启动了一个 sphinx 文档脚手架,并在 pybuilder 的 build.py 文件中激活了 sphinx 插件。
下面显示我目前的build.py:
# import required packages
from pybuilder.core import use_plugin, init
import os
import sys
import inspect
# import required plugins
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin("python.install_dependencies")
use_plugin("python.flake8")
use_plugin("python.coverage")
use_plugin("python.distutils")
use_plugin("python.sphinx")
# define build attributes
name = "presentations"
version = "0.0.1"
license = "None"
default_task = ["analyze", "publish"]
@init
def set_properties(project):
# define unittest coverage properties
project.set_property("coverage_threshold_warn", 50)
project.set_property("coverage_break_build", True)
# define linting properties
project.set_property("flake8_break_build", False)
project.set_property("flake8_max_line_length", 120)
project.set_property("flake8_verbose_output", True)
# define documentation properties
project.set_property("sphinx_builder", "html")
__location__ = os.path.join(os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe())))
project.set_property("sphinx_config_path", os.path.join(__location__, '../docs'))
project.set_property("sphinx_source_dir", os.path.join(__location__, '../src'))
project.set_property("sphinx_output_dir", "_build/")
但是,当我运行 pyb 命令构建包时,pybuilder 没有生成所需的文档。我想,除了pybuilder的build.py文件中的“分析”和“发布”之外,我还没有定义另一个default_task,以便在运行宁时强制pybuilder执行sphinx插件pyb 命令。
用户awwsmm has written a super helpful tutorial on how to manage your python project with pybuilder. He also confirms that it is difficult to find a definit list of all available attributes and properties of pybuilder online. Unfortunately, the suggested search on pybuilder's core code也没有帮助我。
有谁知道如何处理这个问题?任何想法将不胜感激。
我正在使用 python (3.6.13)、pybuilder (0.11.17) 和 sphinx (4.0.2) 在 windows 机器上编码。
将 sphinx_generate_documentation 添加到默认任务并更改 sphinx 插件属性就可以了。新的 build.py 看起来像:
# import required packages
from pybuilder.core import use_plugin, init
import os
import sys
import inspect
# import required plugins
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin("python.install_dependencies")
use_plugin("python.flake8")
use_plugin("python.coverage")
use_plugin("python.distutils")
use_plugin("python.sphinx")
# define build attributes
name = "presentations"
version = "0.0.1"
license = "None"
default_task = ["analyze", "publish", "sphinx_generate_documentation"]
@init
def set_properties(project):
# define unittest coverage properties
project.set_property("coverage_threshold_warn", 50)
project.set_property("coverage_break_build", True)
# define linting properties
project.set_property("flake8_break_build", False)
project.set_property("flake8_max_line_length", 120)
project.set_property("flake8_verbose_output", True)
# define documentation properties
project.set_property("sphinx_builder", "html")
project.set_property("sphinx_config_path", "docs")
project.set_property("sphinx_source_dir", "src/main/python")
project.set_property("sphinx_output_dir", "docs/_build")
我尝试使用 pybuilder 创建一个 python 包,想知道如何使用 sphinx 插件。我已经通过 sphinx-quickstart 启动了一个 sphinx 文档脚手架,并在 pybuilder 的 build.py 文件中激活了 sphinx 插件。
下面显示我目前的build.py:
# import required packages
from pybuilder.core import use_plugin, init
import os
import sys
import inspect
# import required plugins
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin("python.install_dependencies")
use_plugin("python.flake8")
use_plugin("python.coverage")
use_plugin("python.distutils")
use_plugin("python.sphinx")
# define build attributes
name = "presentations"
version = "0.0.1"
license = "None"
default_task = ["analyze", "publish"]
@init
def set_properties(project):
# define unittest coverage properties
project.set_property("coverage_threshold_warn", 50)
project.set_property("coverage_break_build", True)
# define linting properties
project.set_property("flake8_break_build", False)
project.set_property("flake8_max_line_length", 120)
project.set_property("flake8_verbose_output", True)
# define documentation properties
project.set_property("sphinx_builder", "html")
__location__ = os.path.join(os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe())))
project.set_property("sphinx_config_path", os.path.join(__location__, '../docs'))
project.set_property("sphinx_source_dir", os.path.join(__location__, '../src'))
project.set_property("sphinx_output_dir", "_build/")
但是,当我运行 pyb 命令构建包时,pybuilder 没有生成所需的文档。我想,除了pybuilder的build.py文件中的“分析”和“发布”之外,我还没有定义另一个default_task,以便在运行宁时强制pybuilder执行sphinx插件pyb 命令。
用户awwsmm has written a super helpful tutorial on how to manage your python project with pybuilder. He also confirms that it is difficult to find a definit list of all available attributes and properties of pybuilder online. Unfortunately, the suggested search on pybuilder's core code也没有帮助我。
有谁知道如何处理这个问题?任何想法将不胜感激。
我正在使用 python (3.6.13)、pybuilder (0.11.17) 和 sphinx (4.0.2) 在 windows 机器上编码。
将 sphinx_generate_documentation 添加到默认任务并更改 sphinx 插件属性就可以了。新的 build.py 看起来像:
# import required packages
from pybuilder.core import use_plugin, init
import os
import sys
import inspect
# import required plugins
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin("python.install_dependencies")
use_plugin("python.flake8")
use_plugin("python.coverage")
use_plugin("python.distutils")
use_plugin("python.sphinx")
# define build attributes
name = "presentations"
version = "0.0.1"
license = "None"
default_task = ["analyze", "publish", "sphinx_generate_documentation"]
@init
def set_properties(project):
# define unittest coverage properties
project.set_property("coverage_threshold_warn", 50)
project.set_property("coverage_break_build", True)
# define linting properties
project.set_property("flake8_break_build", False)
project.set_property("flake8_max_line_length", 120)
project.set_property("flake8_verbose_output", True)
# define documentation properties
project.set_property("sphinx_builder", "html")
project.set_property("sphinx_config_path", "docs")
project.set_property("sphinx_source_dir", "src/main/python")
project.set_property("sphinx_output_dir", "docs/_build")