You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by je...@apache.org on 2023/03/08 01:27:54 UTC

[airflow] branch v2-5-test updated (470b89fe12 -> 9f8aa37f8a)

This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a change to branch v2-5-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


 discard 470b89fe12 Update Airflow version to 2.5.2
     new 3a7ab400e5 Avoid unneeded Connexion constructs (#29631)
     new a004df2dec Don't use importlib.metadata to get Version for speed (#29723)
     new c18727327a Replace blockquote + Note: with RST note in docs (#29709)
     new 9f8aa37f8a Update Airflow version to 2.5.2

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (470b89fe12)
            \
             N -- N -- N   refs/heads/v2-5-test (9f8aa37f8a)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 airflow/__init__.py                                |  3 ++-
 airflow/operators/python.py                        |  5 ++--
 airflow/version.py                                 | 19 +++-----------
 airflow/www/extensions/init_views.py               | 30 ++++++++++++----------
 dev/README_RELEASE_AIRFLOW.md                      |  2 +-
 docs/apache-airflow/core-concepts/taskflow.rst     |  4 +--
 docs/apache-airflow/core-concepts/xcoms.rst        |  4 +--
 scripts/ci/pre_commit/common_precommit_utils.py    | 13 ++++++++++
 .../ci/pre_commit/pre_commit_update_versions.py    | 22 +++++++---------
 .../ci/pre_commit/pre_commit_version_heads_map.py  | 16 +++---------
 scripts/in_container/run_migration_reference.py    |  4 +--
 setup.cfg                                          |  2 ++
 setup.py                                           | 17 +++++-------
 13 files changed, 65 insertions(+), 76 deletions(-)


[airflow] 03/04: Replace blockquote + Note: with RST note in docs (#29709)

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch v2-5-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit c18727327a0307806129f2ef24c30bfa132530e4
Author: Vladimir Mikhaylov <38...@users.noreply.github.com>
AuthorDate: Thu Feb 23 11:21:54 2023 +0000

    Replace blockquote + Note: with RST note in docs (#29709)
    
    (cherry picked from commit feb4f40db0170e0711234076adf45753d65aed2f)
---
 docs/apache-airflow/core-concepts/taskflow.rst | 4 ++--
 docs/apache-airflow/core-concepts/xcoms.rst    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/apache-airflow/core-concepts/taskflow.rst b/docs/apache-airflow/core-concepts/taskflow.rst
index 40fe72dda0..c12ed36c4a 100644
--- a/docs/apache-airflow/core-concepts/taskflow.rst
+++ b/docs/apache-airflow/core-concepts/taskflow.rst
@@ -179,9 +179,9 @@ It is good practice to version the objects that will be used in serialization. T
 so that a version 2 is able to deserialize a version 1. In case you need custom logic
 for deserialization ensure that ``deserialize(data: dict, version: int)`` is specified.
 
-::
+.. note::
 
-  Note: Typing of ``version`` is required and needs to be ``ClassVar[int]``
+  Typing of ``version`` is required and needs to be ``ClassVar[int]``
 
 
 Sensors and the TaskFlow API
diff --git a/docs/apache-airflow/core-concepts/xcoms.rst b/docs/apache-airflow/core-concepts/xcoms.rst
index 3a6dedea28..8cc3ebaf4b 100644
--- a/docs/apache-airflow/core-concepts/xcoms.rst
+++ b/docs/apache-airflow/core-concepts/xcoms.rst
@@ -38,9 +38,9 @@ You can also use XComs in :ref:`templates <concepts:jinja-templating>`::
 
 XComs are a relative of :doc:`variables`, with the main difference being that XComs are per-task-instance and designed for communication within a DAG run, while Variables are global and designed for overall configuration and value sharing.
 
-::
+.. note::
 
-  Note: If the first task run is not succeeded then on every retry task XComs will be cleared to make the task run idempotent.
+  If the first task run is not succeeded then on every retry task XComs will be cleared to make the task run idempotent.
 
 Custom XCom Backends
 --------------------


[airflow] 02/04: Don't use importlib.metadata to get Version for speed (#29723)

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch v2-5-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit a004df2dec22b1c3ef750281ae0eb74ef958ad83
Author: Ash Berlin-Taylor <as...@apache.org>
AuthorDate: Fri Feb 24 09:45:00 2023 +0000

    Don't use importlib.metadata to get Version for speed (#29723)
    
    As discovered by @uranusjr in other PRs, loading the Metadata info at
    runtime is surprisingly expensive.
    
    Recent versions of setuptools (including the one we already say we
    depend upon in pyproject.toml) have the ability to pull the version from
    an attribute using an "ast-eval" method so this keeps the property of
    there being a single source of truth for the Airflow version, it just
    moves that places to airflow/__init__.py.
    
    You might wonder why this particular case matters at runtime? In the
    grand scheme of things it likely doesn't, except that the
    airflow/operators/python.py imports this at the top level (or did before
    this PR) which made me look in to it and discover a quick win here.
    
    (cherry picked from commit d0783744fcae40b0b6b2e208a555ea5fd9124dfb)
---
 airflow/__init__.py                                |  3 ++-
 airflow/operators/python.py                        |  5 +++--
 airflow/version.py                                 | 19 +++----------------
 dev/README_RELEASE_AIRFLOW.md                      |  2 +-
 scripts/ci/pre_commit/common_precommit_utils.py    | 13 +++++++++++++
 .../ci/pre_commit/pre_commit_update_versions.py    | 22 +++++++++-------------
 .../ci/pre_commit/pre_commit_version_heads_map.py  | 16 ++++------------
 scripts/in_container/run_migration_reference.py    |  4 ++--
 setup.cfg                                          |  2 ++
 setup.py                                           | 17 ++++++-----------
 10 files changed, 45 insertions(+), 58 deletions(-)

diff --git a/airflow/__init__.py b/airflow/__init__.py
index 41c9157000..334139b1d7 100644
--- a/airflow/__init__.py
+++ b/airflow/__init__.py
@@ -51,6 +51,8 @@ from airflow import settings
 
 __all__ = ["__version__", "login", "DAG", "PY36", "PY37", "PY38", "PY39", "PY310", "XComArg"]
 
+__version__ = "2.6.0.dev0"
+
 # Make `airflow` an namespace package, supporting installing
 # airflow.providers.* in different locations (i.e. one in site, and one in user
 # lib.)
@@ -77,7 +79,6 @@ __lazy_imports: dict[str, tuple[str, str]] = {
     "XComArg": (".models.xcom_arg", "XComArg"),
     "AirflowException": (".exceptions", "AirflowException"),
     "version": (".version", ""),
-    "__version__": (".version", "version"),
 }
 
 
diff --git a/airflow/operators/python.py b/airflow/operators/python.py
index 0a0dd34fef..41fd796507 100644
--- a/airflow/operators/python.py
+++ b/airflow/operators/python.py
@@ -41,7 +41,6 @@ from airflow.utils.context import Context, context_copy_partial, context_merge
 from airflow.utils.operator_helpers import KeywordParameters
 from airflow.utils.process_utils import execute_in_subprocess
 from airflow.utils.python_virtualenv import prepare_virtualenv, write_python_script
-from airflow.version import version as airflow_version
 
 
 def task(python_callable: Callable | None = None, multiple_outputs: bool | None = None, **kwargs):
@@ -693,9 +692,11 @@ class ExternalPythonOperator(_BasePythonVirtualenvOperator):
             return False
 
     def _get_airflow_version_from_target_env(self) -> str | None:
+        from airflow import __version__ as airflow_version
+
         try:
             result = subprocess.check_output(
-                [self.python, "-c", "from airflow import version; print(version.version)"], text=True
+                [self.python, "-c", "from airflow import __version__; print(__version__)"], text=True
             )
             target_airflow_version = result.strip()
             if target_airflow_version != airflow_version:
diff --git a/airflow/version.py b/airflow/version.py
index 3c65cebce0..38fb013244 100644
--- a/airflow/version.py
+++ b/airflow/version.py
@@ -17,20 +17,7 @@
 # under the License.
 from __future__ import annotations
 
-__all__ = ["version"]
-
-try:
-    import importlib_metadata as metadata
-except ImportError:
-    from importlib import metadata  # type: ignore[no-redef]
-
-try:
-    version = metadata.version("apache-airflow")
-except metadata.PackageNotFoundError:
-    import logging
+# Compat -- somethings access `airflow.version.version` directly
+from airflow import __version__ as version
 
-    log = logging.getLogger(__name__)
-    log.warning("Package metadata could not be found. Overriding it with version found in setup.py")
-    from setup import version
-
-del metadata
+__all__ = ["version"]
diff --git a/dev/README_RELEASE_AIRFLOW.md b/dev/README_RELEASE_AIRFLOW.md
index a98a25cc27..dd6f194522 100644
--- a/dev/README_RELEASE_AIRFLOW.md
+++ b/dev/README_RELEASE_AIRFLOW.md
@@ -246,7 +246,7 @@ The Release Candidate artifacts we vote upon should be the exact ones we vote ag
     git reset --hard origin/v${VERSION_BRANCH}-test
     ```
 
-- Set your version in `setup.py` and `airflow/api_connexion/openapi/v1.yaml` (without the RC tag).
+- Set your version in `airflow/__init__.py` and `airflow/api_connexion/openapi/v1.yaml` (without the RC tag).
 - Add supported Airflow version to `./scripts/ci/pre_commit/pre_commit_supported_versions.py` and let pre-commit do the job.
 - Replace the version in `README.md` and verify that installation instructions work fine.
 - Build the release notes:
diff --git a/scripts/ci/pre_commit/common_precommit_utils.py b/scripts/ci/pre_commit/common_precommit_utils.py
index aef6bc3dce..3dc1fceba5 100644
--- a/scripts/ci/pre_commit/common_precommit_utils.py
+++ b/scripts/ci/pre_commit/common_precommit_utils.py
@@ -16,6 +16,7 @@
 # under the License.
 from __future__ import annotations
 
+import ast
 import hashlib
 import os
 import re
@@ -24,6 +25,18 @@ from pathlib import Path
 AIRFLOW_SOURCES_ROOT = Path(__file__).parents[3].resolve()
 
 
+def read_airflow_version() -> str:
+    ast_obj = ast.parse((AIRFLOW_SOURCES_ROOT_PATH / "airflow" / "__init__.py").read_text())
+    for node in ast_obj.body:
+        if not isinstance(node, ast.Assign):
+            continue
+
+        if node.targets[0].id == "__version__":  # type: ignore[attr-defined]
+            return ast.literal_eval(node.value)
+
+    raise RuntimeError("Couldn't find __version__ in AST")
+
+
 def filter_out_providers_on_non_main_branch(files: list[str]) -> list[str]:
     """When running build on non-main branch do not take providers into account"""
     default_branch = os.environ.get("DEFAULT_BRANCH")
diff --git a/scripts/ci/pre_commit/pre_commit_update_versions.py b/scripts/ci/pre_commit/pre_commit_update_versions.py
index ee88db21fa..19cba2c648 100755
--- a/scripts/ci/pre_commit/pre_commit_update_versions.py
+++ b/scripts/ci/pre_commit/pre_commit_update_versions.py
@@ -17,23 +17,18 @@
 # under the License.
 from __future__ import annotations
 
-import glob
-import os
 import re
 import sys
-from os.path import abspath, dirname, join
+from pathlib import Path
 
-AIRFLOW_SOURCES_DIR = abspath(join(dirname(__file__), os.pardir, os.pardir, os.pardir))
+sys.path.insert(0, str(Path(__file__).parent.resolve()))  # make sure common_precommit_utils is importable
 
-sys.path.insert(0, AIRFLOW_SOURCES_DIR)
-# flake8: noqa: F401
+from common_precommit_utils import AIRFLOW_SOURCES_ROOT_PATH, read_airflow_version  # noqa: E402
 
-from setup import version  # isort:skip
 
-
-def update_version(pattern: re.Pattern, v: str, file_path: str):
+def update_version(pattern: re.Pattern, v: str, file_path: Path):
     print(f"Checking {pattern} in {file_path}")
-    with open(file_path, "r+") as f:
+    with file_path.open("r+") as f:
         file_content = f.read()
         if not pattern.search(file_content):
             raise Exception(f"Pattern {pattern!r} doesn't found in {file_path!r} file")
@@ -53,13 +48,14 @@ REPLACEMENTS = {
     r"(\(Assuming Airflow version `).*(`\))": "docs/docker-stack/README.md",
 }
 
-print(f"Current version: {version}")
 
 if __name__ == "__main__":
+    version = read_airflow_version()
+    print(f"Current version: {version}")
     for regexp, p in REPLACEMENTS.items():
         text_pattern = re.compile(regexp, flags=re.MULTILINE)
-        files = glob.glob(join(AIRFLOW_SOURCES_DIR, p), recursive=True)
+        files = list(AIRFLOW_SOURCES_ROOT_PATH.glob(p))
         if not files:
             print(f"ERROR! No files matched on {p}")
-        for file in glob.glob(join(AIRFLOW_SOURCES_DIR, p), recursive=True):
+        for file in files:
             update_version(text_pattern, version, file)
diff --git a/scripts/ci/pre_commit/pre_commit_version_heads_map.py b/scripts/ci/pre_commit/pre_commit_version_heads_map.py
index f935d6d395..5ae542b1c1 100755
--- a/scripts/ci/pre_commit/pre_commit_version_heads_map.py
+++ b/scripts/ci/pre_commit/pre_commit_version_heads_map.py
@@ -28,7 +28,9 @@ PROJECT_SOURCE_ROOT_DIR = Path(__file__).resolve().parent.parent.parent.parent
 
 DB_FILE = PROJECT_SOURCE_ROOT_DIR / "airflow" / "utils" / "db.py"
 
-SETUP_FILE = PROJECT_SOURCE_ROOT_DIR / "setup.py"
+sys.path.insert(0, str(Path(__file__).parent.resolve()))  # make sure common_precommit_utils is importable
+
+from common_precommit_utils import read_airflow_version  # noqa: E402
 
 
 def read_revision_heads_map():
@@ -45,18 +47,8 @@ def read_revision_heads_map():
     return revision_heads_map.keys()
 
 
-def read_current_airflow_version():
-
-    ast_obj = ast.parse(open(SETUP_FILE).read())
-    assignments = [a for a in ast_obj.body if isinstance(a, ast.Assign)][:10]
-
-    version = [x for x in assignments if x.targets[0].id == "version"][0]
-
-    return Version(ast.literal_eval(version.value))
-
-
 if __name__ == "__main__":
-    airflow_version = read_current_airflow_version()
+    airflow_version = Version(read_airflow_version())
     if airflow_version.is_devrelease or "b" in (airflow_version.pre or ()):
         exit(0)
     versions = read_revision_heads_map()
diff --git a/scripts/in_container/run_migration_reference.py b/scripts/in_container/run_migration_reference.py
index 0f17c45afb..43692b2c45 100755
--- a/scripts/in_container/run_migration_reference.py
+++ b/scripts/in_container/run_migration_reference.py
@@ -30,13 +30,13 @@ from typing import TYPE_CHECKING, Iterable
 from alembic.script import ScriptDirectory
 from tabulate import tabulate
 
+from airflow import __version__ as airflow_version
 from airflow.utils.db import _get_alembic_config
-from setup import version as _airflow_version
 
 if TYPE_CHECKING:
     from alembic.script import Script
 
-airflow_version = re.match(r"(\d+\.\d+\.\d+).*", _airflow_version).group(1)  # type: ignore
+airflow_version = re.match(r"(\d+\.\d+\.\d+).*", airflow_version).group(1)  # type: ignore
 project_root = Path(__file__).parents[2].resolve()
 
 
diff --git a/setup.cfg b/setup.cfg
index 34fdf014df..e55108fb92 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -21,6 +21,7 @@ summary = Programmatically author, schedule and monitor data pipelines
 author = Apache Software Foundation
 author_email = dev@airflow.apache.org
 url = https://airflow.apache.org/
+version = attr: airflow.__version__
 long_description = file: README.md
 long_description_content_type = text/markdown
 license = Apache License 2.0
@@ -43,6 +44,7 @@ classifiers =
     Framework :: Apache Airflow
 project_urls =
     Documentation=https://airflow.apache.org/docs/
+    Downloads=https://archive.apache.org/dist/airflow/
     Bug Tracker=https://github.com/apache/airflow/issues
     Source Code=https://github.com/apache/airflow
     Slack Chat=https://s.apache.org/airflow-slack
diff --git a/setup.py b/setup.py
index 74f205c0c9..5ed4bb756f 100644
--- a/setup.py
+++ b/setup.py
@@ -49,8 +49,6 @@ PY39 = sys.version_info >= (3, 9)
 
 logger = logging.getLogger(__name__)
 
-version = "2.5.1"
-
 AIRFLOW_SOURCES_ROOT = Path(__file__).parent.resolve()
 PROVIDERS_ROOT = AIRFLOW_SOURCES_ROOT / "airflow" / "providers"
 
@@ -162,7 +160,7 @@ class ListExtras(Command):
         print("\n".join(wrap(", ".join(EXTRAS_DEPENDENCIES.keys()), 100)))
 
 
-def git_version(version_: str) -> str:
+def git_version() -> str:
     """
     Return a version to identify the state of the underlying git repo. The version will
     indicate whether the head of the current git-backed working directory is tied to a
@@ -171,7 +169,6 @@ def git_version(version_: str) -> str:
     branch head. Finally, a "dirty" suffix is appended to indicate that uncommitted
     changes are present.
 
-    :param str version_: Semver version
     :return: Found Airflow version in Git repo
     """
     try:
@@ -179,7 +176,7 @@ def git_version(version_: str) -> str:
 
         try:
             repo = git.Repo(str(AIRFLOW_SOURCES_ROOT / ".git"))
-        except (git.NoSuchPathError):
+        except git.NoSuchPathError:
             logger.warning(".git directory not found: Cannot compute the git version")
             return ""
         except git.InvalidGitRepositoryError:
@@ -193,7 +190,7 @@ def git_version(version_: str) -> str:
         if repo.is_dirty():
             return f".dev0+{sha}.dirty"
         # commit is clean
-        return f".release:{version_}+{sha}"
+        return f".release:{sha}"
     return "no_git_version"
 
 
@@ -203,7 +200,7 @@ def write_version(filename: str = str(AIRFLOW_SOURCES_ROOT / "airflow" / "git_ve
 
     :param str filename: Destination file to write.
     """
-    text = f"{git_version(version)}"
+    text = git_version()
     with open(filename, "w") as file:
         file.write(text)
 
@@ -484,12 +481,12 @@ EXTRAS_DEPENDENCIES: dict[str, list[str]] = deepcopy(CORE_EXTRAS_DEPENDENCIES)
 
 
 def add_extras_for_all_providers() -> None:
-    for (provider_name, provider_dict) in PROVIDER_DEPENDENCIES.items():
+    for provider_name, provider_dict in PROVIDER_DEPENDENCIES.items():
         EXTRAS_DEPENDENCIES[provider_name] = provider_dict[DEPS]
 
 
 def add_additional_extras() -> None:
-    for (extra_name, extra_dependencies) in ADDITIONAL_EXTRAS_DEPENDENCIES.items():
+    for extra_name, extra_dependencies in ADDITIONAL_EXTRAS_DEPENDENCIES.items():
         EXTRAS_DEPENDENCIES[extra_name] = extra_dependencies
 
 
@@ -904,9 +901,7 @@ def do_setup() -> None:
     write_version()
     setup(
         distclass=AirflowDistribution,
-        version=version,
         extras_require=EXTRAS_DEPENDENCIES,
-        download_url=("https://archive.apache.org/dist/airflow/" + version),
         cmdclass={
             "extra_clean": CleanCommand,
             "compile_assets": CompileAssets,


[airflow] 04/04: Update Airflow version to 2.5.2

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch v2-5-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 9f8aa37f8a20df4113df8f11a92a7968d1be103c
Author: pierrejeambrun <pi...@gmail.com>
AuthorDate: Tue Mar 7 22:28:55 2023 +0100

    Update Airflow version to 2.5.2
---
 README.md                                                  | 14 +++++++-------
 airflow/__init__.py                                        |  2 +-
 airflow/api_connexion/openapi/v1.yaml                      |  2 +-
 airflow/utils/db.py                                        |  1 +
 docs/apache-airflow/howto/docker-compose/index.rst         |  4 ++--
 docs/apache-airflow/installation/supported-versions.rst    |  2 +-
 docs/docker-stack/README.md                                | 10 +++++-----
 .../docker-examples/extending/add-apt-packages/Dockerfile  |  2 +-
 .../extending/add-build-essential-extend/Dockerfile        |  2 +-
 .../docker-examples/extending/add-providers/Dockerfile     |  2 +-
 .../docker-examples/extending/add-pypi-packages/Dockerfile |  2 +-
 .../extending/add-requirement-packages/Dockerfile          |  2 +-
 .../docker-examples/extending/custom-providers/Dockerfile  |  2 +-
 .../docker-examples/extending/embedding-dags/Dockerfile    |  2 +-
 .../extending/writable-directory/Dockerfile                |  2 +-
 docs/docker-stack/entrypoint.rst                           | 14 +++++++-------
 scripts/ci/pre_commit/pre_commit_supported_versions.py     |  2 +-
 17 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/README.md b/README.md
index d6fbad7e69..bff83c5a39 100644
--- a/README.md
+++ b/README.md
@@ -86,7 +86,7 @@ Airflow is not a streaming solution, but it is often used to process real-time d
 
 Apache Airflow is tested with:
 
-|                     | Main version (dev)           | Stable version (2.5.1)       |
+|                     | Main version (dev)           | Stable version (2.5.2)       |
 |---------------------|------------------------------|------------------------------|
 | Python              | 3.7, 3.8, 3.9, 3.10          | 3.7, 3.8, 3.9, 3.10          |
 | Platform            | AMD64/ARM64(\*)              | AMD64/ARM64(\*)              |
@@ -158,15 +158,15 @@ them to the appropriate format and workflow that your tool requires.
 
 
 ```bash
-pip install 'apache-airflow==2.5.1' \
- --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.5.1/constraints-3.7.txt"
+pip install 'apache-airflow==2.5.2' \
+ --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.5.2/constraints-3.7.txt"
 ```
 
 2. Installing with extras (i.e., postgres, google)
 
 ```bash
-pip install 'apache-airflow[postgres,google]==2.5.1' \
- --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.5.1/constraints-3.7.txt"
+pip install 'apache-airflow[postgres,google]==2.5.2' \
+ --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.5.2/constraints-3.7.txt"
 ```
 
 For information on installing provider packages, check
@@ -275,7 +275,7 @@ Apache Airflow version life cycle:
 
 | Version   | Current Patch/Minor   | State     | First Release   | Limited Support   | EOL/Terminated   |
 |-----------|-----------------------|-----------|-----------------|-------------------|------------------|
-| 2         | 2.5.1                 | Supported | Dec 17, 2020    | TBD               | TBD              |
+| 2         | 2.5.2                 | Supported | Dec 17, 2020    | TBD               | TBD              |
 | 1.10      | 1.10.15               | EOL       | Aug 27, 2018    | Dec 17, 2020      | June 17, 2021    |
 | 1.9       | 1.9.0                 | EOL       | Jan 03, 2018    | Aug 27, 2018      | Aug 27, 2018     |
 | 1.8       | 1.8.2                 | EOL       | Mar 19, 2017    | Jan 03, 2018      | Jan 03, 2018     |
@@ -305,7 +305,7 @@ They are based on the official release schedule of Python and Kubernetes, nicely
 2. The "oldest" supported version of Python/Kubernetes is the default one until we decide to switch to
    later version. "Default" is only meaningful in terms of "smoke tests" in CI PRs, which are run using this
    default version and the default reference image available. Currently `apache/airflow:latest`
-   and `apache/airflow:2.5.1` images are Python 3.7 images. This means that default reference image will
+   and `apache/airflow:2.5.2` images are Python 3.7 images. This means that default reference image will
    become the default at the time when we start preparing for dropping 3.7 support which is few months
    before the end of life for Python 3.7.
 
diff --git a/airflow/__init__.py b/airflow/__init__.py
index 334139b1d7..3caf65e9e5 100644
--- a/airflow/__init__.py
+++ b/airflow/__init__.py
@@ -51,7 +51,7 @@ from airflow import settings
 
 __all__ = ["__version__", "login", "DAG", "PY36", "PY37", "PY38", "PY39", "PY310", "XComArg"]
 
-__version__ = "2.6.0.dev0"
+__version__ = "2.5.2"
 
 # Make `airflow` an namespace package, supporting installing
 # airflow.providers.* in different locations (i.e. one in site, and one in user
diff --git a/airflow/api_connexion/openapi/v1.yaml b/airflow/api_connexion/openapi/v1.yaml
index a32ac04986..17f1e6278c 100644
--- a/airflow/api_connexion/openapi/v1.yaml
+++ b/airflow/api_connexion/openapi/v1.yaml
@@ -229,7 +229,7 @@ info:
     This means that the server encountered an unexpected condition that prevented it from
     fulfilling the request.
 
-  version: '2.5.1'
+  version: '2.5.2'
   license:
     name: Apache 2.0
     url: http://www.apache.org/licenses/LICENSE-2.0.html
diff --git a/airflow/utils/db.py b/airflow/utils/db.py
index 04f6789d90..4307f0850a 100644
--- a/airflow/utils/db.py
+++ b/airflow/utils/db.py
@@ -77,6 +77,7 @@ REVISION_HEADS_MAP = {
     "2.4.3": "e07f49787c9d",
     "2.5.0": "290244fb8b83",
     "2.5.1": "290244fb8b83",
+    "2.5.2": "290244fb8b83",
 }
 
 
diff --git a/docs/apache-airflow/howto/docker-compose/index.rst b/docs/apache-airflow/howto/docker-compose/index.rst
index e4d169c0ea..928f276680 100644
--- a/docs/apache-airflow/howto/docker-compose/index.rst
+++ b/docs/apache-airflow/howto/docker-compose/index.rst
@@ -288,14 +288,14 @@ you should do those steps:
    to (use correct image tag):
 
 ```
-#image: ${AIRFLOW_IMAGE_NAME:-apache/airflow:2.5.1}
+#image: ${AIRFLOW_IMAGE_NAME:-apache/airflow:2.5.2}
 build: .
 ```
 
 2) Create ``Dockerfile`` in the same folder your ``docker-compose.yaml`` file is with content similar to:
 
 ```
-FROM apache/airflow:2.5.1
+FROM apache/airflow:2.5.2
 ADD requirements.txt .
 RUN pip install -r requirements.txt
 ```
diff --git a/docs/apache-airflow/installation/supported-versions.rst b/docs/apache-airflow/installation/supported-versions.rst
index 38ace709db..67a3ba52f4 100644
--- a/docs/apache-airflow/installation/supported-versions.rst
+++ b/docs/apache-airflow/installation/supported-versions.rst
@@ -29,7 +29,7 @@ Apache Airflow version life cycle:
 =========  =====================  =========  ===============  =================  ================
 Version    Current Patch/Minor    State      First Release    Limited Support    EOL/Terminated
 =========  =====================  =========  ===============  =================  ================
-2          2.5.1                  Supported  Dec 17, 2020     TBD                TBD
+2          2.5.2                  Supported  Dec 17, 2020     TBD                TBD
 1.10       1.10.15                EOL        Aug 27, 2018     Dec 17, 2020       June 17, 2021
 1.9        1.9.0                  EOL        Jan 03, 2018     Aug 27, 2018       Aug 27, 2018
 1.8        1.8.2                  EOL        Mar 19, 2017     Jan 03, 2018       Jan 03, 2018
diff --git a/docs/docker-stack/README.md b/docs/docker-stack/README.md
index 8df4f59cc7..546ff32e3e 100644
--- a/docs/docker-stack/README.md
+++ b/docs/docker-stack/README.md
@@ -31,12 +31,12 @@ Every time a new version of Airflow is released, the images are prepared in the
 [apache/airflow DockerHub](https://hub.docker.com/r/apache/airflow)
 for all the supported Python versions.
 
-You can find the following images there (Assuming Airflow version `2.5.1`):
+You can find the following images there (Assuming Airflow version `2.5.2`):
 
 * `apache/airflow:latest` - the latest released Airflow image with default Python version (3.7 currently)
 * `apache/airflow:latest-pythonX.Y` - the latest released Airflow image with specific Python version
-* `apache/airflow:2.5.1` - the versioned Airflow image with default Python version (3.7 currently)
-* `apache/airflow:2.5.1-pythonX.Y` - the versioned Airflow image with specific Python version
+* `apache/airflow:2.5.2` - the versioned Airflow image with default Python version (3.7 currently)
+* `apache/airflow:2.5.2-pythonX.Y` - the versioned Airflow image with specific Python version
 
 Those are "reference" regular images. They contain the most common set of extras, dependencies and providers that are
 often used by the users and they are good to "try-things-out" when you want to just take Airflow for a spin,
@@ -47,8 +47,8 @@ via [Building the image](https://airflow.apache.org/docs/docker-stack/build.html
 
 * `apache/airflow:slim-latest`              - the latest released Airflow image with default Python version (3.7 currently)
 * `apache/airflow:slim-latest-pythonX.Y`    - the latest released Airflow image with specific Python version
-* `apache/airflow:slim-2.5.1`           - the versioned Airflow image with default Python version (3.7 currently)
-* `apache/airflow:slim-2.5.1-pythonX.Y` - the versioned Airflow image with specific Python version
+* `apache/airflow:slim-2.5.2`           - the versioned Airflow image with default Python version (3.7 currently)
+* `apache/airflow:slim-2.5.2-pythonX.Y` - the versioned Airflow image with specific Python version
 
 The Apache Airflow image provided as convenience package is optimized for size, and
 it provides just a bare minimal set of the extras and dependencies installed and in most cases
diff --git a/docs/docker-stack/docker-examples/extending/add-apt-packages/Dockerfile b/docs/docker-stack/docker-examples/extending/add-apt-packages/Dockerfile
index ab034d218f..73f0c0ac13 100644
--- a/docs/docker-stack/docker-examples/extending/add-apt-packages/Dockerfile
+++ b/docs/docker-stack/docker-examples/extending/add-apt-packages/Dockerfile
@@ -15,7 +15,7 @@
 
 # This is an example Dockerfile. It is not intended for PRODUCTION use
 # [START Dockerfile]
-FROM apache/airflow:2.5.1
+FROM apache/airflow:2.5.2
 USER root
 RUN apt-get update \
   && apt-get install -y --no-install-recommends \
diff --git a/docs/docker-stack/docker-examples/extending/add-build-essential-extend/Dockerfile b/docs/docker-stack/docker-examples/extending/add-build-essential-extend/Dockerfile
index af9cefb613..c061aff942 100644
--- a/docs/docker-stack/docker-examples/extending/add-build-essential-extend/Dockerfile
+++ b/docs/docker-stack/docker-examples/extending/add-build-essential-extend/Dockerfile
@@ -15,7 +15,7 @@
 
 # This is an example Dockerfile. It is not intended for PRODUCTION use
 # [START Dockerfile]
-FROM apache/airflow:2.5.1
+FROM apache/airflow:2.5.2
 USER root
 RUN apt-get update \
   && apt-get install -y --no-install-recommends \
diff --git a/docs/docker-stack/docker-examples/extending/add-providers/Dockerfile b/docs/docker-stack/docker-examples/extending/add-providers/Dockerfile
index 01939b83d0..fc736ca4e7 100644
--- a/docs/docker-stack/docker-examples/extending/add-providers/Dockerfile
+++ b/docs/docker-stack/docker-examples/extending/add-providers/Dockerfile
@@ -15,7 +15,7 @@
 
 # This is an example Dockerfile. It is not intended for PRODUCTION use
 # [START Dockerfile]
-FROM apache/airflow:2.5.1
+FROM apache/airflow:2.5.2
 USER root
 RUN apt-get update \
   && apt-get install -y --no-install-recommends \
diff --git a/docs/docker-stack/docker-examples/extending/add-pypi-packages/Dockerfile b/docs/docker-stack/docker-examples/extending/add-pypi-packages/Dockerfile
index 7f3d150bb1..a2bf47d4e5 100644
--- a/docs/docker-stack/docker-examples/extending/add-pypi-packages/Dockerfile
+++ b/docs/docker-stack/docker-examples/extending/add-pypi-packages/Dockerfile
@@ -15,6 +15,6 @@
 
 # This is an example Dockerfile. It is not intended for PRODUCTION use
 # [START Dockerfile]
-FROM apache/airflow:2.5.1
+FROM apache/airflow:2.5.2
 RUN pip install --no-cache-dir lxml
 # [END Dockerfile]
diff --git a/docs/docker-stack/docker-examples/extending/add-requirement-packages/Dockerfile b/docs/docker-stack/docker-examples/extending/add-requirement-packages/Dockerfile
index bdd31c610e..4512e05a31 100644
--- a/docs/docker-stack/docker-examples/extending/add-requirement-packages/Dockerfile
+++ b/docs/docker-stack/docker-examples/extending/add-requirement-packages/Dockerfile
@@ -15,7 +15,7 @@
 
 # This is an example Dockerfile. It is not intended for PRODUCTION use
 # [START Dockerfile]
-FROM apache/airflow:2.5.1
+FROM apache/airflow:2.5.2
 COPY requirements.txt /
 RUN pip install --no-cache-dir -r /requirements.txt
 # [END Dockerfile]
diff --git a/docs/docker-stack/docker-examples/extending/custom-providers/Dockerfile b/docs/docker-stack/docker-examples/extending/custom-providers/Dockerfile
index 8ae4a23365..cb7eeca79a 100644
--- a/docs/docker-stack/docker-examples/extending/custom-providers/Dockerfile
+++ b/docs/docker-stack/docker-examples/extending/custom-providers/Dockerfile
@@ -15,6 +15,6 @@
 
 # This is an example Dockerfile. It is not intended for PRODUCTION use
 # [START Dockerfile]
-FROM apache/airflow:2.5.1
+FROM apache/airflow:2.5.2
 RUN pip install --no-cache-dir apache-airflow-providers-docker==2.5.1
 # [END Dockerfile]
diff --git a/docs/docker-stack/docker-examples/extending/embedding-dags/Dockerfile b/docs/docker-stack/docker-examples/extending/embedding-dags/Dockerfile
index e21fea1257..f7d67ab0fc 100644
--- a/docs/docker-stack/docker-examples/extending/embedding-dags/Dockerfile
+++ b/docs/docker-stack/docker-examples/extending/embedding-dags/Dockerfile
@@ -15,7 +15,7 @@
 
 # This is an example Dockerfile. It is not intended for PRODUCTION use
 # [START Dockerfile]
-FROM apache/airflow:2.5.1
+FROM apache/airflow:2.5.2
 
 COPY --chown=airflow:root test_dag.py /opt/airflow/dags
 
diff --git a/docs/docker-stack/docker-examples/extending/writable-directory/Dockerfile b/docs/docker-stack/docker-examples/extending/writable-directory/Dockerfile
index 378339974d..cc7a911a18 100644
--- a/docs/docker-stack/docker-examples/extending/writable-directory/Dockerfile
+++ b/docs/docker-stack/docker-examples/extending/writable-directory/Dockerfile
@@ -15,7 +15,7 @@
 
 # This is an example Dockerfile. It is not intended for PRODUCTION use
 # [START Dockerfile]
-FROM apache/airflow:2.5.1
+FROM apache/airflow:2.5.2
 RUN umask 0002; \
     mkdir -p ~/writeable-directory
 # [END Dockerfile]
diff --git a/docs/docker-stack/entrypoint.rst b/docs/docker-stack/entrypoint.rst
index dd43f71dfe..f18e0fc3ba 100644
--- a/docs/docker-stack/entrypoint.rst
+++ b/docs/docker-stack/entrypoint.rst
@@ -132,7 +132,7 @@ if you specify extra arguments. For example:
 
 .. code-block:: bash
 
-  docker run -it apache/airflow:2.5.1-python3.7 bash -c "ls -la"
+  docker run -it apache/airflow:2.5.2-python3.7 bash -c "ls -la"
   total 16
   drwxr-xr-x 4 airflow root 4096 Jun  5 18:12 .
   drwxr-xr-x 1 root    root 4096 Jun  5 18:12 ..
@@ -144,7 +144,7 @@ you pass extra parameters. For example:
 
 .. code-block:: bash
 
-  > docker run -it apache/airflow:2.5.1-python3.7 python -c "print('test')"
+  > docker run -it apache/airflow:2.5.2-python3.7 python -c "print('test')"
   test
 
 If first argument equals to "airflow" - the rest of the arguments is treated as an airflow command
@@ -152,13 +152,13 @@ to execute. Example:
 
 .. code-block:: bash
 
-   docker run -it apache/airflow:2.5.1-python3.7 airflow webserver
+   docker run -it apache/airflow:2.5.2-python3.7 airflow webserver
 
 If there are any other arguments - they are simply passed to the "airflow" command
 
 .. code-block:: bash
 
-  > docker run -it apache/airflow:2.5.1-python3.7 help
+  > docker run -it apache/airflow:2.5.2-python3.7 help
     usage: airflow [-h] GROUP_OR_COMMAND ...
 
     positional arguments:
@@ -363,7 +363,7 @@ database and creating an ``admin/admin`` Admin user with the following command:
     --env "_AIRFLOW_DB_UPGRADE=true" \
     --env "_AIRFLOW_WWW_USER_CREATE=true" \
     --env "_AIRFLOW_WWW_USER_PASSWORD=admin" \
-      apache/airflow:2.5.1-python3.8 webserver
+      apache/airflow:2.5.2-python3.8 webserver
 
 
 .. code-block:: bash
@@ -372,7 +372,7 @@ database and creating an ``admin/admin`` Admin user with the following command:
     --env "_AIRFLOW_DB_UPGRADE=true" \
     --env "_AIRFLOW_WWW_USER_CREATE=true" \
     --env "_AIRFLOW_WWW_USER_PASSWORD_CMD=echo admin" \
-      apache/airflow:2.5.1-python3.8 webserver
+      apache/airflow:2.5.2-python3.8 webserver
 
 The commands above perform initialization of the SQLite database, create admin user with admin password
 and Admin role. They also forward local port ``8080`` to the webserver port and finally start the webserver.
@@ -412,6 +412,6 @@ Example:
     --env "_AIRFLOW_DB_UPGRADE=true" \
     --env "_AIRFLOW_WWW_USER_CREATE=true" \
     --env "_AIRFLOW_WWW_USER_PASSWORD_CMD=echo admin" \
-      apache/airflow:2.5.1-python3.8 webserver
+      apache/airflow:2.5.2-python3.8 webserver
 
 This method is only available starting from Docker image of Airflow 2.1.1 and above.
diff --git a/scripts/ci/pre_commit/pre_commit_supported_versions.py b/scripts/ci/pre_commit/pre_commit_supported_versions.py
index 4c28a71f0d..baac9f2fc3 100755
--- a/scripts/ci/pre_commit/pre_commit_supported_versions.py
+++ b/scripts/ci/pre_commit/pre_commit_supported_versions.py
@@ -27,7 +27,7 @@ AIRFLOW_SOURCES = Path(__file__).resolve().parent.parent.parent.parent
 HEADERS = ("Version", "Current Patch/Minor", "State", "First Release", "Limited Support", "EOL/Terminated")
 
 SUPPORTED_VERSIONS = (
-    ("2", "2.5.1", "Supported", "Dec 17, 2020", "TBD", "TBD"),
+    ("2", "2.5.2", "Supported", "Dec 17, 2020", "TBD", "TBD"),
     ("1.10", "1.10.15", "EOL", "Aug 27, 2018", "Dec 17, 2020", "June 17, 2021"),
     ("1.9", "1.9.0", "EOL", "Jan 03, 2018", "Aug 27, 2018", "Aug 27, 2018"),
     ("1.8", "1.8.2", "EOL", "Mar 19, 2017", "Jan 03, 2018", "Jan 03, 2018"),


[airflow] 01/04: Avoid unneeded Connexion constructs (#29631)

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch v2-5-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 3a7ab400e5debc7697743bfc8f803742b23b6008
Author: Tzu-ping Chung <ur...@gmail.com>
AuthorDate: Tue Feb 21 16:38:55 2023 +0800

    Avoid unneeded Connexion constructs (#29631)
    
    (cherry picked from commit 1edaddbb1cec740db2ff2a86fb23a3a676728cb0)
---
 airflow/www/extensions/init_views.py | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/airflow/www/extensions/init_views.py b/airflow/www/extensions/init_views.py
index 7db06a06c1..e0636a4326 100644
--- a/airflow/www/extensions/init_views.py
+++ b/airflow/www/extensions/init_views.py
@@ -20,13 +20,14 @@ import logging
 import warnings
 from os import path
 
-from connexion import App, ProblemException
+from connexion import FlaskApi, ProblemException
 from flask import Flask, request
 
 from airflow.api_connexion.exceptions import common_error_handler
 from airflow.configuration import conf
 from airflow.exceptions import RemovedInAirflow3Warning
 from airflow.security import permissions
+from airflow.utils.yaml import safe_load
 
 log = logging.getLogger(__name__)
 
@@ -207,20 +208,21 @@ def init_api_connexion(app: Flask) -> None:
         else:
             return views.method_not_allowed(ex)
 
-    spec_dir = path.join(ROOT_APP_DIR, "api_connexion", "openapi")
-    swagger_ui_dir = path.join(ROOT_APP_DIR, "www", "static", "dist", "swagger-ui")
-    options = {
-        "swagger_ui": conf.getboolean("webserver", "enable_swagger_ui", fallback=True),
-        "swagger_path": swagger_ui_dir,
-    }
-    connexion_app = App(__name__, specification_dir=spec_dir, skip_error_handlers=True, options=options)
-    connexion_app.app = app
-    api_bp = connexion_app.add_api(
-        specification="v1.yaml", base_path=base_path, validate_responses=True, strict_validation=True
+    with open(path.join(ROOT_APP_DIR, "api_connexion", "openapi", "v1.yaml")) as f:
+        specification = safe_load(f)
+    api_bp = FlaskApi(
+        specification=specification,
+        base_path=base_path,
+        options={
+            "swagger_ui": conf.getboolean("webserver", "enable_swagger_ui", fallback=True),
+            "swagger_path": path.join(ROOT_APP_DIR, "www", "static", "dist", "swagger-ui"),
+        },
+        strict_validation=True,
+        validate_responses=True,
     ).blueprint
-    # Like "api_bp.after_request", but the BP is already registered, so we have
-    # to register it in the app directly.
-    app.after_request_funcs.setdefault(api_bp.name, []).append(set_cors_headers_on_response)
+    api_bp.after_request(set_cors_headers_on_response)
+
+    app.register_blueprint(api_bp)
     app.register_error_handler(ProblemException, common_error_handler)
     app.extensions["csrf"].exempt(api_bp)