https://pantsbuild.org/ logo
#general
Title
# general
m

modern-leather-27612

10/13/2021, 6:13 PM
I mentioned this in a previous thread but figure it's better asked at the top: I'm trying to get documentation building to work in my proof-of-concept and am running into some major hickups. In particular, there doesn't seem to be any support for Sphinx in Pants 2.x. Is that correct or did I miss something major? Also, Sphinx wants to load all packages as regular Python code for extracting documentation. That seems to call for packaging everything as a PEX. Are there easier alternatives? I've had troubles with getting a shell script to work but also would prefer avoiding writing my own Python driver script.
w

witty-crayon-22786

10/13/2021, 6:24 PM
hey Robert!
i think that right now, doing this without adding a plugin to pants would involve creating a PEX containing sphinx, and with dependencies on the entire repository
trying that out in the small might look like declaring a
pex_binary(..)
with a
sphinx
dependency, adding some other code as an explicit dependency, and then running `sphinx`’s entrypoint
but this would also make a good plugin: it’s likely that it would look a bit like a linter, so probably not too challenging: if you feel like diving in on that, we can definitely help in #plugins
h

happy-kitchen-89482

10/13/2021, 7:00 PM
Having a sphinx plugin would be really awesome, and I'm guessing not very hard to implement, we'd be happy to help/guide!
m

modern-leather-27612

10/13/2021, 9:47 PM
Hey Stu! Thank you for elaborating. What you describe matches what I had in mind for the most part. The one (probably stupid) question that remains is how to best capture the dependency on the union of repository source code. I noticed I can use
*
as a wildcard for directories in addresses. Does that generalize? Or what's the best way to capture that dependency?
w

witty-crayon-22786

10/13/2021, 10:26 PM
it does not… targets depending on globs is unfortunately something that is intentionally not supported (for the same reason that wildcard imports are discouraged in most languages)
so that would be an annoyingly redundant dependencies list, unfortunately.
the plugin solution wouldn’t have this issue, because you’d tell it what to operate on, and address globs are supported in that case:
./pants doc ::
, for example
m

modern-leather-27612

10/14/2021, 7:44 PM
Thanks for the pointer to the more targeted CI hack. I tried it and it worked once. So I also submitted a documentation change that captures both strategies. The first may not be efficient but it is recommended so often on Stack Overflow that it makes sense to describe it only to better it. (But I'm also perfectly fine if you edit out the first option.)
5 Views