-
Notifications
You must be signed in to change notification settings - Fork 39
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
Implement importable config object in experimental API submodule #868
Conversation
In Py3.8 it is OK to use `lru_cache` without parentheses, so Py3.7: `@lru_cache()`, Py3.8: `@lru_cache`
Some feedback that is still relevant from @Peter9192 from #785 :
Answer: The rest of esmvalcore expects the config to be like a dict, so we inherit from
Answer: Agreed. What you say makes sense, and it something that is already possible. However, ESMValCore depends on having some of these available in some places in the code. I would rather not mess with the config variables yet in this PR. |
The last version was a bad idea mixing *args/**kwargs with a name arg, now the intention is more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks @stefsmeets!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like 👍
One more thing: maybe we can print (on import?) that this is still in development and subject to frequent changes? |
This will prevent undefined behaviour, because some values must be checked/validated which is now done in main, which may not always happen
Would it be an idea to call the new module |
Co-authored-by: Bouwe Andela <b.andela@esciencecenter.nl>
It would also be great if you could have a look at the Codacy warnings |
By default, drs and rootpath are not defined, so we must have some mechanism to warn users early that their config is not complete.
This works well... although that said, IPython uses a different mechanism altogether 🤦♂️ |
Hi all, we started working on an importable config object. This PR can be used to track the progress. For more discussion see this issue: #498
This PR is a second attempt at implementing an importable config object, since #785 became 'too big to review'.
For this PR, I have kept the implementation completely separate from the current codebase in the
future
directory. In that case we can move faster, as the API will be somewhat experimentaland likely to change. Any useful bits can easily be moved down once we start to depen.config-user
valid by default. At present, users will have to update the config-user in order to do any work..esmvaltool/config-user.yml
does not exist, it will default to the one from the codebase.For a demonstration of the implementation, see this notebook here: https://gist.github.com/stefsmeets/dccd59d8c1f11768a9a5f297d7faeaab
Tasks
yamllint
to check that your YAML files do not contain mistakesIf you need help with any of the tasks above, please do not hesitate to ask by commenting in the issue or pull request.
Described by #498
Successor of #785
Documentation: https://esmvaltool--868.org.readthedocs.build/projects/ESMValCore/en/868/api/esmvalcore.api.html