mriqc icon indicating copy to clipboard operation
mriqc copied to clipboard

Type annotation of config module

Open oesteban opened this issue 10 months ago • 4 comments

In general, it would be best practice to annotate, but it is of particular interest to the config module, as it will make the documentation of settings way more transparent and clear.

Any takers?

cc/ @celprov @mckenziephagen @teresamg @ZviBaratz

oesteban avatar Apr 10 '24 07:04 oesteban

I'm afraid I don't understand what is needed.

celprov avatar Apr 10 '24 08:04 celprov

Here's a gentle explanation about type annotation: https://blog.logrocket.com/understanding-type-annotation-python/.

In practice, this is about adding type hints to each of the configurable variables. For example, instead of:

x = 5.0

you can annotate this and say:

x: float = 5.0

which explicitly says this variable should be a float.

Type annotation also works for functions:

def hello(name):
    print(f'Hi {name}')

becomes:

def hello(name : str) -> None:
    print(f'Hi {name}')

which explicitly tells you the function accepts a string through the argument name and returns a None.

oesteban avatar Apr 10 '24 09:04 oesteban

If it's not too urgent, I wouldn't mind trying to take it on sometime in the next couple of weeks.

ZviBaratz avatar Apr 10 '24 09:04 ZviBaratz

@ZviBaratz - two weeks is excellent timing.

oesteban avatar Apr 10 '24 09:04 oesteban

Done in #1288.

oesteban avatar Aug 20 '24 08:08 oesteban