We use Sphinx for our documentation. In our monore...
# general
j
We use Sphinx for our documentation. In our monorepo, we have a sources directory that has the main site, but it also digs into sources directory for each project along with getting module doc strings for every project's code. We created a
pants-plugin
for building project's docs called
makedocs
. When we run
./pants makedocs ${target}:docs
it builds the docs for that target. This plugin needs to know where the main config file is for the repo. Right now we do some path magic and figure out where the ROOT of the monorepo is located on the filesystem and then hardcode the path to the main
conf.py
file and the output directory. This works in 1.18 but breaks in >1.25. What is the 👖 way to solve this problem? Do I get more sophisticated in finding the path to the ROOT of the monorepo (this feels like something
./pants
should know)? Or do I go whole hog with the chroot and add the main
conf.py
as a resource for every project's
makedocs
target (did I mention the plugin defines a target type?). The latter solution seems like it will be wasteful in that when we build the whole site with every module, we will be copying the whole monorepo into the chroot. The former is what I am leaning towards, but then I have to work around the chroot. Any suggestions would be apprewciated
LOL. Looking around our repo, we've seemed to hack this by hacking our
./pants
script to set an ENV variable with the REPO's root.
Maybe there should be an ENV variable like this set by default. Thoughts?
h
You can get the root of the repo by calling `get_buildroot()`(
from pants.base.build_environment import get_buildroot
)
👍 2
Is that helpful?
j
🎉
Very. Thank you.
❤️ 1
h
Let us know when you’re ready to upgrade your plugin to the V2 engine and we’d be happy to help :)
😄 1
j
I'm working on it. Our custom plugins may be the last hurdle.
👖 1
❤️ 1