Skip to content

Commit

Permalink
Build executorch Sphinx docs internally and link to static docs
Browse files Browse the repository at this point in the history
Differential Revision: D58986545

Pull Request resolved: #7481
  • Loading branch information
tarun292 authored Jan 4, 2025
1 parent 443ba3b commit 2395da9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
46 changes: 46 additions & 0 deletions docs/TARGETS
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
load("@fbcode_macros//build_defs:native_rules.bzl", "buck_filegroup", "buck_sh_test")
load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary")

oncall("pytorch_r2p")

python_binary(
name = "sphinx",
main_module = "sphinx.cmd.build",
par_style = "xar",
deps = [
"//caffe2:torch",
"//executorch/exir:lib",
"//executorch/devtools:lib",
"//executorch/exir/backend/test:backend_with_compiler_demo",
"//executorch/exir/backend/test:op_partitioner_demo",
"//executorch/devtools/bundled_program/serialize:lib",
"fbsource//third-party/pypi/ipykernel:ipykernel",
"fbsource//third-party/pypi/jupyter-client:jupyter-client",
"fbsource//third-party/pypi/jupytext:jupytext",
"fbsource//third-party/pypi/nbsphinx:nbsphinx",
"fbsource//third-party/pypi/pytorch-sphinx-theme:pytorch-sphinx-theme",
"fbsource//third-party/pypi/sphinx:sphinx",
"fbsource//third-party/pypi/breathe:breathe",
"fbsource//third-party/pypi/sphinx-copybutton:sphinx-copybutton",
"fbsource//third-party/pypi/sphinx-design:sphinx-design",
"fbsource//third-party/pypi/sphinx-gallery:sphinx-gallery",
"fbsource//third-party/pypi/matplotlib:matplotlib",
"fbsource//third-party/pypi/myst-parser:myst-parser",
],
)

buck_filegroup(
name = "source",
srcs = glob(["source/**/*"]),
)

buck_sh_test(
name = "doctest",
args = [
"-M",
"doctest",
"$(location :source)/source/",
"/tmp/sphinxbuild",
],
test = ":sphinx",
)
8 changes: 7 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
import os
import sys

FBCODE = "fbcode" in os.getcwd()

extensions = [
"breathe",
"sphinx.ext.autodoc",
Expand All @@ -60,9 +62,13 @@
"myst_parser",
"sphinx_design",
"sphinx_gallery.gen_gallery",
"executorch_custom_versions",
]

if not FBCODE:
extensions += [
"executorch_custom_versions",
]

this_file_dir = os.path.abspath(os.path.dirname(__file__))
doxygen_xml_dir = os.path.join(
os.path.dirname(this_file_dir), # {repo_root}/docs/
Expand Down

0 comments on commit 2395da9

Please sign in to comment.