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

Transition to using YAML for configs #31

Merged
merged 1 commit into from
Jan 17, 2018
Merged

Conversation

Gorialis
Copy link
Contributor

This is a change I've wanted to do for some time.

Pros

  • YAML looks nice
    • Scalar flow-sequences are more human-readable than direct lists
    • Folded scalars could be useful for extended string content (see Custom Messages #30)
  • YAML's inherent dict state allows values to be combined on top of a default (as in this implementation), allowing configs to be shorter as not every value needs to be defined
  • No need for awkward hasattr and getattr situations

Cons

  • Existing configurations must be changed
  • YAML cannot define functions or such which reduces the dynamics of the config
  • Requires extra dependency PyYAML
  • As the config is attached to the bot instance, it increases the 'uncleanliness' of code where the bot is not easily accessible

I've tested this impl a bunch and haven't found anything that's broken, and after checking through all changes and doing some tests I think this is 'complete'. The only thing that might change is the behavior of Configuration.__getattr__ to not return None when something is missing (raising instead).

@Gorialis Gorialis requested review from a user and slice January 15, 2018 19:41
@slice slice removed their request for review January 16, 2018 00:40
@slice
Copy link
Collaborator

slice commented Jan 16, 2018

image

consider it approved for me

@Gorialis Gorialis merged commit 5a0f22f into master Jan 17, 2018
@Gorialis Gorialis deleted the change/yaml-config branch February 4, 2018 19:39
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.

2 participants