Cope with Pycharm's oddity in detecting namespace packages
Without the __path__ assignment being the very first line of the file
(including before any import) it doesn't detect this correctly.
@shahar1 @kaxil Could one of you test if this fixes it please?
@shahar1 @kaxil Could one of you test if this fixes it please?
Yup, works now
Yeah I tried in #43081 but could not make it work. Mypy/Python is not happy about it and raise a SyntaxError
https://youtrack.jetbrains.com/issue/PY-46690/Allow-all-imports-from-the-same-named-packages-if-path-manipulation-in-init-is-detected is the closest current issue I've found, but not exactly the same
Let's just exclude airflow.__init__.py from automatically adding from __future__ import annotations and convert it back to use "regular" typing.
We've done that for Pydantic classes before and still doing it for some test files https://github.com/apache/airflow/blob/main/pyproject.toml#L355
I added alternative implementation - and it seems to work for me https://github.com/apache/airflow/pull/43173 - just by removing from future and adding ignore rules from ruff seem to do the job as I suspected. Actually airflow/__init__.py did not require any change beceause it does not use postponed evaluation of types PEP563 at all.
Closing this one. It's already fixed.