khalidmammadov commented on pull request #20049: URL: https://github.com/apache/airflow/pull/20049#issuecomment-988126568
> The problem is that `importlib.metadata` is unstable (the official term is _provisional_) before 3.10, and not everything in `importlib_metadata` is available in `importlib.metadata`. So if we want to switch to, say, the 3.9 version of `importlib.metadata`, we’d bump the `python_version` marker in `setup.cfg`, but after this change we’d also need to change a ton of if-imports due to that change. Try-imports are easier because it’d always try the third-party version first, regardless of the Python version. > > If we want to change try-imports to if-imports, it’s probably better to always use `importlib_metadata` for all versions prior to 3.10, when the stdlib `importlib.metadata` enters stable state. > > Also I believe `PY38` would not work because Mypy uses AST detection to perform type-time conditional magic, and would not understand what `PY38` means correctly. I will revert and try to fix MyPy issues different way -- 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]
