You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jedcunningham (via GitHub)" <gi...@apache.org> on 2023/10/31 17:43:41 UTC

[PR] Add back FAB backends used in webserver config [airflow]

jedcunningham opened a new pull request, #35302:
URL: https://github.com/apache/airflow/pull/35302

   Every Airflow today imports the FAB auth type from us, so maintain them for backcompat.
   
   This spits out this DeprecationWarning now:
   ```
   DeprecationWarning: Importing 'AUTH_DB' directly from 'airflow.www.fab_security.manager' is deprecated and will be removed in the future. Please import it from 'flask_appbuilder.const.AUTH_DB'.
   ```


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add back FAB backends used in webserver config [airflow]

Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck merged PR #35302:
URL: https://github.com/apache/airflow/pull/35302


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add back FAB backends used in webserver config [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #35302:
URL: https://github.com/apache/airflow/pull/35302#discussion_r1378100220


##########
airflow/www/fab_security/manager.py:
##########
@@ -63,6 +63,35 @@
 # Copyright 2013, Daniel Vaz Gaspar
 log = logging.getLogger(__name__)
 
+__lazy_imports = {
+    "AUTH_DB": "flask_appbuilder.const",
+    "AUTH_LDAP": "flask_appbuilder.const",
+    "LOGMSG_WAR_SEC_LOGIN_FAILED": "flask_appbuilder.const",
+}
+
+
+def __getattr__(name: str):
+    # PEP-562: Lazy loaded attributes on python modules
+    path = __lazy_imports.get(name)
+    if not path:
+        raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
+
+    import warnings
+
+    warnings.warn(

Review Comment:
   yes



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add back FAB backends used in webserver config [airflow]

Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck commented on code in PR #35302:
URL: https://github.com/apache/airflow/pull/35302#discussion_r1377975179


##########
airflow/www/fab_security/manager.py:
##########
@@ -63,6 +63,35 @@
 # Copyright 2013, Daniel Vaz Gaspar
 log = logging.getLogger(__name__)
 
+__lazy_imports = {
+    "AUTH_DB": "flask_appbuilder.const",
+    "AUTH_LDAP": "flask_appbuilder.const",
+    "LOGMSG_WAR_SEC_LOGIN_FAILED": "flask_appbuilder.const",
+}
+
+
+def __getattr__(name: str):
+    # PEP-562: Lazy loaded attributes on python modules
+    path = __lazy_imports.get(name)
+    if not path:
+        raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
+
+    import warnings
+
+    warnings.warn(

Review Comment:
   Yep, I am good with that



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add back FAB backends used in webserver config [airflow]

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #35302:
URL: https://github.com/apache/airflow/pull/35302#discussion_r1377964761


##########
airflow/www/fab_security/manager.py:
##########
@@ -63,6 +63,35 @@
 # Copyright 2013, Daniel Vaz Gaspar
 log = logging.getLogger(__name__)
 
+__lazy_imports = {
+    "AUTH_DB": "flask_appbuilder.const",
+    "AUTH_LDAP": "flask_appbuilder.const",
+    "LOGMSG_WAR_SEC_LOGIN_FAILED": "flask_appbuilder.const",
+}
+
+
+def __getattr__(name: str):
+    # PEP-562: Lazy loaded attributes on python modules
+    path = __lazy_imports.get(name)
+    if not path:
+        raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
+
+    import warnings
+
+    warnings.warn(

Review Comment:
   I'd also be open to not deprecating importing from this module. Thoughts @vincbeck?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add back FAB backends used in webserver config [airflow]

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #35302:
URL: https://github.com/apache/airflow/pull/35302#discussion_r1378161817


##########
airflow/www/fab_security/manager.py:
##########
@@ -63,6 +63,35 @@
 # Copyright 2013, Daniel Vaz Gaspar
 log = logging.getLogger(__name__)
 
+__lazy_imports = {
+    "AUTH_DB": "flask_appbuilder.const",
+    "AUTH_LDAP": "flask_appbuilder.const",
+    "LOGMSG_WAR_SEC_LOGIN_FAILED": "flask_appbuilder.const",
+}
+
+
+def __getattr__(name: str):
+    # PEP-562: Lazy loaded attributes on python modules
+    path = __lazy_imports.get(name)
+    if not path:
+        raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
+
+    import warnings
+
+    warnings.warn(
+        f"Importing {name!r} directly from {__name__!r} is deprecated and "
+        f"will be removed in the future. Please import it from '{path}.{name}'.",
+        DeprecationWarning,
+        stacklevel=2,
+    )
+

Review Comment:
   ```suggestion
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org