purple-plastic-57801
11/24/2023, 9:37 PMsphinx-build and sphinx-apidoc is there a way I can target the apidoc entrypoint(?) with a pants run_shell_command ? I got sphinx-build to work with
run_shell_command(
name="sphinx",
command="python {chroot}/sphinx.pex --help",
runnable_dependencies=["//.build/requirements:reqs-dev#sphinx"],
)purple-plastic-57801
11/24/2023, 9:38 PMpy_console_script_binary from rules_python.purple-plastic-57801
11/24/2023, 9:44 PMpex_binary(
name="sphinx-apidoc",
script="sphinx-apidoc",
dependencies=["//.build/requirements:reqs-dev#sphinx"],
)breezy-mouse-20493
11/27/2023, 8:11 PMpurple-plastic-57801
12/01/2023, 6:41 PMpython_sources(name="conf")
files(name="index", sources=["index.md"])
"""
Unfortunately, we _cannot_ glob over dependencies, as such we need to explicitly define the dependencies which are required to
build documentation. As such, if you add a new package it will not be included in the documentation unless you add it to the
list below.
"""
DOC_DEPS = [
":conf",
":index",
... all dependencies required for docs
]
SPHINX_DEPS = [
".build/requirements:reqs-dev#myst-parser",
"//.build/requirements:reqs-dev#sphinx",
]
pex_binary(
name="sphinx-apidoc",
script="sphinx-apidoc",
dependencies=SPHINX_DEPS,
)
adhoc_tool(
name="build-apidoc",
runnable=":sphinx-apidoc",
args=[
"--force",
"--module-first",
"--output-dir",
# NOTE(G3): In later steps, when the output is unfurled.. this places the documentation in the worktree
# appropriately from the root of the workspace
"path/docs/source",
# NOTE(G3): Relative to this BUILD file
"./../path",
],
execution_dependencies = DOC_DEPS,
output_directories=["path/docs"],
root_output_directory="./",
log_output=True,
)
pex_binary(
name="sphinx-build",
script="sphinx-build",
dependencies=SPHINX_DEPS + DOC_DEPS,
)
adhoc_tool(
name="build-html",
runnable=":sphinx-build",
args=["-M", "html", ".", "_build"],
execution_dependencies=[":build-apidoc"] + DOC_DEPS,
output_directories=["_build/html"],
root_output_directory="./_build/html",
log_output=True,
)
archive(name="docs", files=[":build-apidoc"], format="zip")
@breezy-mouse-20493purple-plastic-57801
12/01/2023, 7:46 PM--keep-sandboxes=always to figure out the path stuffbreezy-mouse-20493
12/01/2023, 8:02 PM