Skip to content

Refactor#200

Draft
yaswant wants to merge 6 commits intoMetOffice:mainfrom
yaswant:refactor
Draft

Refactor#200
yaswant wants to merge 6 commits intoMetOffice:mainfrom
yaswant:refactor

Conversation

@yaswant
Copy link
Collaborator

@yaswant yaswant commented Mar 1, 2026

PR Summary

Sci/Tech Reviewer:
Code Reviewer:

Modernise and refactor the repository.

Code Quality Checklist

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • Comments have been included that aid understanding and enhance the readability of the code
  • My changes generate no new warnings
  • All automated checks in the CI pipeline have completed successfully

Testing

  • This change has been tested appropriately (please describe)

Security Considerations

  • I have reviewed my changes for potential security issues
  • Sensitive data is properly handled (if applicable)
  • Authentication and authorisation are properly implemented (if applicable)

AI Assistance and Attribution

  • Some of the content of this change has been produced with the assistance of Generative AI tool name (e.g., Met Office Github Copilot Enterprise, Github Copilot Personal, ChatGPT GPT-4, etc) and I have followed the Simulation Systems AI policy (including attribution labels)

Code Review

  • All dependencies have been resolved
  • Related Issues have been properly linked and addressed
  • Code quality standards have been met
  • Tests are adequate and have passed
  • Security considerations have been addressed
  • Performance impact is acceptable

Copy link
Collaborator

@james-bruten-mo james-bruten-mo left a comment

Choose a reason for hiding this comment

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

Thanks Yash, looks good.
The only thing I'm concerned about is removing the Optional and Union typing imports as we've recently hit issues with python versions not being up to date enough.

import re
import subprocess
from datetime import datetime
from typing import Optional, Union
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we leave this as using the old Optional and Union statements for the time being. We've already seen python compatibility issues for this in this file

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, I see that os46-3 stack is still using Python 3.7.

To make future tidying easier, would it work if we add the annotation import from future, rather than keeping the legacy imports?

from __future__ import annotations

Its probably only useful to fix type annotations, not runtime logic.

import yaml
from collections import defaultdict
from pathlib import Path
from typing import Dict, List, Optional, Set, Union
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above (although I think Dict and List changes are an earlier python, so maybe they can stay)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

list, dict, set, tuple are supported natively since Python 3.9 deprecating the capitalise aliases from typing module.

from contextlib import contextmanager
from pathlib import Path
from tempfile import mkdtemp
from typing import Dict, List, Set, Tuple
Copy link
Collaborator

Choose a reason for hiding this comment

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

And again

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