MetOffice / MetOffice/fab

Clarify argument handling in FabBase

Open Beginner friendly
#547 2 comments 0 reactions 0 assignees View on GitHub
good first issue
Dominant language
Python
Stars
9
Forks
9
Avg merge
12d 12h
Merged PRs (30d)
2

Description

The FabBase class accepts options to enable and disable compilation features, e.g. for MPI:

https://github.com/MetOffice/fab/blob/851cd80b1cda41ee0b347686ddbcc41785a3b7fc/source/fab/fab_base/fab_base.py#L410-L415

This results in unclear help messages, e.g.

```
--mpi, -mpi Enable MPI (default: True)
--no-mpi, -no-mpi Disable MPI (default: True)
```

This would be better implemented by adding an exclusive group and suppressing one of the alternatives, e.g.

```
mpi_args = parser.add_mutually_exclusive_group()
mpi_args.add_argument(
"--mpi", "-mpi", default=True, action="store_true", help="Enable MPI"
)
mpi_args.add_argument(
"--no-mpi",
"-no-mpi",
action="store_false",
dest="mpi",
help=argparse.SUPPRESS,
)
```

Contributor guide

Open the contributing guide

Research direction

Start in source/fab/fab_base/fab_base.py around lines 410-415 and inspect how the MPI and other compilation-feature arguments are added to the argparse parser. Update the help behavior so enable/disable alternatives are mutually exclusive and only the positive option is shown. Confirm the generated help no longer reports both defaults unclearly and that both argument forms still set the intended option.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.