potiuk commented on a change in pull request #6597: [AIRFLOW-6005] Remove airflow airflow exception imports. Depends on [AIRFLOW-6004] URL: https://github.com/apache/airflow/pull/6597#discussion_r347301975
########## File path: airflow/__init__.py ########## @@ -29,15 +29,20 @@ # flake8: noqa: F401 # pylint:disable=wrong-import-position +import os + from typing import Callable, Optional from airflow import settings from airflow import version from airflow.utils.log.logging_mixin import LoggingMixin from airflow.configuration import conf -from airflow.exceptions import AirflowException from airflow.models import DAG +if 'BUILDING_AIRFLOW_DOCS' in os.environ: + from airflow.exceptions import AirflowException Review comment: The problem is explained above. when I had 'deprecated' AirflowEccwption I had errro about 'duplicate candidates' for autoapi. So I had to exclude the whole 'deprecations' folder from autoapi - but this caused a problem of 'missing import module' when generating docs. I tried to mock it using 'autodoc_mock_imports' but it did not work for airflow internal modules. So I found that I can use the same mechanism as used in 'apply_defaults' with the variable. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services