[AIRFLOW-5138] Don't override user's warning settings in airflow.configuration#5756
[AIRFLOW-5138] Don't override user's warning settings in airflow.configuration#5756jml wants to merge 1 commit intoapache:masterfrom
Conversation
Overriding warnings settings means that users cannot choose how to process these warnings. This means that in the case of spurious warnings, users are left with no choice but to see them over and over, which can blind them to warnings that really matter.
|
The problem with not setting this is that by default (since Py3) DeprecationWarning will be silenced, so with this change users would never see Airflow deprecation warnings. |
It does, but we'd rather people checked it themselves before hand. It's also a good indication of when people do or don't read 😉 |
I see. Since these are warnings are intended for users of the Alternatively, the warning should be enabled in the script, not in the configuration module. |
|
I don't have the capacity to pursue this further. Maybe I'll try again later. |
|
"FutureWarning" is proabably right for some of the use cases here (wrong config file, etc) but there are other cases where Airflow dual life as both an application and a library butt heads: Some hooks have deprecated some of their methods - should those be DeprecationWarning or FutureWarning? A "quick" fix might be an env var such as |
|
Hooks with deprecated methods should use Personally, I'd rather fix the false warnings than add an environment variable. Adding yet another configuration control and yet another |
|
Unfortunately most of our users aren't traditional python developers, so if we don't enable deprecation warnings (or use FutureWarning) for cases like that then many users would never see the warning |
Why not just use |
Jira
Partly addresses https://issues.apache.org/jira/browse/AIRFLOW-5138 by allowing users to silence the spurious warnings.
It's very uncommon for Python libraries to override warning settings in this way. By doing so, tools like pytest filterwarnings or even
python -Wwon't suppress the warnings, which means the warnings just become background noise, rather than a meaningful message from one person to another.Tests
My PR doesn't need automated tests because it's reverting warnings behaviour to the Python default, which is fine for practically everyone else.
Commits
Documentation
None required. No behaviour changes.
Code Quality
flake8— your CI doesn't catch this?!