-
-
Notifications
You must be signed in to change notification settings - Fork 324
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
YAML support for the file backend #339
Conversation
There's also a TOML config backend in the works by @penguwin. Theoretically we could support all three formats, I'm just not sure if that's a good idea. Example configs and documentation would then often diverge and confront the user with a different format, and that's probably not helpful. We decided to go with JSON originally because it was user-readable "enough", an established standard and the idea really was to get the web interface to a point where editing the config file was the exception, not the norm. I'm still a bit torn here. Open for discussion! |
☝️same! my experience is that while I'd appreciate having yaml over json when I have to manually change the config what I'd really want is powerful GUIs and CLIs that do the necessary validation for me so I don't risk breaking it. |
I also like TOML much more (Luigi supports TOML because of me, bandit is almost there) but YAML (unfortunately?) works much better for BeeHive:
Let's see an example. For YAML, it is clear what is related to what, nesting comes naturally:
For TOML, it is strange non-intuitive [[bees]]
name = "something"
[[bees.options]]
name = "hello"
value = "world"
[[bees.options]]
name = "another"
value = "one bite"
[[bees]]
name = "something else"
[[bees.options]]
name = "check"
value = """
def main(**kwargs):
return True
""" So, if you don't want to support both formats at once, I advise you to choose YAML. Sometimes, YAML is tricky and don't strict enough but this shouldn't be an issue with BeeHive, and TOML would introduce more issues. |
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'd also rather prefer to support only one config format at a time. Some form of soft migration would be nice, reading in "old" json
configs as usual and then writing them in the new format on save.
@orsinium made some good points for using yaml
as the format for beehive and I see no reason not to use it.
Ok, some good points there, I'm almost convinced 😄 We should still only support one designated "config language", so I agree with @penguwin: how about we try to parse the old JSON configs and migrate them to YAML when we first encounter them? |
Thank you for your reviews! The PR introduces support for both formats at once, without breaking the existing installations. So, it's safe to take it as is. The migration logic can be done later, in a separate PR. Meanwhile, we can try how the new format works without forcing anyone to migrate :) |
Fair enough, let's give this a chance and see how it feels. |
Thank you @orsinium, loving all the contributions! |
If the path to config explicitly specified and it has
.yaml
(or.yml
) extension, use YAML format instead of JSON.Motivation
JSON is human-readable but not human-editable. Beehive WebUI is old and limited. For example, I don't see a way to edit an existing chain through the WebUI. So, let's make the configuration file nice and editable.