kaxil / airflowctl

A CLI tool to streamline getting started with Apache Airflow™ and managing multiple Airflow projects
Apache License 2.0
196 stars 15 forks source link

Remove pip as the primary installation method #33

Closed ketozhang closed 4 days ago

ketozhang commented 9 months ago

airflowctl is affected by the chicken-and-egg problem of Python version. No surprisingly it has the same burden as other Python environment & project managers (e.g., hatch, pipx, pyenv) :

If we start with pip, the version used in airflowctl built must match the same version as your pip environment:

    $ python -V
    Python X.Y.Z

    $ python -m pip install airflowctl
    $ airflowctl init --python-version=X.Y.Z .
    $ airflowctl build .

Otherwise pyenv is invoked to get the correct python version (forcing users to use a specific version manager).

The above is the ideal instruction if we're going to use pip. With the current instructions, you can run into a lot of issues if you have one of these situation:

Here are my suggestions:

Alternatively, although a bigger rewrite, switch to using hatch or rye.

kaxil commented 2 months ago

I have switched to using uv (PR: https://github.com/kaxil/airflowctl/pull/39) and created 0.2.11. Let me know if you try it out

ketozhang commented 4 days ago
$ uv tool install airflowctl
$  airflowctl init my_airflow_project --build-start
$ ls -la my_airflow_project
total 1416
drwxr-xr-x  15 keto  staff     480 Nov 18 10:28 .
drwx------   3 keto  staff      96 Nov 18 10:27 ..
drwxr-xr-x   3 keto  staff      96 Nov 18 10:27 .airflowctl
-rw-r--r--   1 keto  staff     316 Nov 18 10:27 .env
-rw-r--r--   1 keto  staff     150 Nov 18 10:27 .gitignore
drwxr-xr-x   9 keto  staff     288 Nov 18 10:27 .venv
-rw-------   1 keto  staff   87628 Nov 18 10:27 airflow.cfg
-rw-r--r--   1 keto  staff  581632 Nov 18 10:28 airflow.db
drwxr-xr-x   4 keto  staff     128 Nov 18 10:28 dags
drwxr-xr-x   4 keto  staff     128 Nov 18 10:28 logs
drwxr-xr-x   2 keto  staff      64 Nov 18 10:27 plugins
-rw-r--r--   1 keto  staff       0 Nov 18 10:27 requirements.txt
-rw-r--r--   1 keto  staff     717 Nov 18 10:27 settings.yaml
-rw-------   1 keto  staff      16 Nov 18 10:27 standalone_admin_password.txt
-rw-r--r--   1 keto  staff    4762 Nov 18 10:28 webserver_config.py

That's much better. Thank you!