|
| 1 | +# Documentation Publishing |
| 2 | + |
| 3 | +How the reference docs at https://weaviate-python-client.readthedocs.io/ are built, how the `weaviate-agents-python-client` is folded in, and how to publish a staging preview for a branch. |
| 4 | + |
| 5 | +For authoring guidance (adding modules, regenerating `.rst` files, building locally), see [README.rst](./README.rst). |
| 6 | + |
| 7 | +## What publishes the docs |
| 8 | + |
| 9 | +Read the Docs (RTD), not GitHub Actions. RTD is configured to watch this repo and rebuild on every push to a tracked branch or tag. The CI workflow at `.github/workflows/main.yaml` only runs `python -m sphinx ...` as a sanity check — it never publishes anything. |
| 10 | + |
| 11 | +Project dashboard: https://readthedocs.org/projects/weaviate-python-client/ |
| 12 | + |
| 13 | +## Build configuration |
| 14 | + |
| 15 | +Two files control the build: |
| 16 | + |
| 17 | +- **`.readthedocs.yaml`** — RTD build config (Python version, `pre_build` hooks, requirements file, Sphinx entry point). |
| 18 | +- **`docs/conf.py`** — Sphinx config (extensions, theme, autodoc behavior, docstring post-processing). |
| 19 | + |
| 20 | +Build steps RTD runs, in order: |
| 21 | + |
| 22 | +1. Spin up an Ubuntu 22.04 image with Python 3.12 (per `.readthedocs.yaml`). |
| 23 | +2. Run the `pre_build` hook (see next section — this is where the agents client gets pulled in). |
| 24 | +3. `pip install -r requirements-devel.txt`. |
| 25 | +4. `python -m sphinx -b html docs/ <output>` using `docs/conf.py`. |
| 26 | +5. Publish the HTML to `https://weaviate-python-client.readthedocs.io/en/<version-slug>/`. |
| 27 | + |
| 28 | +## How the agents client is folded in |
| 29 | + |
| 30 | +The `weaviate-agents-python-client` lives in its own repo (https://github.com/weaviate/weaviate-agents-python-client) but its API reference is published as part of the same RTD site. |
| 31 | + |
| 32 | +This is wired up in `.readthedocs.yaml` via a `pre_build` hook: |
| 33 | + |
| 34 | +```yaml |
| 35 | +build: |
| 36 | + jobs: |
| 37 | + pre_build: |
| 38 | + - git clone -b main --depth=1 https://github.com/weaviate/weaviate-agents-python-client.git docs/weaviate-agents-python-client |
| 39 | + - python -m pip install -e ./docs/weaviate-agents-python-client |
| 40 | +``` |
| 41 | +
|
| 42 | +And `docs/conf.py` adds the cloned directory to `sys.path`: |
| 43 | + |
| 44 | +```python |
| 45 | +sys.path.insert(0, os.path.abspath("weaviate-agents-python-client")) |
| 46 | +``` |
| 47 | + |
| 48 | +Implications: |
| 49 | + |
| 50 | +- The agents docs always come from the agents repo's `main` branch — pinning to a tag would require editing `.readthedocs.yaml`. |
| 51 | +- Changes merged to the agents repo's `main` are **not** automatically published here. The published version updates when either (a) a new release of `weaviate-python-client` is cut, or (b) a maintainer manually triggers a rebuild from the RTD dashboard. |
| 52 | +- The agents repo has its own `docs/` tree (with its own `index.rst`, etc.). After cloning, RTD's Sphinx build picks up those `.rst` files because they sit under `docs/weaviate-agents-python-client/docs/`, which Sphinx walks as part of the source tree. |
| 53 | + |
| 54 | +## Publishing a staging build for a branch |
| 55 | + |
| 56 | +Add the branch as a Version in RTD: |
| 57 | + |
| 58 | +1. Open https://readthedocs.org/projects/weaviate-python-client/versions/. |
| 59 | +2. Click **+ Add version**, pick the branch from the dropdown (hit the refresh icon if it's not listed yet — RTD polls GitHub for new branches). |
| 60 | +3. Tick **Active**. Leave **Hidden** ticked if you don't want the branch to show up in the version switcher on the public site (you'll still get a direct URL). |
| 61 | +4. Click **Update version**. RTD kicks off a build immediately. |
| 62 | + |
| 63 | +Watch the build on the **Builds** tab. Once it succeeds, the preview is at: |
| 64 | + |
| 65 | +``` |
| 66 | +https://weaviate-python-client.readthedocs.io/en/<branch-slug>/ |
| 67 | +``` |
| 68 | + |
| 69 | +RTD slugifies the branch name — slashes become dashes (e.g. `docs/suppress-overload-stacking` → `docs-suppress-overload-stacking`). |
| 70 | + |
| 71 | +When you're done, deactivate the version on the same page so it stops rebuilding on every push to that branch. |
0 commit comments