You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/12 14:40:39 UTC

[GitHub] [airflow] ecerulm commented on issue #15325: Custom XCom backends circular import when using cli command like airflow connections list

ecerulm commented on issue #15325:
URL: https://github.com/apache/airflow/issues/15325#issuecomment-817869309


   If airflow was Python 3.7+ instead of Python 3.6+ we could change `airflow/models/xcom.py` so that instead of resolving the XCom backend right away it would be delayed until first use. 
   
   So instead of: 
   ```
   XCom = resolve_xcom_backend()
   ``` 
   
   ```
   def __getattr__(name):
     if name == "XCom":
       xcom = resolve_xcom_backend()
       sys.module[__name__].XCom = xcom
       return xcom
     raise AttributeError(f"module {__name__} has no attribute {name}")
   ```
   
   I'm going to try to use  
   ```
   XCom = lazy_object_proxy.Proxy(resolve_xcom_backend)
   ```
   if it works I'll create a PR
   


-- 
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:
users@infra.apache.org