templateflow / python-client

A python client to query TemplateFlow via pyBIDS
https://templateflow.org/python-client/
Apache License 2.0
8 stars 10 forks source link

ENH: Allow access to PyBIDS' magic ``get_*`` #101

Closed oesteban closed 1 year ago

oesteban commented 1 year ago

This patch allows users to access the automated querying of the layout with the get_* magic (and ls_*, for TF), e.g.:

>>> from templateflow import api
>>> api.ls_atlases(template="MNI152NLin6Asym")
['DiFuMo', 'Schaefer2018', 'HOCPA', 'HCP', 'HOCPAL', 'HOSPA']

The existing get_* methods are not overshadowed:

>>> api.get_citations(template="MNI152NLin6Asym")
['https://doi.org/10.1016/j.neuroimage.2012.01.024',
 'https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Atlases']

The original get_* queries are accepted:

>>> api.get_atlases()
['AAL',
 'DiFuMo',
 'v3',
 'CerebrA',
 'D99',
 'WHS',
 'VALiDATe',
 'v4',
 'Schaefer2018',
 'HOCPA',
 'HCP',
 'CerebA',
 'CCFv3',
 'CHARM',
 'HOCPAL',
 'SARM',
 'HOSPA']

I'm hesitant about whether we should disallow get_* (as the meaning for TF is "fetch it" instead of getting from a table).

WDYT?

effigies commented 1 year ago

No strong opinion on get_ or not.

codecov[bot] commented 1 year ago

Codecov Report

Base: 85.31% // Head: 85.71% // Increases project coverage by +0.39% :tada:

Coverage data is based on head (2227ce4) compared to base (3c1f2cb). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #101 +/- ## ========================================== + Coverage 85.31% 85.71% +0.39% ========================================== Files 5 5 Lines 252 259 +7 ========================================== + Hits 215 222 +7 Misses 37 37 ``` | Flag | Coverage Δ | | |---|---|---| | api | `85.71% <100.00%> (+0.39%)` | :arrow_up: | | config | `53.28% <50.00%> (-0.29%)` | :arrow_down: | | datalad | `77.60% <100.00%> (+0.62%)` | :arrow_up: | | dls3 | `58.30% <87.50%> (+0.76%)` | :arrow_up: | | s3 | `61.00% <87.50%> (+0.68%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=templateflow#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/templateflow/python-client/pull/101?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=templateflow) | Coverage Δ | | |---|---|---| | [templateflow/api.py](https://codecov.io/gh/templateflow/python-client/pull/101/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=templateflow#diff-dGVtcGxhdGVmbG93L2FwaS5weQ==) | `81.90% <100.00%> (+1.29%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=templateflow). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=templateflow)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.