Skip to content

ENH: Build/tooling housecleaning ahead of FEM removal and ITKv6 content updates#236

Open
hjmjohnson wants to merge 8 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:add-pixi-and-precommit-tooling
Open

ENH: Build/tooling housecleaning ahead of FEM removal and ITKv6 content updates#236
hjmjohnson wants to merge 8 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:add-pixi-and-precommit-tooling

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

Preparatory build/tooling housecleaning ahead of two follow-up efforts: removing the FEM references from the Software Guide, and updating the guide content for ITKv6. This PR changes no book prose; it modernizes how the guide is built, tested, and rendered so that the content work lands on a clean, reproducible foundation.

No reviewer action is required beyond a normal review — there are no behavioral changes to the published books (both PDFs render byte-for-byte as before).

What's included (8 commits)
  • pixi reproducible build — conda-forge pixi workspace; pixi run build runs the SuperBuild end to end (ITK + tooling + both PDFs). ccache is instrumented (CMAKE_*_COMPILER_LAUNCHER=ccache, CCACHE_BASE_DIR=$PWD/build) for fast rebuilds.
  • pre-commit hooks — whitespace/EOF/merge-conflict checks, an advisory chktex LaTeX lint (ignore-policy carried over from Utilities/latex_linter.sh), and the DOC:/ENH:/BUG:/… commit-prefix gate reusing the existing Utilities/Hooks/commit-msg.
  • SuperBuild CMake modernization — drop the retired git:// protocol option (use https), fix a CMAKE_CX_FLAGSCMAKE_CXX_FLAGS typo, remove dead CMAKE_VERSION < 2.8.9 / DARWIN_MAJOR_VERSION < 9 guards.
  • Standardize on ITK 6 — unify the ITK requirement (was a mix of 4/5/6 while the SuperBuild builds v6.0b02); drop the deprecated include(${ITK_USE_FILE}).
  • More CMake cleanup — remove redundant cmake_policy(VERSION) calls, migrate FindPythonInterpFindPython3, fix Cover/Source to link ${ITK_LIBRARIES}.
  • ImageMagick 7 — resolve magick via find_program and convert via the magick convert subcommand (drops the IM6 dependency).
  • CI → pixi on ubuntu-latestsetup-pixi for ImageMagick 7 / ghostscript / Pygments / cmake / ninja, plus apt texlive-latex-extra for a real LaTeX, replacing the old IM6 + policy.xml workaround.
Verification
  • macOS: full clean pixi run build is green; both PDFs render at the expected sizes. ccache hot-rebuild measured at ~99.98% hit rate.
  • Linux (real box): caught and fixed a latent bug — conda-forge texlive-core is engine-only (no LaTeX packages), which all macOS builds had masked via system MacTeX. The fix (system TeX + pixi for IM7/Pygments) was verified on a Linux host: pdflatex resolves to the system, magick/pygmentize to the pixi env, and a minted document compiles to PDF.
  • GitHub Actions: the full apt-TeX + setup-pixi flow on ubuntu-latest is exercised for the first time by this PR's CI run.
Scope notes
  • This PR intentionally does not run pre-commit run --all-files; the repository has never had pre-commit, so a full sweep would reformat the entire legacy guide and bury the tooling changes. Only the files touched here are hook-clean. A separate mass-format pass can follow.
  • setup-pixi is pinned to the v0.9.6 release tag (a SHA pin was considered; the tag was chosen for readability).

Provide a conda-forge-backed pixi workspace so the books and tooling build
from a single locked environment. 'pixi run build' runs the SuperBuild
configure and build in one step; 'pixi run -e pre-commit ...' drives the
hooks. A full TeX distribution on conda-forge exists only as the linux-only
texlive-core, so macOS/Windows builds rely on a system TeX (MacTeX/MiKTeX)
on PATH.
Add whitespace/EOF/large-file/merge-conflict content hooks, an advisory
per-file chktex LaTeX lint carrying the ignore-code policy from
latex_linter.sh, and a commit-msg-stage check reusing the authoritative
Utilities/Hooks/commit-msg prefix rule.
The interpreter line read /usr/bin/evn bash, so invoking the script
directly failed to exec.
- Use https for external git clones; remove the USE_GIT_PROTOCOL option
  (the git:// protocol was retired by GitHub) and its now-dead -D flag from
  the pixi configure task and CI.
- Fix CMAKE_CX_FLAGS -> CMAKE_CXX_FLAGS typo so the HDF5 -fopenmp strip
  actually applies to the ITK C++ flags.
- Remove dead guards: CMAKE_VERSION VERSION_LESS 2.8.9 and the
  DARWIN_MAJOR_VERSION < 9 (Mac OSX 10.5) platform checks, both
  unreachable under the 3.22.1 minimum.
Unify the ITK requirement on major version 6 across the SuperBuild and
Phase II (was a mix of 4, 5, and 6 while the SuperBuild builds v6.0b02),
and update the CreateAModule book example to match. Remove the legacy
include(${ITK_USE_FILE}) from the system-ITK fallback; modern ITK is
consumed via imported targets after find_package, so the use-file global
include/flag injection is unnecessary. Use the COMPONENTS keyword for the
ITKReview request.
- Drop redundant cmake_policy(VERSION) calls that duplicate the version
  already set by cmake_minimum_required.
- Replace the deprecated FindPythonInterp module (PYTHON_EXECUTABLE,
  PYTHONINTERP_FOUND) with FindPython3 (Python3_EXECUTABLE) for the
  example-running and LaTeX-extraction scripts.
- Bump Cover/Source minimum to 3.22.1 and link via the standard
  ${ITK_LIBRARIES} instead of the non-standard ${ITK_INTERFACE_LIBRARIES}.
Resolve ImageMagick with find_program(NAMES magick REQUIRED) (ImageMagick 7
only; drop IM6) and invoke EPS conversion through the 'magick convert'
subcommand. IM7's bare 'magick' parser rejects image operators placed before
the input (e.g. -flip), whereas the 'convert' subcommand accepts the existing
operator-before-input ordering used by the figure-conversion commands.
Replace the apt-installed toolchain (texlive, ghostscript, ImageMagick 6 plus
the policy.xml read|write workaround) with 'pixi run build', so CI uses the
same conda-forge environment as local builds: ImageMagick 7, ghostscript,
Pygments, and a Linux texlive. Removes the IM6-specific policy hack and the
manual dependency list.
@github-actions github-actions Bot added type:Enhancement Improvement of existing methods or implementation area:DevelopmentGuidelines Issues affecting the Development Guidelines part area:Examples Issues affecting the ITK Examples scraper area:Cover Issues affecting the Cover language:LaTeX Changes to LaTeX code type:Artwork Changes to artwork files type:BookStyle Changes to book style files type:Infrastructure labels Jun 26, 2026
@hjmjohnson

Copy link
Copy Markdown
Member Author

Motivated by : InsightSoftwareConsortium/ITK#6524

@hjmjohnson hjmjohnson requested a review from dzenanz June 26, 2026 19:34
@hjmjohnson hjmjohnson marked this pull request as ready for review June 26, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Cover Issues affecting the Cover area:DevelopmentGuidelines Issues affecting the Development Guidelines part area:Examples Issues affecting the ITK Examples scraper language:LaTeX Changes to LaTeX code type:Artwork Changes to artwork files type:BookStyle Changes to book style files type:Enhancement Improvement of existing methods or implementation type:Infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant