-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Sort engine entries in searx/settings.yml
alphabetically by name
#3317
Comments
May we should isolate them in a separated file |
OK at first to sort the subentries of each section. Not the order of each section because some of these are purposefully placed at the top of the file for a reason.
We could do like the helm tool, allow to specify the configuration in the yaml files that you want. This way we keep the backwards compatibility but allow for more organized yaml files: https://stackoverflow.com/questions/51097553/can-i-have-multiple-values-yaml-files-for-helm I do not agree on moving to an entirely new format though. YAML is fine for our usecase and I'm more towards not breaking existing installations. |
👍 |
I specifically wanted to draw attention towards unsorted engines. Unsorted other options are fine and should continue to be as is so that commonly used options are easy to discover. I'm modifying my issue title to reflect the same |
searx/settings.yml
alphabetically by namesearx/settings.yml
alphabetically by name
from ruamel.yaml import YAML
def parse(settings):
settings["engines"].sort(key=lambda e: e["name"])
def main():
yaml=YAML()
with open("searx/settings.yml", 'r', encoding='utf-8') as f:
settings = yaml.load(f)
parse(settings)
with open("settings_new.yml", "w", encoding="utf-8") as f:
yaml.dump(settings, f)
if __name__ == "__main__":
main() result: It does not sort the commented engines |
Currently this is a giant mess, which makes it really difficult to decide where a new engine should go. Sorting it by name can help improve it.
The text was updated successfully, but these errors were encountered: