-
Notifications
You must be signed in to change notification settings - Fork 0
Description
One flaw in the fastmigrate UI right now, is that the logic governing the resolution of the values to use for db and the migrations is not completely consistent.
That is, the logic is not simply:
- command-line arguments take precedence over config file values
- config file values take precedence over default values.
Instead, the logic is
- command-line arguments take precedence over config file values (unless those values equal the default values!)
- config file values take precedence over default values.
The simpler alternative would be better.
The details of why we do it wrong are here:
fastmigrate/fastmigrate/cli.py
Line 34 in c3a3953
| """Performs final value resolution for db and migrations. |
Essentially, it is because we specify default values for command line arguments in the parameters of functions decorated by @call_parse, and we then distinguish between values provided by the CLI and values derived from defaults merely by guessing on the basis of the value itself.
Perhaps call_parse provides some way to give us more information, so we can know not only the value of an argument, but whether it was supplied by the user vs defaulted in the absence of a supplied value?
At the moment we mitigate this flaw with a docstring which warns users. But it would be nice to fix this properly.
This GH issue represents the work to fix this, so that the system might present the simpler, better, less error-prone interface to the user.