What is the PyTorch installation interactive grid called and how do I make my own?

This post goes through the GitHub workflows and install matrix generation step, dives into the Javascript template, and concludes with the HTML template.

GitHub Workflows and Install Matrix Generation

On the PyTorch side (rather than the PyTorch website gh repo), this script pytorch/.github/scripts/generate_binary_build_matrix.py at 66d3729388b6dc2ae257d984765814a5d42e9060 · pytorch/pytorch · GitHub seems to have an options lists, e.g.:

This creates .yml workflow files via:

(Aside: links related to `generate_ci_workflows.py`: https://github.com/pytorch/pytorch/issues/74480 and https://github.com/search?q=repo%3Apytorch%2Fpytorch%20generate_ci_workflows.py&type=code)

On GitHub - pytorch/pytorch.github.io: The website for PyTorch (rather than GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration), it runs individually for MacOS, Linux, and Windows (both nightly and release versions) via GitHub actions:

Going back to how the javascript gets generated, I see:

which is defined at:

My takeaway is that it comes back to pytorch.github.io/assets/quick-start-module.js at site · pytorch/pytorch.github.io · GitHub (linked above by @ptrblck), where the template file for this is stored at:

I realize I do actually need to understand the Javascript here in order to adapt it. In other words, the JS code isn’t autogenerated, it just gets slightly modified from the template (_includes/quick-start-module.js directory, not assets/quick-start-module.js directory) linked above:

The diff between these two files is interesting:

and (cropped):

Javascript

Taking a closer look at the JS file, the variables and click functions for each of the rows in the installation grid are given in:

The functions are wrappers to selectedOption():

Importantly, this depends on commandMessage():

given in:

where var object = {"preview,pip,linux,accnone,python": "pip3 install --pre torch ...", ...} was modified from the template file line var object = {{ installMatrix }}; as described in the reply preceding this one.

Note the form of the line:
{"<option1>,<option2>,<option3>,<option4>,<option5>": "<install command>", ...}

I think it’s also worth mentioning disableUnsupportedPlatforms(os) which does the strike-through:

HTML

In terms of the HTML templates located in the _includes directory:

pulls from:

To complete the circle, the HTML file uses the Javascript file in: