|
| 1 | +The Botorch website was created with [Docusaurus](https://docusaurus.io/), with some customization to support tutorials, and supplemented with Sphinx for API documentation. |
| 2 | + |
| 3 | +## Dependencies |
| 4 | + |
| 5 | +Ensure necessary dependencies are installed (ideally to your virtual env): |
| 6 | +```bash |
| 7 | +pip install -e ".[tutorials]" |
| 8 | +``` |
| 9 | + |
| 10 | +## Building (all-in-one) |
| 11 | + |
| 12 | +For convenience we provide a single shell script to convert the tutorials and build the website in one command. Must be executed from the repository root. |
| 13 | +```bash |
| 14 | +./scripts/build_docs.sh |
| 15 | +``` |
| 16 | + |
| 17 | +To also execute the tutorials, add the `-t` flag. |
| 18 | +To generate a static build add the `-b` flag. |
| 19 | + |
| 20 | +`-h` for all options. |
| 21 | + |
| 22 | + |
| 23 | +## Building (manually) |
| 24 | + |
| 25 | +### Notebooks |
| 26 | + |
| 27 | +Tutorials can be executed locally using the following script. This is optional for locally building the website and is slow. |
| 28 | +```bash |
| 29 | +python3 scripts/run_tutorials.py -w . |
| 30 | +``` |
| 31 | + |
| 32 | +We convert tutorial notebooks to MDX for embedding as docs. This needs to be done before serving the website and can be done by running this script from the project root: |
| 33 | + |
| 34 | +```bash |
| 35 | +python3 scripts/convert_ipynb_to_mdx.py --clean |
| 36 | +``` |
| 37 | + |
| 38 | +### Docusaurus |
| 39 | +You need [Node](https://nodejs.org/en/) >= 18.x and |
| 40 | +[Yarn](https://yarnpkg.com/en/) in order to build the Botorch website. |
| 41 | + |
| 42 | +Switch to the `website` dir from the project root and start the server: |
| 43 | +```bash |
| 44 | +cd website |
| 45 | +yarn install |
| 46 | +yarn start |
| 47 | +``` |
| 48 | + |
| 49 | +Open http://localhost:3000 (if doesn't automatically open). |
| 50 | + |
| 51 | +Anytime you change the contents of the page, the page should auto-update. |
| 52 | + |
| 53 | +> [!NOTE] |
| 54 | +> You may need to switch to the "Next" version of the website documentation to see your latest changes. |
| 55 | +
|
| 56 | +### Sphinx |
| 57 | +Sphinx is used to generate an API reference from the source file docstrings. In production we use [ReadTheDocs](https://botorch.readthedocs.io/en/stable/index.html) to build and host these docs, but they can also be built locally for testing. |
| 58 | +```sh |
| 59 | +cd sphinx/ |
| 60 | +make html |
| 61 | +``` |
| 62 | + |
| 63 | +The build output is in `sphinx/build/html/` but Sphinx does not provide a server. Here's a serving example using Python: |
| 64 | + |
| 65 | +```sh |
| 66 | +cd sphinx/build/html/ |
| 67 | +python3 -m http.server 8000 |
| 68 | +``` |
| 69 | + |
| 70 | + |
| 71 | +## Publishing |
| 72 | + |
| 73 | +The site is hosted on GitHub pages, automatically deployed using the Github [deploy-pages](https://github.com/actions/deploy-pages) action - see the |
| 74 | +[config file](https://github.com/pytorch/botorch/blob/main/.github/workflows/publish_website.yml) for details. |
0 commit comments