I'm thinking about the reference docs on the new d...
# development
b
I'm thinking about the reference docs on the new docs site. (reference docs are the ones generated for each target/subsystem/etc...) Background: • The way docusaurus will work, we'll likely build our docs my smushing together the docs content for each branch from v2.0 up • This will be done at "docs build" time (ideally every push to a release branch and main, too) (also ideally to every PR thats "relevant") Because of the way this'll work, it's prohibitively expensive to try and generate the same reference docs over and over. So, how would we feel about having the reference docs be checked in along the normal docs? Tooling would be in place to help generate it, and a test will exists to ensure the disk contents are legit. This also isn't unlike our github actions generation. Pros: • Docs build is simple and fast • Running docs locally means you see the reference docs too • No dead links Cons: • Generated content in repo • Have to remember to run the command
c
I’m not averse to checking this in, but I’m curious as to what makes the ref doc generation prohibitively expensive? does it take a very long time to generate?
b
Yeah. It involves running
pants help-all
. That not only requires compiling the engine (🤮 ) but that command itself takes several seconds to run (even if someone how the engine was cached). THEN you actually generate the content 😕
c
can’t we cache the help all output from the regular workflow where we run tests and stuff, and pull that down for the docs job?
I’m assuming the actual content generation given the help all data is OK-ish..
b
Possibly? But I would likely suspect the amount of custom tooling involved, and the lack of local-friendly-ness would make it overall a bad idea
c
I can see this being local-friendly too… using GHA cache tasks there’s not much extra custom tooling involved compared to what would be needed any way (the content generation from the help-all data)
locally, we could use
pants help-all | cmd-to-generate-ref-docs
while in a workflow it’s
download cached help-all | cmd-to-generate-ref-docs
b
Having to pull every 2.x version and rebuild the world to maintain the website seems like a nonstarter to me? (Eg what if we want to change the doc build format? Will we have to backport changes to all branches?) What’s the reasoning for that?
b
The docs contents from the earlier branches get rolled up in the build process during the "full" website build. The build config/format itself always comes from
main
(or more precisely whatever branch you're on) The overall user experience of having the tool itself (docusaurus, but same goes for mkdocs-material) manage versions is superior to host-provided versioning. Save for the technical impact, where each version needs to exist pre-build
download cached help-all
... that seems very,,,, rest-of-the-fucking-owl 🪄
I forgot to add a pro, which is no dead links Right now all the links to reference docs are "hope it's valid". So we also have to turn on that dead links are warnings (not errors). Then during build I guess we turn on
error
?
c
it’s meant as pseudo code 🤣
in my mind, that’s a download cache step, which puts the file on disk, which can then be fed into the actual command, so not a lot more, but one additional step for the task
b
(for "dead" branches, I think we ought to check the contents in either way. so consider this thread for "live" branches)
You'd have to be more specific, since the cached help-all is dependent on the engine compilation and the contents of the targets/subsystems help strings
c
cached for a particular git sha..
push -> GHA test workflow (upload cached help-all) -> GHA docs (download cached help-all)
however, this makes running only the docs workflow depend on a pre-existing (and not purged) cache entry from the test workflow, which is perhaps not ideal…
b
Ah, I see. I guess I was expecting something like: 1. Pants repo build is focused on producing a bunch of HTML files for the current code (including internal link validation etc.), without interacting with anything external (including other versions of Pants) 2. Release process uploads those to a hosting provider somehow (potentially just an S3 bucket, e.g.
<s3://docs.pantsbuild.org/2.34.5.dev6/>...
for the
2.34.5.dev6
release) 3. Separate processing (either maintained by us, or from the hosting provider) injects the cross-version functionality, like version selector and redirects for latest
b
Number 1 is correct, except it builds the code for all versions. It just so happens there's only one version. During build tine pre-pubkish we stitch all branches together, under their respective version. The process results in one set of html files for the whole site. All versions.
The upside is we use the apps versioning semantics. One big part of that is having unversioned pages (think the maintainers list, or the code of conduct)
b
Maybe you are suggesting that we do steps 1 and 3 together in the pants repo, as part of the release process?
Just brainstorming a bit: For stuff that's unversioned, we could put that into a dedicated "website" repository, rather than the main Pants repo (seems very confusing with branching, which branch do the "unversioned" pages come from?). Potentially the build process for that website repository can include pulling down all the docs HTML artefacts and mushing them together, if we want to deploy website and docs as one big artefact (with the build process triggered automatically by a pants release?)
b
That seems orthogonal to the generated docs discussion? There's literally one thousand ways we could do docs, I don't want us spending so much time discussing all the possible ways, and losing focus of the MVP for the task at hand of simply getting off readne
b
I don't think it's orthogonal unless we're only focusing on "how do we create HTML files for a single pants version?", and I don't think we are.
Having our lowest effort MVP involve committing generated files across dozens of (outdated) branches and then somehow checking them all out to mash together as part of the normal release process seems surprising to me! For one, if we do "juggle some HTML files to create the whole website" as a separate repo, we get way faster cycle times on that step, and the ability to fix website-creation problems without having to do a Pants release, both of which seem valuable for MVP
I think it'd help me a lot to understand what even "build docs for a single pants version" looks like. Do you have code for that that we could land as an MVP and refactor our way to "multi-version/whole website" from there?
b
🎉 https://github.com/thejcannon/pantsasaurus So "build a single version" is
npm build
Having our lowest effort MVP involve committing generated files across dozens of (outdated) branches
We're already going to have to commit files to those branches, if we want those branches to have docs.
The ability to fix website-creation problems without having to do a Pants release
...I'm not sure where the idea was given that we'd need to do a release for docs publishing, but we'd be able to publish the docs ~whenever. Every push even...
b
Sorry, I have minimal details of your overall plan, and so am thus having to imagine how it might work, and I've clearly filled in the gaps wrong. Concrete code like that repo is helpful. Thanks.
We're already going to have to commit files to those branches, if we want those branches to have docs.
I'm not sure I follow. If we treat the docs as a built artefact stored outside the repo, we can backfill those artefacts however we want (similar to how we didn't have to commit anything to 2.0.x (etc) have github releases all the way back to 2.0.0)
b
FWIW Soon (hopefully by the end of the week) I'll have it wired up to be fully versioned as proposed
If we treat the docs as a built artefact stored outside the repo,
The built docs, yes. But the source of the docs, no. I'm not quite following the parallel with releases.
b
If we treat the docs as a built artefact stored outside the repo,
(Or, at least, the files that are inputs to the doc building process, whether rendered HTML or md)
AIUI, the contents of https://github.com/thejcannon/pantsasaurus/tree/main/website/docs is the "stuff that comes from the Pants repo", is that correct? Assuming so, the connection to releases might be: 1. the pants release process does the appropriate codegen to create a zip file of the various md files that end up in that directory, and put it in some sensible S3 bucket e.g.
<s3://docs-artefacts/2.34.5.zip>
2. the pantsasaurus build downloads all the zipfiles it wants and unpacks them into the appropriate places such as
docs/
So, the codegen
help-all
extraction happens in 1, as part of the release process. It produces md files not HTML. Then the docs build process can mash up those MD files as it needs to, without needing to rerun the codegen for all the versions. Then, for the old versions, we create the zipfiles via some out-of-CI method and put them in the S3 bucket (e.g.
<s3://docs-artefacts/2.0.0.zip>
,
<s3://docs-artefacts/2.1.0.zip>
, ...), rather than committing them.
b
That could maybe work, but it'd be yet another process on top of docs creation, and that's kinda what I'm hoping to avoid. I'm also trying to avoid S3 or any other system that involves a credit card 🙂 The docs coming straight from the branches is easy and intuitive (since the version displayed on the docs site is a branch name, not a release name). I also don't feel like we've really discussed at all the proposal at hand, and only discussed ways to avoid it 😕
b
(Could be GitHub releases rather than S3. Acknowledged.) I am discussing the proposal by saying I’m not a huge fan of committing this generated code, and offering alternatives.
c
oh, I didn't get this from the beginning, you mean that we would need to run
pants help-all
for each branch we want to document? Then yea, it feels really wasteful to re-run that on every doc publish for all the historic versions knowing that they will be the ~same every time. Checking this in feels like a good move, but perhaps have a dedicated repo for the generated docs that is a wash that is more temporary and doesn't bloat the main pants repo?
I say "temporary", meaning, for as long as we use this docs process...
b
So in addition to "check in or not check in" I suppose we can also (continue to) discuss a third option, which is "store the generated markdown somewhere". It's certainly more attractive than generating each time. The easiest would be making a "docs" release from a tag we push whenever we want a new version. We'd have to invent some kind of scheme for that (or maybe we could keep pushing the same tag to the branch?) Comparing it to the above pros/cons: • Docs build is still (mostly) simple and fast • Running docs locally means you dont see reference docs • dead links • no generated content in repo • dont have to remember to run anything • reference docs lag behind in-repo docs ◦ E.g. you can't link to a reference doc item when making docs changes until we release those docs
(I do think we ought to check the (converted) docs back into the older branches. Otherwise there's no way to edit them and no source of truth, if need-be. This discussion mainly centers around the reference docs)
c
what does "running docs locally" mean?
b
npm start
->
localhost:3000
👀 1
c
what if the
npm start
is run off of the
docs-repo
where we have all the reference docs material generated into.. ? then it would contain everything, right?
and if we have a tool that takes help-all output and generates ref docs to checkin, it ought to be easy enough to update it with pants main or feature branch or what not
and if we need to post-tweak old versions docs, we can do that in the
docs-repo
too... I think..
no need to check in stuff for old release branches
b
Trying to maintain a shadow-repo isn't likely to be an easy task IMO. It also might confuse folks
c
I think "folks" shouldn't generally need to be aware of it..
unless by folks you mean us maintainers/contributors
I see the docs-repo as the storage for your
"store the generated markdown somewhere"
so not really a shadow-repo as such..? more like an alternative repo for generated content
b
Running docs locally means you dont see reference docs
I don't understand this. If we have a process for "create and store the geneated markdown somewhere", can't the process to create that markdown feed into running the docs locally?
dead links
Why does this follow?
reference docs lag behind in-repo docs
This seems correct? It seems undesirable to have the published reference docs ahead of actual releases. Sometimes it'll just be some text changes that could go out early, but often it'll be more than that (new fields etc.)
b
1. Yes, but you'd have to run that process before
npm start
to see the reference docs 2. Any docs links to reference docs will be dead 3. I was thinking more about changes locally. E.g. I want to make a PR to the
docs/
and need to link to the field. But essentially it's just another flavor of "dead link"
b
> Yes, but you'd have to run that process before
npm start
to see the reference docs Ah, I was assuming anything in the Pants repo would be run via pants itself and thus be able to depend on codegen targets. (I think technically we could also have
npm start
have a
prestart
script that calls pants too) > Any docs links to reference docs will be dead As in, for the files stored in the repo,
[text](reference-blah)
will look broken for source-code-only analysis? If we have a tool that can check dead links for us (is that what you're thinking?), could it hook into the codegen target above too to have all files available? > I was thinking more about changes locally. E.g. I want to make a PR to the
docs/
and need to link to the field. But essentially it's just another flavor of "dead link" Hm, not sure what you mean, but okay, I'll assume solving dead links solves this.
h
Can we check it in to a different sidecar repo?
I really don't like having massive amounts of checked in content in the repo gumming up the git history
But in a repo dedicated to just this I'd be fine with it
maybe a git submodule?
Usually those are a pain, but humans don't have to interact directly with this one
so maybe it's ok
b
So given that among this third option there are two options, which do people prefer? • Sidecar repo • GitHub Releases for docs
To me, a repo is a lot of noise. You have to disable pull requests and issues, etc... It also means we're splitting our GitHub actions between two repos (sidecar needs to build docs on push, main repo has to build docs in CI). Then there's the engineering involved with keeping it up to date.
GitHub releases seem simpler, albeit we have to invent some form of versioning (I don't know if you can push the same tag to multiple commits, and expect different releases). It's functionally different from what we're used to, so there's that too
It's too bad that generating these handfuls of docs is this difficult. Honestly it's the engine compilation that kills us. ... This brings me back to "we should run pants using pants" but I digress
FWIW I don't love either option. To me, the reference-docs-in-repo still seems like it'd have more benefit.
c
I’m +1 to a “sidecar” repo. Using releases feels like it would clutter up the space where users go to find regular pants releases..?
c
Naive Clarifying Question: I have the most experience with Git*Lab* pages which don't support any of the important versioning requirements here and have a really simple "make html however you want and upload it $HERE" model. Is that... not how readthedocs and docusaurus work? They need to be able to "build" each branch/tag on the fly?
b
There's moving pieces, for sure. Maybe I'll do a write up soon and make (another) GitHub Discussion. GitHub has the same "upload HTML here plz" and, of course, leveraging GitHub Actions it's all autonomous. Thats' GitHub Pages Then, you need to build that HTML from markdown. That's
mkdocs
and
docusaurus
. The hard part for us is two-fold: • We have generated docs --> reference docs which are generated (we can choose to generate either html or markdown) from
pants help-all
• We want to maintain docs for over a dozen versions. Albeit some are "dead". Those are where the challenge lies. Docs hosters (like readthedocs, and readme) offer "let us handle the versioning for you". That's a huge pro for the multiple-versions thorn. But is also is a con, because "evergreen" docs are now versioned, and you usually are getting a shittier UI/UX when it comes to versioning. We could use the tools' versioning scheme which means everything stays in ecosystem, but that means we need all of the docs (going back to every version) at build time. The big pro is you get one complete docs site (meaning you could go as simple as GitHub Pages). If there was a way in-tool to do a partial build (mkdocs maaaayyyybe has one, but I'm leaning heavily on docusaurus) this would be mostly a nonstarter. Maybe I'll ask around
OK I did try a naive way of only building one version of the docs and see if docusaurus produced something that we could just
rmdir
the old and
cp
the new. Unfortunately with each build, it builds a different named
main-(some id).js
component which is referenced in each page (I think this would be called the "server"). So if you tried to merge just that docs' build, it'd have references to a different "runtime". 😞
c
Thanks for the context. And I suppose the fundamental bit I'm missing is: " let us handle the versioning for you" doesn't take the form of "upload your v1.2.3 HTMl to the v1.2.3 subdir" but something more all encompassing?
b
"let us handle the versioning for you" is more, send us the HTML for this version. It's now a snapshot. Similar to what we have today.Albeit for the cheaper/free-er options the UI/UX gets worse than what we have today. And we still have the problem of versioned "evergreen" docs. (e.g. service providers, list of maintainers)
b
Maybe I'll do a write up soon and make (another) GitHub Discussion
Yeah, this'd be helpful; as it is, I think we're trying to evaluate/provide feedback on a small piece of a larger plan, without seeing the larger plan 🙂
b
I'm realizing now that we dont have to compile the engine to run
help-all
because we're asking for
help
on plugins baked into Pants itself. That changes things I think... This whole thing might be moot, as that doesn't feel prohibitively expensive...
Discussion started though. I'm pretty brain-dead so it's likely incomplete: https://github.com/pantsbuild/pants/discussions/20140
Although...
We'll likely want/need a strategy to not run this process on "dead" branches. Both for the savings in build time as well as complexity (the
help-all
output likely has and will change, meaning we would need to maintain multiple "generator" templates).
c
I’m realizing now that we dont have to compile the engine to run
help-all
because we’re asking for
help
on plugins baked into Pants itself. That changes things I think...
I don’t think all iterations of backends is compatible with any one version of the engine… 😕
b
We're only ever running already-released (read: already compiled Pants) on an invocation with an essentially empty Pants project, with a subset of the already-embedded backends enabled. Therefore, it really is plug-and-play. Does that makes sense?
c
ah, yea, you mean for older versions we merely download the released pex and get the help-all from that
👍 2
b
Funny enough, it actually is pretty fast to run
help-all
in a loop over all the versions, lol
👍 1