Fix NCDatasets extension for Julia 1.12#126
Closed
ewquon wants to merge 1 commit into
Closed
Conversation
Move the method definition for `default_output_attributes(::SeaIceModel)`
from `__init__()` with `@eval` to top-level extension scope. Julia 1.12
rejects `eval` into a closed module during `__init__`, causing
precompilation to fail with:
"Evaluation into the closed module ClimaSeaIceNCDatasetsExt breaks
incremental compilation because the side effects will not be permanent."
The method is now defined at extension load time, which is both correct
and compatible with Julia 1.12's stricter compilation model.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Apr 1, 2026
Comment on lines
+31
to
+36
| OCNE = Base.get_extension(Oceananigans, :OceananigansNCDatasetsExt) | ||
| if !isnothing(OCNE) | ||
| function OCNE.default_output_attributes(model::SeaIceModel) | ||
| velocity_attrs = default_horizontal_velocity_attributes(model.grid) | ||
| tracer_attrs = default_sea_ice_attributes() | ||
| return merge(velocity_attrs, tracer_attrs) |
Collaborator
There was a problem hiding this comment.
This will not work because the extension is not loaded at compile time. We need CliMA/Oceananigans.jl#5469 and then extend the function in output_writers
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
default_output_attributes(::SeaIceModel)method definition from__init__()with@evalto top-level extension scopeevalinto a closed module during__init__, causing precompilation to fail with: "Evaluation into the closed moduleClimaSeaIceNCDatasetsExtbreaks incremental compilation because the side effects will not be permanent."Test plan
Pkg.precompile()succeeds on Julia 1.12 with this patch🤖 Generated with Claude Code