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

Support YAMLs for config files #1030

Open
tsalo opened this issue Feb 15, 2024 · 4 comments
Open

Support YAMLs for config files #1030

tsalo opened this issue Feb 15, 2024 · 4 comments
Labels
documentation issues related to improving documentation for the project enhancement issues describing possible enhancements to the project

Comments

@tsalo
Copy link
Member

tsalo commented Feb 15, 2024

Summary

YAML is essentially just JSON with some nice formatting and comments allowed. We could have an if/else statement at the part where config files are read in that just switches which function is used to read in the contents.

Additional Detail

In the BIDS schema we chose to use YAMLs instead of JSONs because they're more readable and allow comments.

The Nipreps tools generally use TOMLs instead of JSONs for configuration files, so that might be worth considering as well.

@tsalo tsalo added enhancement issues describing possible enhancements to the project documentation issues related to improving documentation for the project labels Feb 15, 2024
@handwerkerd
Copy link
Member

As long as any of these files will be read into identical python dictionaries, this should be a fairly lightweight change (for someone besides me to implement). The changes I see are:

  • handling toml/yaml in the io.py class
  • Deciding if we want to change all our included json files to a new format & doing it
  • Deciding if we want to change the format for saving dictionaries
    • Giving users an option for how to save dictionaries would be more work and I'd lean against doing that
    • If we change our output format, do we know of any programs currently interfacing with our json outputs? @eurunuela, does mapca currently use desc-tedana_registry.json?

As for yaml vs toml, I don't know enough to have a real opinion. For me various factors are:

  • Google tells me toml is part of the python standard library starting in python 11 and yaml is not. This is really minor (and yaml might already be an indirect dependency for us) but all things being equal, one less dependency is good.
  • When we write out json files the dictionary keys are alphabetized. If one is better at defining an output order, that would be useful.
  • If any might interface better with existing programs for thinks like generating flow charts from decision trees.

@eurunuela
Copy link
Collaborator

If we change our output format, do we know of any programs currently interfacing with our json outputs? @eurunuela, does mapca currently use desc-tedana_registry.json?

maPCA should not be using any json, no. That said, json works better with Rica if it's ever needed.

@handwerkerd
Copy link
Member

I meant rica uses the registry json.... been thinking about mapca more recently.

@eurunuela
Copy link
Collaborator

Rica doesn't use the registry json at the moment. It uses the tsv files but that's only because I haven't had the chance to add more features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation issues related to improving documentation for the project enhancement issues describing possible enhancements to the project
Projects
None yet
Development

No branches or pull requests

3 participants