datalad / datalad-gooey

A graphical user interface for DataLad (datalad.org)
https://docs.datalad.org/projects/gooey
Other
4 stars 6 forks source link

Rethink parameter widget selection #307

Closed mih closed 1 year ago

mih commented 1 year ago

Before it was a mess, now it is less of a mess.

Importantly, the parameter widget selection is no longer based on a mixture of parameter names, constraints, and argparse internal settings. Now the selection is made solely based on an assigned Constraint.

To make this possible the whole slew of new Constraints that came to life lately is put to action. The constraint provided by -core's Parameter class is now treated as an "item constraint". This is turned into a "comprehensive constraint" by wrapping it, as necessary, into additional constraints. E.g. nargs='*' causes EnsureIterableOf(list, constraint).

A number of other rules are implemented to always yield a single constraint as a fully qualified ruleset to translate a parameters requirements into a widget(set).

Importantly, it is not necessary to indicate an explicit | EnsureNone() for a parameter that takes totally different values, but defaults to None, merely to indicate that it is optional. Now, an EnsureNone() is added automatically.

The approach should be extended to an EnsureValue(default), for any default value that is not already covered by the assigned constraint.

Closes #302

codecov-commenter commented 1 year ago

Codecov Report

Base: 69.94% // Head: 68.84% // Decreases project coverage by -1.09% :warning:

Coverage data is based on head (44d762b) compared to base (9f8776c). Patch coverage: 69.38% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #307 +/- ## ========================================== - Coverage 69.94% 68.84% -1.10% ========================================== Files 43 43 Lines 2745 2815 +70 ========================================== + Hits 1920 1938 +18 - Misses 825 877 +52 ``` | [Impacted Files](https://codecov.io/gh/datalad/datalad-gooey/pull/307?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad) | Coverage Δ | | |---|---|---| | [datalad\_gooey/dataladcmd\_ui.py](https://codecov.io/gh/datalad/datalad-gooey/pull/307/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad#diff-ZGF0YWxhZF9nb29leS9kYXRhbGFkY21kX3VpLnB5) | `86.91% <0.00%> (-1.66%)` | :arrow_down: | | [datalad\_gooey/tests/test\_param\_widget.py](https://codecov.io/gh/datalad/datalad-gooey/pull/307/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad#diff-ZGF0YWxhZF9nb29leS90ZXN0cy90ZXN0X3BhcmFtX3dpZGdldC5weQ==) | `100.00% <ø> (ø)` | | | [datalad\_gooey/param\_widgets.py](https://codecov.io/gh/datalad/datalad-gooey/pull/307/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad#diff-ZGF0YWxhZF9nb29leS9wYXJhbV93aWRnZXRzLnB5) | `51.77% <29.16%> (+1.77%)` | :arrow_up: | | [datalad\_gooey/param\_multival.py](https://codecov.io/gh/datalad/datalad-gooey/pull/307/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad#diff-ZGF0YWxhZF9nb29leS9wYXJhbV9tdWx0aXZhbC5weQ==) | `52.27% <40.00%> (-25.42%)` | :arrow_down: | | [datalad\_gooey/constraints.py](https://codecov.io/gh/datalad/datalad-gooey/pull/307/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad#diff-ZGF0YWxhZF9nb29leS9jb25zdHJhaW50cy5weQ==) | `83.05% <72.22%> (-1.71%)` | :arrow_down: | | [datalad\_gooey/param\_path.py](https://codecov.io/gh/datalad/datalad-gooey/pull/307/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad#diff-ZGF0YWxhZF9nb29leS9wYXJhbV9wYXRoLnB5) | `60.36% <85.71%> (+1.31%)` | :arrow_up: | | [datalad\_gooey/param\_form\_utils.py](https://codecov.io/gh/datalad/datalad-gooey/pull/307/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad#diff-ZGF0YWxhZF9nb29leS9wYXJhbV9mb3JtX3V0aWxzLnB5) | `87.21% <87.09%> (+7.73%)` | :arrow_up: | | [datalad\_gooey/param.py](https://codecov.io/gh/datalad/datalad-gooey/pull/307/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad#diff-ZGF0YWxhZF9nb29leS9wYXJhbS5weQ==) | `84.94% <100.00%> (+0.85%)` | :arrow_up: | | [datalad\_gooey/fsbrowser.py](https://codecov.io/gh/datalad/datalad-gooey/pull/307/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad#diff-ZGF0YWxhZF9nb29leS9mc2Jyb3dzZXIucHk=) | `28.51% <0.00%> (-11.49%)` | :arrow_down: | | ... and [6 more](https://codecov.io/gh/datalad/datalad-gooey/pull/307/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datalad) | | 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=datalad). 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=datalad)

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