Repository navigation
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2177 +/- ##
==========================================
- Coverage 77.45% 77.41% -0.05%
==========================================
Files 470 473 +3
Lines 57184 57248 +64
Branches 9195 9195
==========================================
+ Hits 44292 44318 +26
- Misses 9823 9861 +38
Partials 3069 3069 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
97bf782 to
086b347
Compare
086b347 to
c5d60c1
Compare
speth
left a comment
There was a problem hiding this comment.
Thanks for continuing to work on the Matlab toolbox installation, @ssun30. Can you help explain how these additions contribute to the goal of a "one click" install experience for toolbox installation and removal? For instance, are the install and uninstall functions ones that will be called automatically by the installer? If so, it would be helpful to explain that in the docstrings for these methods. Otherwise, they seem like mostly unnecessary overhead if the user has to call these manually.
I'm also a little confused about how you're planning for the data files to be distributed here. If they're included with the Matlab toolbox, then they should be installed to a location that is known relative to the toolbox itself, right? In that case, ct.load should already be able to add the data directory based on the relative path to itself, right? This is what the Python module does.
I don't really understand the role of the build_cantera_library.py script. This seems like an extra layer of indirection over just running scons with the appropriate options as part of a GitHub Actions job. And even if you want to break it off as a script, there's a lot of stuff going on in there that seems unnecessary if the point is that this is a script run as part of an Actions job rather than by a user on their local machine. If this is more of a "it works, just don't look at the messy internals" thing, maybe it would be better to have this step be part of the toolbox build itself and live in that repository.
Add a utility function that adds directories to Cantera's search path for data files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The MLTBX ships the compiled interface for each platform together with a self-contained Cantera library and the Cantera data files. Users no longer need a separate Cantera installation or to launch MATLAB from a Conda environment. - ct.install sets the toolbox up once: it saves the data directory shipped with the toolbox (or one given as DataDirectory) as a MATLAB preference and verifies that Cantera loads. Later calls do nothing unless the installation is incomplete or Force is true. - ct.uninstall unloads Cantera and removes the saved preferences, so the toolbox can then be removed in the Add-On Manager. - ct.load requires the interface built for the current platform, adds its folder to the MATLAB path and to the dynamic loader path, and re-adds the data directory saved by ct.install. - ct.isLoaded returns false instead of an error when the interface is not on the MATLAB path. - ctLib becomes a private function, and ct.unload warning identifiers use the 'ct:unload:' form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the scripts the cantera_matlab toolbox uses to build its library to interfaces/matlab/buildUtilities: the library is built with all third-party dependencies vendored and linked statically, and audited for non-system dependencies. The toolbox stages these scripts with the rest of interfaces/matlab and leaves them out of the packaged MLTBX. The new 'matlab-library' job builds this library on each OS image, and 'matlab-bundled' runs the same matrix and tests as the 'matlab' job with it, without installing third-party runtime libraries or preloading OpenBLAS/LAPACK. The existing job can be skipped by setting the repository variable SKIP_MATLAB_SYSTEM_LIBS to 'true'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
R2024b is the oldest release supported by the MATLAB toolbox, so test it on every OS image without excluded combinations, installing the Visual C++ 2022 build tools it needs on windows-2025. The library is no longer needed on windows-2022. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The self-contained library has no third-party runtime dependencies, so it should load in-process on every platform, including Linux, where the library built with system dependencies cannot. Load it in-process before running the tests, which then use the loaded library. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With MATLAB R2026b, the clibgen build command on macOS no longer includes a -std flag. With Xcode 15, clang then defaults to C++98 and fails to compile the MATLAB Data API headers, breaking the "MATLAB latest on macos-14" CI job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The interface is built with the system compiler, whose libstdc++ can be newer than the one MATLAB ships. MATLAB R2024b ships the libstdc++ from GCC 12 (up to GLIBCXX_3.4.30), while an interface built with GCC 13 needs GLIBCXX_3.4.32, so it only loaded with the system libstdc++ preloaded. Linking libstdc++ and libgcc statically removes that dependency; the interface loads and passes the tests in-process on R2024b and R2026b without LD_PRELOAD. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the interface and the Cantera library both linked statically against libstdc++, the tests no longer need the system libstdc++ preloaded. Only building the interface still needs it on Linux, where MATLAB R2024b crashes while generating the interface otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MATLAB is tested with the self-contained library that ships with the MATLAB toolbox instead, in the 'matlab-bundled' job. The disabled job is to be removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c5d60c1 to
25ca0e2
Compare
The toolbox installer cannot run code, so ct.install and ct.uninstall would always be manual steps. Like the Python module, ct.load now adds the data files found relative to the toolbox, so no setup or saved preferences are needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run scons with the self-contained build options instead of the build script, which moves to the MATLAB toolbox repository, and build the interface against the in-tree library. The bundled jobs move from the retired macos-14 runners to macos-15 and macos-26, and no longer set CANTERA_DATA, so they test that ct.load finds the data files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The old MATLAB job, already disabled, built the interface against a Cantera library with system dependencies. It is removed, and the job that tests the self-contained library shipped with the MATLAB toolbox takes over its name.
Thanks for the review @speth . You were right on all three points and I've changed them accordingly.
The |
Changes proposed in this pull request
The MATLAB toolbox is being packaged for MATLAB File Exchange from a separate repository. The package bundles the data files, and MATLAB downloads a self-contained Cantera library (all third-party dependencies statically linked) alongside the compiled interface at install time. This PR adds the MATLAB-side setup for that distribution:
ct.install: a one-time setup that moves the downloaded interface into the toolbox, adds it to the saved MATLAB path, registers the bundled data directory as a persistent preference, and verifies that Cantera loads.ct.uninstall: unloads Cantera and removes the saved path entry and preferences, to be run before removing the toolbox in the Add-On Manager.ct.loadnow puts the interface folder (which also holds the Cantera shared library) on the OS loader path and re-registers the data directory saved byct.install.ct.addDataDirectories.%and\in messages are preserved;ReactorNettolerance setters usemReactornet_setTolerances; warning identifiers inct.unloaduse a valid format; two tests are updated to match current messages and limits.If applicable, fill in the issue number this pull request is fixing
Replaces #2146 since it covers a broader list of changes.
If applicable, provide an example illustrating new features this pull request is introducing
This is a pre-requisite for https://github.com/ssun30/cantera_matlab to move out of pre-alpha stage as it introduces the necessary changes to achieve a true one-click install experience for MATLAB users.
AI Statement (required)
Extensive use of generative AI. ct.install, ct.uninstall, and the changes to
ct.loadandct.isLoadedwere written with an agentic coding tool (Claude Code) from a design I specified: what each function does and how preferences and paths are handled. The tool made implementation decisions, such as removing the prompt-based configuration in favor of a fully automated process running in the background. I reviewed all generated code and tested install, load, reload across MATLAB restarts, and uninstall manually on Windows with MATLAB R2024b.Checklist
scons build&scons test) and unit tests address code coverage