Refactor Airflow Cli for version Airflow 2.0
Hi, dev-list! Hi, maintainers! I want to pick up a theme about refactoring
the Airflow Cli (
for version 2.0. I want to initiate it for:
- to move utility functions in a separate module (already exist
airflow.utils.cli - maybe make sense use this module). I talk about methods
that do not generate commands or parse args. Usually, also, they are used
in two or more commands, for example,
- to use Command Pattern and to keep together command args and command
logic (not mean in one bowl of soup, but like a one logical chunk, for
example like it done in 'Click' with commands decorators, or in command
classes with argparse, for example, guinicorn cli -
when you see in one place - command args and command logic (and I don't
mean what need to move config and cli in one, how it's done about gunicorn)
- to get a more testable code and get possible to cover with tests -
getting default values from config, if a cli not provided, correct work in
cases then one option depend on second, check what messages and errors
shows correctly to a user, test correct generating final command and etc.
today most changes in cli merged without tests because in many cases
impossible to write unittests without refactoring existed code.
Also, we will get more possibilities to do a changes in a cli without
afraid to break anything.
So, I want to know your opinion in whole about refactoring cli.py and
opinions about should we stay with Argparse or should we move to click.
if all will agree about refactoring in whole: I want to get opinions and
comments and prepare some kind of POC on one or two commands to open PR and
start a more substantive discussion. I will be glad to prepare POC, but I
need your thoughts on this scope. I also opened a task, so you can answer
there you want
And thanks all!