From 52534cbb23491c7828beab9d799c60b7dcb585b6 Mon Sep 17 00:00:00 2001 From: ferruzzi Date: Fri, 11 Oct 2024 09:50:36 -0700 Subject: [PATCH 1/7] The recent PR to reorganize the package requires a change to explicit namespaces for at least some IDEs (PyChasrm for sure, possibly others). --- airflow/__init__.py | 3 +++ providers/src/airflow/providers/__init__.py | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 providers/src/airflow/providers/__init__.py diff --git a/airflow/__init__.py b/airflow/__init__.py index 18f4cc3e3c28c..73b6ade06dd9c 100644 --- a/airflow/__init__.py +++ b/airflow/__init__.py @@ -17,6 +17,9 @@ # under the License. from __future__ import annotations +# Explicit namespaces are required by some IDEs to resolve the import paths. +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore + __version__ = "3.0.0.dev0" import os diff --git a/providers/src/airflow/providers/__init__.py b/providers/src/airflow/providers/__init__.py new file mode 100644 index 0000000000000..bd70d22b993be --- /dev/null +++ b/providers/src/airflow/providers/__init__.py @@ -0,0 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Explicit namespaces are required by some IDEs to resolve the import paths. +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore From b987f51d45289886abbb29e9d38bad3381678e76 Mon Sep 17 00:00:00 2001 From: ferruzzi Date: Fri, 11 Oct 2024 10:00:47 -0700 Subject: [PATCH 2/7] static fixes --- providers/src/airflow/providers/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/providers/src/airflow/providers/__init__.py b/providers/src/airflow/providers/__init__.py index bd70d22b993be..12b88a466c844 100644 --- a/providers/src/airflow/providers/__init__.py +++ b/providers/src/airflow/providers/__init__.py @@ -16,5 +16,7 @@ # specific language governing permissions and limitations # under the License. +from __future__ import annotations + # Explicit namespaces are required by some IDEs to resolve the import paths. __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore From 32794eb66cc89e0d7ea092fd1057dc8736bdd755 Mon Sep 17 00:00:00 2001 From: "D. Ferruzzi" Date: Fri, 11 Oct 2024 12:51:09 -0700 Subject: [PATCH 3/7] Update providers/src/airflow/providers/__init__.py Co-authored-by: Ash Berlin-Taylor --- providers/src/airflow/providers/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/providers/src/airflow/providers/__init__.py b/providers/src/airflow/providers/__init__.py index 12b88a466c844..070dd6a136e2d 100644 --- a/providers/src/airflow/providers/__init__.py +++ b/providers/src/airflow/providers/__init__.py @@ -19,4 +19,6 @@ from __future__ import annotations # Explicit namespaces are required by some IDEs to resolve the import paths. +# +# Note: this file is not installed or distributed in any distribution! __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore From c20fffe6b16ebd252008bfa6c4b83ac836112cec Mon Sep 17 00:00:00 2001 From: ferruzzi Date: Fri, 11 Oct 2024 15:21:04 -0700 Subject: [PATCH 4/7] Remove duplicate line --- airflow/__init__.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/airflow/__init__.py b/airflow/__init__.py index 73b6ade06dd9c..b082aa1ff7178 100644 --- a/airflow/__init__.py +++ b/airflow/__init__.py @@ -62,12 +62,6 @@ "XComArg", ] -# Make `airflow` a namespace package, supporting installing -# airflow.providers.* in different locations (i.e. one in site, and one in user -# lib.) -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore - - # Perform side-effects unless someone has explicitly opted out before import # WARNING: DO NOT USE THIS UNLESS YOU REALLY KNOW WHAT YOU'RE DOING. # This environment variable prevents proper initialization, and things like From 2f65937035d87911741f8bedd494feb3e4b223a9 Mon Sep 17 00:00:00 2001 From: ferruzzi Date: Fri, 11 Oct 2024 15:21:18 -0700 Subject: [PATCH 5/7] Rephrase relevant comments --- airflow/__init__.py | 4 +++- providers/src/airflow/providers/__init__.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/airflow/__init__.py b/airflow/__init__.py index b082aa1ff7178..f6c40b5091bbc 100644 --- a/airflow/__init__.py +++ b/airflow/__init__.py @@ -17,7 +17,9 @@ # under the License. from __future__ import annotations -# Explicit namespaces are required by some IDEs to resolve the import paths. +# Make `airflow` a namespace package, supporting installing +# airflow.providers.* in different locations (i.e. one in site, and one in user +# lib.) This is required by some IDEs to resolve the import paths. __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore __version__ = "3.0.0.dev0" diff --git a/providers/src/airflow/providers/__init__.py b/providers/src/airflow/providers/__init__.py index 070dd6a136e2d..66fbd04b36e4d 100644 --- a/providers/src/airflow/providers/__init__.py +++ b/providers/src/airflow/providers/__init__.py @@ -18,7 +18,9 @@ from __future__ import annotations -# Explicit namespaces are required by some IDEs to resolve the import paths. +# Make `airflow` a namespace package, supporting installing +# airflow.providers.* in different locations (i.e. one in site, and one in user +# lib.) This is required by some IDEs to resolve the import paths. # # Note: this file is not installed or distributed in any distribution! __path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore From 1ca592b1ac0daee4ecd0fd0c7f68a6ba63f8f4e6 Mon Sep 17 00:00:00 2001 From: ferruzzi Date: Tue, 15 Oct 2024 12:10:43 -0700 Subject: [PATCH 6/7] Add providers tests init file to autoapi_ignore --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index a09e54db63d20..2956b9244a608 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -765,7 +765,7 @@ def _get_params(root_schema: dict, prefix: str = "", default_section: str = "") # These sub-folders aren't really providers, but we need __init__.py files else various tools (ruff, mypy) # get confused by providers/tests/systems/cncf/kubernetes and think that folder is the top level # kubernetes module! - "*/providers/tests/__init__.py", + "*/providers/src/airflow/providers/__init__.py*/providers/tests/__init__.py", "*/providers/tests/cncf/__init__.py", "*/providers/tests/common/__init__.py", "*/providers/tests/apache/__init__.py", From dd2944584e249d4dae2b26312a2a270b8274e526 Mon Sep 17 00:00:00 2001 From: "D. Ferruzzi" Date: Tue, 15 Oct 2024 14:07:27 -0700 Subject: [PATCH 7/7] typo Co-authored-by: Shahar Epstein <60007259+shahar1@users.noreply.github.com> --- docs/conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 2956b9244a608..e95796db7c780 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -765,7 +765,8 @@ def _get_params(root_schema: dict, prefix: str = "", default_section: str = "") # These sub-folders aren't really providers, but we need __init__.py files else various tools (ruff, mypy) # get confused by providers/tests/systems/cncf/kubernetes and think that folder is the top level # kubernetes module! - "*/providers/src/airflow/providers/__init__.py*/providers/tests/__init__.py", + "*/providers/src/airflow/providers/__init__.py", + "*/providers/tests/__init__.py", "*/providers/tests/cncf/__init__.py", "*/providers/tests/common/__init__.py", "*/providers/tests/apache/__init__.py",