Skip to content

Add instructions for headless docs build on Wayland #781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ prep-stubs:
docs-build: prep-docs
NAPARI_CONFIG="" NAPARI_APPLICATION_IPY_INTERACTIVE=0 sphinx-build -M html docs/ docs/_build -WT --keep-going -D sphinx_gallery_conf.examples_dirs=$(GALLERY_PATH) $(SPHINXOPTS)

# build docs with xvfb (headless X server)
docs-xvfb: prep-docs
NAPARI_CONFIG="" NAPARI_APPLICATION_IPY_INTERACTIVE=0 xvfb-run --auto-servernum sphinx-build -M html docs/ docs/_build -D sphinx_gallery_conf.examples_dirs=$(GALLERY_PATH) $(SPHINXOPTS)

# build docs with xwfb (headless X server with Wayland support)
docs-xwfb: prep-docs
NAPARI_CONFIG="" NAPARI_APPLICATION_IPY_INTERACTIVE=0 xwfb-run -- sphinx-build -M html docs/ docs/_build -D sphinx_gallery_conf.examples_dirs=$(GALLERY_PATH) $(SPHINXOPTS)

# full docs (re)build
# cleans everything, starts from scratch
html: clean clean-gallery docs-build
Expand Down
40 changes: 31 additions & 9 deletions docs/developers/contributing/documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,17 +452,39 @@ Note: using `-j4` will parallelize the build over 4 cores and can result in cras

````

````{tip}
If you have [xvfb](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml)
installed on your system, you can also run a "headless GUI" build by using the
`docs-xvfb` command:
````{admonition} Headless GUI builds
:class: tip

```bash
make docs-xvfb
```
If you are running a full build, you can run it in a "headless GUI"
mode, which will prevent napari windows from popping up during the build.

1. If you are using X11 as your display server and you have
[xvfb](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml)
installed on your system, you can use the `docs-xvfb` command:

```bash
make docs-xvfb
```

This will prevent all but the first napari window from being shown during the docs
build.

2. If you are using Wayland as your display server, and you have `xwfb-run` installed
on your system (part of the [xwayland-run utilities](https://gitlab.freedesktop.org/ofourdan/xwayland-runcan),
you can use the `docs-xwfb` command:

```bash
make docs-xwfb
```

Note that you may have to install the `xwayland-run` package manually so that it
uses the correct Python environment you are using to build the docs. You can do that
by cloning the sources from [the xwayland-run GitLab repository](https://gitlab.freedesktop.org/ofourdan/xwayland-run) and running:

This will prevent all but the first napari window from being shown during the docs
build.
```bash
meson setup -Dcompositor=weston --prefix=/path/to/env/ -Dpython.install_env=prefix . build
meson install -C build
```
````

(building-what-you-need)=
Expand Down