ashb commented on PR #31379: URL: https://github.com/apache/airflow/pull/31379#issuecomment-1552849002
Actually I worry if this will cause a problem on 2.4 and 2.5 specifically: [v2.4's `airflow/__init__.py`](https://github.com/apache/airflow/blob/v2-4-stable/airflow/__init__.py#L46) ```python if not os.environ.get("_AIRFLOW__AS_LIBRARY", None): settings.initialize() # Things to lazy import in form {local_name: ('target_module', 'target_name')} __lazy_imports: dict[str, tuple[str, str]] = { 'DAG': ('.models.dag', 'DAG'), 'Dataset': ('.datasets', 'Dataset'), 'XComArg': ('.models.xcom_arg', 'XComArg'), 'AirflowException': ('.exceptions', 'AirflowException'), 'version': ('.version', ''), '__version__': ('.version', 'version'), } def __getattr__(name: str): ... # Lazy load code ``` So on 2.4, the logging import will be triggered by the `settings.initalize()` function, but the __getattr__ for lazy import hasn't yet been defined/parsed, so trying to import `airflow.__version__` will fail :( 2.5 is the same. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
