AnswerDotAI / AnswerDotAI/fastmigrate

Make command line argument resolution simple and fully consistent

Open
#18 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
36
Forks
0
Avg merge
1m
Merged PRs (30d)
1

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: https://github.com/AnswerDotAI/fastmigrate/blob/c3a3953e5a135c6a131c2f5c6dc69b286c12e0e3/fastmigrate/cli.py#L34 .

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.