-
Notifications
You must be signed in to change notification settings - Fork 38
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
Supported integer suffix for step headings in the user config file - config_reader
#473
Conversation
Parses ['headerone.1'] as [headerone] This config file can be written or loaded by any standard compliant toml library.
Codecov Report
@@ Coverage Diff @@
## main #473 +/- ##
==========================================
+ Coverage 74.66% 74.78% +0.12%
==========================================
Files 105 105
Lines 6926 6963 +37
==========================================
+ Hits 5171 5207 +36
- Misses 1755 1756 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Hi @sverhoeven Good addition! The only caveat I see on this is the difference between the two config styles for users. But I perfectly understand the restraints required by the web interface. It's just a matter that in the official examples we advertise only the one without integers. FYI, we have already a config writer module in case it helps you. Some technical aspect I am trying to sort out is that our config requires the multiline lists to have an empty line afterwards. I think I need to sort that out before this PR can go in because Another thing, you also need to operate in this function: haddock3/src/haddock/gear/config_reader.py Line 378 in 7d4bb34
You need to And, I think this is all. 😉 p.s. - an alternative would that the web interface create a toml string (internally) and then quickly remove the header integers before saving the string to the file. I don't know if this is possible in the web interface. But, it's an idea. With the python Cheers, |
Had to use separate regexps to make sure digit in config file is disregarded.
The test_read_config test has been expanded to test mix of "with index" and "without index". haddock3 and the workflow-builder both need to read and write config files. |
Okay, I will accommodate that. We can have:
Sounds good? Internally, the dictionaries entering the haddock3/src/haddock/gear/config_writer.py Line 106 in 7d4bb34
for example: >>> get_module_name("topoaa.1")
"topoaa" |
Thanks for the contribution @sverhoeven, having haddock3 support toml out of the box will be very helpful for future integrations! |
@joaomcteixeira are you working on this or should I try? |
You can work on it. |
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.
I have now reviewed this pull request. Sorry for the long delay, as it was still "draft" I thought it was still a work in progress. It seems very okay to merge. Thanks!
I would leave this for another Pull Request following #518 We can work with |
config_reader
lint issues above are addressed here: #523 |
Thanks for fixing the linting errors, I have merged main and now CI and |
Hi @sverhoeven a quick question before merging. Why do the headers need to be quoted to have the indexes? Is it because to avoid conflicts with parameters that are dictionaries? If so, I think we can safely edit the regexes because no parameters start with digits. Let me know, Cheers. |
TOML libraries treat For example [foo]
x = 1
['foo.1']
x = 2
[bar]
y = 1
[bar.1]
y = 2 will be parsed as {
"foo": {"x": 1},
"foo.1": {"x": 2},
"bar": {
"y": 1,
"1": {"y": 2}
}
} Having |
Co-authored-by: Stefan Verhoeven <stefan.verhoeven@gmail.com>
closed by #539 |
You are about to submit a new Pull Request. Before continuing make sure you read the contributing guidelines and you comply with the following criteria:
tox
tests pass. Runtox
command inside the repository folder-test.cfg
examples execute without errors. Insideexamples/
runpython run_tests.py -b
In https://github.com/i-VRESSE/workflow-builder I use a toml library to write the config file. The toml library does not support repeats of the same header. To repeat headers I need to make them unique by appending an index and putting quotes around the module name.
This PR adds support to haddock3 to parse config file like:
to
This config file can be written or loaded by any standard compliant toml library and should make it easier for haddock3 config files to be produced or consumed by other programs.