Open kaycebasques opened 1 month ago
@rickeylev FYI
You can just put the files in srcs
.
The way sphinx works is it basically takes two inputs: the directory of stuff to process (which is expected to have the conf.py file) and the output format to use. The main work the rules do is just creating that directory and relocating all the input files to be under it. Unlike "regular" library targets (like for a programming language), there isn't any distinction between "source files some compiler processes" and "opaque data payloads". It's all just files being staged into a directory.
Also, in case it helps:
.run
target that you can use to directly run sphinx. e.g. bazel run //docs:docs.run
. This can be helpful to mimic as if you had directly run sphinx-build
in a non-bazel context (e.g drop into pdb etc){name}/_sources
. e.g. bazel build //docs:docs/_sources
I will send a PR proposing some docs updates next week and then we can close this issue out
š bug report
Affected Rule
sphinx_docs_library
Is this a regression?
No. I don't believe
sphinx_docs_library
has ever supported this attribute but it seems like it should.Description
We use the literalinclude directive to pull in snippets of code from C++ files into our reStructuredText documentation. It seems like
sphinx_docs_library
should allow us to specify data dependencies alongside reStructuredText source files.Adding
data
attribute to oursphinx_docs_library
invocations throws errors, however.literalinclude
example: https://cs.opensource.google/pigweed/pigweed/+/385019a0292797dd63f00f008efe36d52d4d698a:pw_async2/docs.rst;l=27;bpv=1š¬ Minimal Reproduction
git clone https://pigweed.googlesource.com/pigweed/pigweed
cd pigweed
git fetch https://pigweed.googlesource.com/pigweed/pigweed refs/changes/12/240912/2 && git checkout -b change-240912 FETCH_HEAD
bazelisk build //docs/...
š„ Exception or Error
š Your Environment
Operating System:
(
uname -a
output)Output of
bazel version
:Rules_python version:
v0.36.0
Anything else relevant?
this is how we added initial support for rules_python/sphinxdocs stuff last week: https://pwrev.dev/237877