Skip to content

Commit d6c3065

Browse files
CristianLarafacebook-github-bot
authored andcommitted
Update website documentation (#2914)
Summary: Pull Request resolved: #2914 X-link: facebook/Ax#4001 1. Fix instructions for building sphinx locally. The makefile was using an old destination from before we migrated to ReadTheDocs. This didn't affect ReadTheDocs or our own workflow tests (neither use the makefile) but correct documentation allows us to debug sphinx locally more easily. 2. Remove old and incorrect Ax website documentation in `CONTRIBUTING.md`. Remove this old documentation and instead point users to the docs in `website/README.md` 3. Add `website/README.md` to the botorch repo. This was mistakenly missing. Remove old botorch documentation from `CONTRIBUTING.md` and point to `website/README.md` same as the Ax repo. Reviewed By: Balandat Differential Revision: D77888215 fbshipit-source-id: 95aca46f5f3b74ba176c67b8e5ae92dd70e8df91
1 parent 4592367 commit d6c3065

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ code can be found in the [website](/website/) folder). It is built using
9696
[Sphinx](http://www.sphinx-doc.org), and embedded into the Docusaurus
9797
website. The sphinx .rst source files for this live in
9898
[sphinx/source](/sphinx/source/).
99-
3. The Jupyter notebook tutorials, parsed by `nbconvert`, and embedded into the
99+
3. The Jupyter notebook tutorials, parsed and converted to MDX, and embedded into the
100100
Docusaurus website. These live in [tutorials](/tutorials/).
101101

102102
To build the documentation you will need [Node](https://nodejs.org/en/) >= 8.x
@@ -108,6 +108,8 @@ The following command will both build the docs and serve the site locally:
108108
./scripts/build_docs.sh
109109
```
110110

111+
See the [website/README.md](website/README.md) for more details.
112+
111113
## Pull Requests
112114

113115
We actively welcome your pull requests.

website/README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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

Comments
 (0)