diff --git a/airflow/__init__.py b/airflow/__init__.py index 18f4cc3e3c28c..f6c40b5091bbc 100644 --- a/airflow/__init__.py +++ b/airflow/__init__.py @@ -17,6 +17,11 @@ # under the License. from __future__ import annotations +# 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" import os @@ -59,12 +64,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 diff --git a/docs/conf.py b/docs/conf.py index a09e54db63d20..e95796db7c780 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -765,6 +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/src/airflow/providers/__init__.py", "*/providers/tests/__init__.py", "*/providers/tests/cncf/__init__.py", "*/providers/tests/common/__init__.py", diff --git a/providers/src/airflow/providers/__init__.py b/providers/src/airflow/providers/__init__.py new file mode 100644 index 0000000000000..66fbd04b36e4d --- /dev/null +++ b/providers/src/airflow/providers/__init__.py @@ -0,0 +1,26 @@ +# +# 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. + +from __future__ import annotations + +# 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