Closed anton-seaice closed 3 months ago
Thanks for creating this issue! Yeah it looks like it is treating FutureWarning as an exception.
@aidanheerdegen @blimlim, do we want to support loading environment variables from both um_env.py
and um_env.yaml
and so change the exception to a warning? If so, I have some changes in this branch that I think will implement that though will need to test it before opening a PR.
From what I remember at the time when discussing with @aidanheerdegen, it sounded like the best option was to deprecate the old um_env.py
file rather than keeping support for it due to security issues with sourcing a python file, and so the desired behaviour was for um_env.py
to no longer work with the latest release, and for an exception rather than warning to be raised. @aidanheerdegen just wanted to check whether this sounds right to you.
I'm not too good with all the different exception/warning types, but it seemed like raising a FutureWarning
as an exception was the best option for raising an error about an already deprecated feature, though definitely agree that any ways we can make it a bit clearer would be great!
Oh I see! If its trying to be an exception then we should raise an Error rather than a warning !
Ok, would a RuntimeError
make sense? I am not sure of the best standard error types for deprecated features either
Oh I see! If its trying to be an exception then we should raise an Error rather than a warning !
Good idea!
Ok, would a
RuntimeError
make sense?
I think that sounds ok!
I just noticed a typo in the error message I'd written - should be "replaced" not "relplaced" :( .... If we are fixing this up anyway, do you think there are any changes that could make it a bit clearer? I'm wondering whether "... configuration file is no longer supported" is clearer than "... has been deprecated", or do you think it's much the same?
Yeah I think "no longer supported" makes more sense, as deprecated usually means it will be eventually removed in future releases but can still be used.
Thanks to @hrdawson for spotting this.
When running esm1.5 using payu 1.1.4, payu setup fails at this line:
https://github.com/payu-org/payu/blob/83001a2b45ef786e178894f77dd9fbc0878e73c1/payu/models/um.py#L119
This is because FutureWarning is not imported.
Also the text is slightly unclear ... I think we expect
um_env.py
configuration to still work, so the warning text should be in the future tense (will be deprecated)