Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minimum payu version check #511

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

jo-basevi
Copy link
Collaborator

@jo-basevi jo-basevi commented Sep 16, 2024

Add a payu_minimum_version option to config.yaml. This runs a check at the start of the Experimet.setup comparing the current payu version and raises a RuntimeError if version is earlier than the configured minimum version.

I added a dependency on the packaging lib to parse and compare versions, which seems to the recommended library for parsing version strings (https://stackoverflow.com/a/11887885, https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html#prefer-setuptools). I could do some regex parsing, but this library can handle already handles versions like 1.0, v0.1, 1.0.0+4.gabc1234 etc. So hopefully it'll be less buggy and will be able to support future version formats..

I added the check to the start of the setup method to the experiment class which seemed the logical place for it at the moment. So unfortunately it's adding more logic to an already long file. I thought about adding a setup.py file for setup helper methods, but I am not sure whether that'll make it better having one file for one small function?

Closes #147

@coveralls
Copy link

coveralls commented Sep 16, 2024

Coverage Status

coverage: 56.106% (+0.3%) from 55.782%
when pulling a6bed42 on ACCESS-NRI:147-add-minimum-payu-version
into c07eeaf on payu-org:master.

@jo-basevi jo-basevi force-pushed the 147-add-minimum-payu-version branch from 1a50fed to 0ff4be5 Compare September 16, 2024 02:02
@jo-basevi jo-basevi marked this pull request as ready for review September 16, 2024 02:11
@jo-basevi jo-basevi self-assigned this Sep 16, 2024
@aidanheerdegen aidanheerdegen self-requested a review September 16, 2024 04:34
Copy link
Collaborator

@aidanheerdegen aidanheerdegen left a comment

Choose a reason for hiding this comment

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

Just a single change, but feel free to push back if you disagree.

payu/experiment.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@aidanheerdegen aidanheerdegen left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks Jo. merge if you're happy to do so.

@jo-basevi jo-basevi merged commit e59d400 into payu-org:master Sep 16, 2024
8 checks passed
@jo-basevi jo-basevi deleted the 147-add-minimum-payu-version branch September 16, 2024 23:23
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.

Require payu version
3 participants