airflowctl icon indicating copy to clipboard operation
airflowctl copied to clipboard

Remove pip as the primary installation method

Open ketozhang opened this issue 4 months ago • 0 comments

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:

  • --python-version is not the same as the version used in pip install airflowctl
  • --python-version is not specified
  • pyenv is not available
  • python is a different version than the one installed with pip. For example:
    • In a broken environment where python and pip are related
    • User later on upgraded Python and did not reinstall airflowctl.

Here are my suggestions:

  • Installation instructions should remove pip as the primary method.
  • Ideally, airflowctl behaviors should not depend on the Python version it is installed to.
  • airflowctl build should fail if python_version does not exist in $PATH. Error message should ask users to have the correct Python version.
    • Alternatively, users can override which Python path to build the virtual environment with.
  • Provide a Python-agnostic installation method (e.g., brew, apt, yum, winget, choco, etc.)

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

ketozhang avatar Feb 09 '24 00:02 ketozhang