Lfric macros update#222
Merged
Cameron Bateman (cameronbateman-mo) merged 13 commits intoMetOffice:mainfrom Apr 20, 2026
Merged
Conversation
Cameron Bateman (cameronbateman-mo)
approved these changes
Apr 20, 2026
Contributor
Cameron Bateman (cameronbateman-mo)
left a comment
There was a problem hiding this comment.
Changes look good, moving to approved.
cab3315
into
MetOffice:main
6 checks passed
Contributor
Pierre Siddall (Pierre-siddall)
left a comment
There was a problem hiding this comment.
Well done James, this mostly looks good just one small change to suggest to improve the readability of the code.
Comment on lines
271
to
+284
| if version is None: | ||
| self.version = re.search(r".*vn(\d+\.\d+)(_.*)?", tag).group(1) | ||
| self.version: str = re.search(r".*vn(\d+\.\d+)(_.*)?", tag).group(1) | ||
| else: | ||
| self.version = version | ||
| self.author = None | ||
| self.ticket_number = None | ||
| self.version: str = version | ||
| self.author: str | None = None | ||
| self.ticket_number: str | None = None | ||
| # All parsed macros per metadata section | ||
| self.parsed_macros = defaultdict(list) | ||
| self.parsed_macros: dict[list] = defaultdict(list) | ||
| # Parsed macro with desired after tag, per metadata section | ||
| self.target_macros = {} | ||
| self.meta_dirs = set() | ||
| self.sections_with_macro = [] | ||
| self.python_imports = set() | ||
| self.upgraded_core = False | ||
| self.target_macros: dict = {} | ||
| self.meta_dirs: set = set() | ||
| self.sections_with_macro: list = [] | ||
| self.python_imports: set = set() | ||
| self.upgraded_core: bool = False |
Contributor
There was a problem hiding this comment.
I reckon the type hints here can be removed as they don't provide more clarity on the data type of these variables given that the types can be easily derived by either the initialisation or previous logic in the function.
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.
PR Summary
Sci/Tech Reviewer: Cameron Bateman (@cameronbateman-mo)
Code Reviewer: Pierre Siddall (@Pierre-siddall)
This PR makes some general improvements to the lfric_macros repo:
I've tested this locally with a new upgrade macro in lfric and made sure that it correctly raises failures when expected. A test release using release_new_versions has also been done.
Once this is on I'll open an apps ticket to update the scripts version.
Code Quality Checklist
Testing
Security Considerations
AI Assistance and Attribution
Sci/Tech Review
(Please alert the code reviewer via a tag when you have approved the SR)
Code Review