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

DOC: Automatically document settings #863

Merged
merged 7 commits into from
Feb 28, 2024
Merged

Conversation

larsoner
Copy link
Member

@larsoner larsoner commented Feb 26, 2024

This PR automatically adds configuration options from _config.py to docs/source/settings/. It's a first step toward #862. To accomplish this, I wrote code to parse header levels # , ##, ### and map those onto our current hierarchy. I made a few opinionated choices:

  1. Make a new Execution section that has stuff like n_jobs. It seems useful to separate those from stuff like bids_root which are more dataset-specific and actually affect what gets generated as opposed to how it gets generated on machines / jobs etc..

    image

  2. Chose the website docs as the source of truth for parameter order. This means the _config.py diff is bigger, but the .md diffs are smaller.

  3. Chose to add the tags to the _config.py. This was a bit of a toss-up for me -- if it is not useful there I can easily just move those to a dict in gen_settings.py.

For now I have left the generated .md files in source control but this is just to facilitate review to see how the docs have changed. Once people are happy I will rm and add to .gitignore.

Link to rendered doc: https://output.circle-artifacts.com/output/job/0a5e0fe7-0af8-4717-80f5-e33f99967966/artifacts/0/site/settings/general.html

Before merging …

  • Changelog has been updated (docs/source/changes.md)
  • Remove .md files that are autogenerated and add to .gitignore

task_is_rest: bool = False
"""
Whether the task should be treated as resting-state data.
"""
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes like this are just copy-paste moves to match orders in .md files above, no content changes.

Comment on lines 450 to 458
# ## Break detection
#
# ---
# tags:
# - preprocessing
# - artifact-removal
# - raw
# - events
# ---
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hoechenberger this is my one open question -- useful to have the tags in the _config.py or no? If not I'll move to the parsing .py file instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you add them to the Python files? What would that look like?

Copy link
Member Author

@larsoner larsoner Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the parsing gen file something like

tags = {
    "break detection": ("preprocessing", "artifact-removal", "raw", "events"),
    ...
}

One tuple of tags per option category, then the parser adds them to the .md files in the right place

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a clear preference here, I suppose I'm fine with either

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it more I decided to move it to gen_settings.py -- that way someday we could consider auto-generating / adding tags. And I think it keeps _config.py a little bit more compact which is nice.

# This functionality will soon be removed from the pipeline, and
# will be integrated into MNE-BIDS.
#
# "Bad", i.e. flat and overly noisy channels, can be automatically detected
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocks of text like this were taken from the .md files and moved to the _config.py, which I think is a quality-of-life improvement for end users. We had little bits of this stuff in some places and some outdated info, and now it's documented nicely in the code and in the website the same way.

@larsoner larsoner marked this pull request as draft February 26, 2024 16:24
@larsoner larsoner marked this pull request as ready for review February 27, 2024 16:34
@larsoner
Copy link
Member Author

Even with all the parsing code we end up with a net-negative line count in the diff +511 −689 which is nice! Ready for review/merge from my end @hoechenberger

@hoechenberger
Copy link
Member

@larsoner I won't be able to thoroughly review for now; please go ahead and merge if you're happy and i'll start complaining sometime later 😁

@larsoner
Copy link
Member Author

i'll start complaining sometime later 😁

Complaints always welcome, but even more welcome if they're in the form of a PR to improve wordings etc. 😄

@larsoner larsoner merged commit e663d93 into mne-tools:main Feb 28, 2024
52 checks passed
@larsoner larsoner deleted the autodoc branch February 28, 2024 14:41
@SophieHerbst
Copy link
Collaborator

In my view, it would be helpfull to explain the memory-related arguments, and more generally the caching behavior in a dedicated page, like the basic usage

@hoechenberger
Copy link
Member

In my view, it would be helpfull to explain the memory-related arguments, and more generally the caching behavior in a dedicated page, like the basic usage

i agree!!

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.

3 participants