Skip to content

Add gmsh installation for docs build#148

Merged
ThomasPluck merged 3 commits into
mainfrom
add-gmsh-install
Apr 19, 2026
Merged

Add gmsh installation for docs build#148
ThomasPluck merged 3 commits into
mainfrom
add-gmsh-install

Conversation

@joamatab
Copy link
Copy Markdown
Contributor

@joamatab joamatab commented Apr 17, 2026

Summary

  • Adds a gmsh Makefile target that installs gmsh and its dependencies (libglu1-mesa, libxi-dev, libxmu-dev)
  • Makes docs-clean depend on gmsh so the docs build environment has the required meshing tools

Test plan

  • Verify make docs succeeds in CI with gmsh available

Summary by Sourcery

Add a Makefile target to install gmsh and its system dependencies and ensure the docs-clean step prepares a docs build environment with gmsh available.

Build:

  • Add a gmsh Makefile target that installs gmsh and its required system libraries via apt-get.
  • Make the docs-clean target depend on gmsh so documentation builds run with gmsh preinstalled.

Install gmsh and its dependencies as a prerequisite for docs-clean,
ensuring the docs build environment has the required meshing tools.
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 17, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a dedicated Makefile target to install gmsh and its system dependencies, and wires it into the docs-clean/docs build flow so that documentation builds have the required meshing tools available.

Flow diagram for updated docs build Makefile targets

flowchart TD
    A[make docs] --> B[docs-clean target]
    B --> C[gmsh target]
    C --> D[apt-get update]
    D --> E[apt-get install python3-gmsh]
    D --> F[apt-get install gmsh]
    D --> G[apt-get install libglu1-mesa]
    D --> H[apt-get install libxi-dev]
    D --> I[apt-get install libxmu-dev]
    D --> J[apt-get install libglu1-mesa-dev]
    B --> K[rm -rf docs/_build]
Loading

File-Level Changes

Change Details Files
Introduce a gmsh installation target and make docs-clean depend on it so docs builds run with gmsh and its dependencies installed.
  • Add a gmsh Makefile target that runs apt-get update and installs python3-gmsh, gmsh, and required X/Mesa libraries
  • Change docs-clean to depend on the gmsh target to ensure gmsh is installed before cleaning docs build artifacts
  • Keep docs target depending on docs-clean so that docs builds implicitly trigger gmsh installation when needed
Makefile

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • Having the gmsh target run sudo apt-get assumes a Debian-based system with sudo available; consider moving system package installation to your CI/bootstrap scripts or a clearly separated setup target so the Makefile remains usable in non-privileged and non-Debian environments.
  • Making docs-clean depend on gmsh causes every docs clean to trigger package installation; consider depending on gmsh from docs (or a dedicated docs-setup target) instead so that cleaning the build directory doesn't imply system-level changes.
  • Running apt-get update inside the gmsh target each time can be slow and flaky; consider either removing it in favor of CI-level cache management or guarding the target so it only installs when the packages are missing.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Having the `gmsh` target run `sudo apt-get` assumes a Debian-based system with sudo available; consider moving system package installation to your CI/bootstrap scripts or a clearly separated setup target so the Makefile remains usable in non-privileged and non-Debian environments.
- Making `docs-clean` depend on `gmsh` causes every docs clean to trigger package installation; consider depending on `gmsh` from `docs` (or a dedicated `docs-setup` target) instead so that cleaning the build directory doesn't imply system-level changes.
- Running `apt-get update` inside the `gmsh` target each time can be slow and flaky; consider either removing it in favor of CI-level cache management or guarding the target so it only installs when the packages are missing.

## Individual Comments

### Comment 1
<location path="Makefile" line_range="35-37" />
<code_context>
 	python -m build

-docs-clean:
+gmsh:
+	sudo apt-get update
+	sudo apt-get install -y python3-gmsh gmsh libglu1-mesa libxi-dev libxmu-dev libglu1-mesa-dev
+
+docs-clean: gmsh
</code_context>
<issue_to_address>
**issue:** Running `sudo apt-get` inside a make target can break non-root or CI usage.

This target assumes `sudo` is available and that the system uses `apt-get`, which will fail or be disallowed in many CI/container/non-root environments and can cause side effects when running `make`. Please either treat these as documented manual prerequisites, move them to a separate setup script, or gate this target behind an explicit opt-in flag (e.g. `ENABLE_SYSTEM_INSTALL=1`).
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread Makefile Outdated
Comment on lines +35 to +37
gmsh:
sudo apt-get update
sudo apt-get install -y python3-gmsh gmsh libglu1-mesa libxi-dev libxmu-dev libglu1-mesa-dev
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Running sudo apt-get inside a make target can break non-root or CI usage.

This target assumes sudo is available and that the system uses apt-get, which will fail or be disallowed in many CI/container/non-root environments and can cause side effects when running make. Please either treat these as documented manual prerequisites, move them to a separate setup script, or gate this target behind an explicit opt-in flag (e.g. ENABLE_SYSTEM_INSTALL=1).

Base automatically changed from chore/sync-pages-template to main April 17, 2026 21:11
ThomasPluck and others added 2 commits April 19, 2026 06:07
Re-run check-template-drift pre-commit hook to rewrite `secrets: inherit`
to explicit per-workflow secret forwarding, matching the upstream
pdk-ci-workflow template. uv.lock regenerated to reflect the current
gdsfactory~=9.40.1 pin in pyproject.toml.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The palace_demo_microstrip notebook calls sim.plot_mesh() which invokes
pyvista.Plotter(off_screen=True); without OSMesa or EGL system libraries
VTK fails to initialize a GL context and the kernel segfaults, aborting
the Sphinx build. Adding libosmesa6 and libegl1 to the gmsh apt-get line
provides the software GL stack required for headless rendering.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ThomasPluck ThomasPluck merged commit 3b997bd into main Apr 19, 2026
8 checks passed
@ThomasPluck ThomasPluck deleted the add-gmsh-install branch April 19, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants