This is an automated email from the ASF dual-hosted git repository. kaxilnaik pushed a commit to branch v3-0-test in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 03a78e8bbef6483adeadffe9ef9798dc2ff160df Author: Elad Kalif <[email protected]> AuthorDate: Mon Jul 14 10:52:03 2025 +0300 Add note about ruff rules and preview flag (#53331) (cherry picked from commit d4d4cce8d290fd5b4b51bdf217419c5b6ab889cc) --- .../docs/installation/upgrading_to_airflow3.rst | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/airflow-core/docs/installation/upgrading_to_airflow3.rst b/airflow-core/docs/installation/upgrading_to_airflow3.rst index 560f352ee41..8b733ad27f0 100644 --- a/airflow-core/docs/installation/upgrading_to_airflow3.rst +++ b/airflow-core/docs/installation/upgrading_to_airflow3.rst @@ -108,9 +108,25 @@ Some changes can be automatically fixed. To do so, run the following command: ruff check dag/ --select AIR301 --fix --preview +Some of the fixes are marked as unsafe. Unsafe fixes usually do not break dag code. They're marked as unsafe as they may change some runtime behavior. For more information, see `Fix Safety <https://docs.astral.sh/ruff/linter/#fix-safety>`_. +To trigger these fixes, run the following command: + +.. code-block:: bash + + ruff check dags/ --select AIR301 --fix --unsafe-fixes --preview + +.. note:: + Ruff has strict policy about when a rule becomes stable. Till it does you must use --preview flag. + The progress of Airflow Ruff rule become stable can be tracked in https://github.com/astral-sh/ruff/issues/17749 + That said, from Airflow side the rules are perfectly fine to be used. + +.. note:: + + In AIR rules, unsafe fixes involve changing import paths while keeping the name of the imported member the same. For instance, changing the import from ``from airflow.sensors.base_sensor_operator import BaseSensorOperator`` to ``from airflow.sdk.bases.sensor import BaseSensorOperator`` requires ruff to remove the original import before adding the new one. In contrast, safe fixes include changes to both the member name and the import path, such as changing ``from airflow.datasets impo [...] + You can also configure these flags through configuration files. See `Configuring Ruff <https://docs.astral.sh/ruff/configuration/>`_ for details. -Step 4: Install the Standard Providers +Step 4: Install the Standard Provider -------------------------------------- - Some of the commonly used Operators which were bundled as part of the ``airflow-core`` package (for example ``BashOperator`` and ``PythonOperator``)
