Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make graphviz dependency optional #36647

Merged
merged 1 commit into from
Jan 7, 2024

Commits on Jan 7, 2024

  1. Make graphviz dependency optional

    The `graphviz` dependency has been problematic as Airflow required
    dependency - especially for ARM-based installations. Graphviz
    packages require binary graphviz libraries - which is already a
    limitation, but they also require to install graphviz Python
    bindings to be build and installed. This does not work for older
    Linux installation but - more importantly - when you try
    to install Graphviz libraries for Python 3.8, 3.9 for ARM M1
    MacBooks, the packages fail to install because Python bindings
    compilation for M1 can only work for Python 3.10+.
    
    There is not an easy solution for that except commenting out
    graphviz dependency from setup.py, when you want to install Airflow
    for Python 3.8, 3.9 for MacBook M1.
    
    However Graphviz is really used in two places:
    
    * when you want to render DAGs wia airflow CLI - either to an image
      or directly to terminal (for terminals/systems supporting imgcat)
    
    * when you want to render ER diagram after you modified Airflow
      models
    
    The latter is a development-only feature, the former is production
    feature, however it is a very niche one.
    
    This PR turns rendering of the images in Airflow in optional feature
    (only working when graphviz python bindings are installed) and
    effectively turns graphviz into an optional extra (and removes it
    from requirements).
    
    This is not a breaking change technically - the CLIs to render the
    DAGs is still there and IF you already have graphviz installed, it
    will continue working as it did before. The only problem when it
    does not work is where you do not have graphviz installed for
    fresh installation and it will raise an error and inform that you need it.
    
    Graphviz will remain to be installed for most users:
    
    * the Airflow Image will still contain graphviz library, because
      it is added there as extra
    * when previous version of Airflow has been installed already, then
      graphviz library is already installed there and Airflow will
      continue working as it did
    
    The only change will be a new installation of new version of Airflow
    from the scratch, where graphviz will need to be specified as extra
    or installed separately in order to enable DAG rendering option.
    
    Taking into account this behaviour (which only requires to install
    a graphviz package), this should not be considered as a breaking
    change.
    
    Extracted from: apache#36537
    potiuk committed Jan 7, 2024
    Configuration menu
    Copy the full SHA
    5d39632 View commit details
    Browse the repository at this point in the history