mirror of
https://github.com/apache/airflow.git
synced 2026-11-04 07:12:48 +00:00
* Drop Python 3.10 from CI, Breeze and the container images Python 3.10 reaches end of life in October 2026 and more and more of Airflow's dependencies have already dropped it, which makes the 3.10 leg the slowest and most fragile part of CI. This is the first layer of the stack that moves the baseline to Python 3.11: Breeze stops offering 3.10, the default Python for CI, Breeze and the images moves to 3.11, and the PGP path for verifying the Python tarball goes away because every remaining version ships Sigstore bundles. Python 3.10 stays in the historical version lists that Breeze uses to reason about older Airflow releases, and in the CI image restore action that release branches still rely on. The distributions still declare Python 3.10 in this layer; layer 7 bumps them once the code no longer carries 3.10-only constructs. Until then the provider metadata generator keeps its own 3.10-inclusive version list, and the prek minimum-Python check keeps 3.10 because its script header still pins it to a 3.10 interpreter until layer 2. The shared-distribution and scripts test jobs run uv without an interpreter pin, so uv picks the runner's system Python, which is 3.10 on the current images. Pinning them to the default CI Python keeps them on a supported interpreter regardless of the runner image. The image build speed check builds the CI image from the registry cache within a fixed budget. A PR that changes install_os_dependencies.sh or the embedded GPG keys misses the cache for the layer that compiles Python from source. That compile took about 4.5 minutes for Python 3.10 but 11 to 18 minutes for 3.11 and newer on hosted runners, so the budget is raised to fit a cold Python 3.11+ build. * Explain when to drop a Python version from the CI version list The comment above ALL_PYTHON_MAJOR_MINOR_VERSIONS described only keeping dropped versions so cherry-picks to older branches stay tested. Python 3.10 is removed from the list because the 3.10 drop is also cherry-picked to v3-4-test, so no release branch that still receives cherry-picks from main supports 3.10. The comment now spells out both phases so the next version drop follows the same rule. The Docker image changelog gets its Python 3.10 entry under Airflow 3.4.0 here, next to the image change itself, as was done for Python 3.9.
97 lines
3.0 KiB
Python
97 lines
3.0 KiB
Python
# 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
|
|
|
|
import os
|
|
|
|
from python_on_whales import docker
|
|
|
|
from docker_tests.constants import DEFAULT_DOCKER_IMAGE
|
|
|
|
|
|
def run_cmd_in_docker(
|
|
cmd: list[str] | None = None,
|
|
image: str | None = None,
|
|
entrypoint: str | None = None,
|
|
envs: dict[str, str] | None = None,
|
|
remove: bool = True,
|
|
**kwargs,
|
|
):
|
|
cmd = cmd or []
|
|
envs = envs or {}
|
|
return docker.run(
|
|
image=image or os.environ.get("DOCKER_IMAGE") or DEFAULT_DOCKER_IMAGE,
|
|
entrypoint=entrypoint,
|
|
command=cmd,
|
|
remove=remove,
|
|
envs={"COLUMNS": "180", **envs},
|
|
**kwargs,
|
|
)
|
|
|
|
|
|
def run_bash_in_docker(bash_script: str, **kwargs):
|
|
kwargs.pop("entrypoint", None)
|
|
return run_cmd_in_docker(cmd=["-c", bash_script], entrypoint="/bin/bash", **kwargs)
|
|
|
|
|
|
def run_python_in_docker(python_script, **kwargs):
|
|
kwargs.pop("entrypoint", None)
|
|
envs = {"PYTHONDONTWRITEBYTECODE": "true", **kwargs.pop("envs", {})}
|
|
return run_cmd_in_docker(cmd=["python", "-c", python_script], envs=envs, **kwargs)
|
|
|
|
|
|
def run_airflow_cmd_in_docker(cmd: list[str] | None = None, **kwargs):
|
|
kwargs.pop("entrypoint", None)
|
|
return run_cmd_in_docker(cmd=["airflow", *(cmd or [])], **kwargs)
|
|
|
|
|
|
def display_dependency_conflict_message():
|
|
print(
|
|
"""
|
|
***** Beginning of the instructions ****
|
|
|
|
The image did not pass 'pip check' verification. This means that there are some conflicting dependencies
|
|
in the image.
|
|
|
|
It can mean one of those:
|
|
|
|
1) The main is currently broken (other PRs will fail with the same error)
|
|
2) You changed some dependencies in pyproject.toml (either manually or automatically by prek)
|
|
and they are conflicting.
|
|
|
|
|
|
|
|
In case 1) - apologies for the trouble.Please let committers know and they will fix it. You might
|
|
be asked to rebase to the latest main after the problem is fixed.
|
|
|
|
In case 2) - Follow the steps below:
|
|
|
|
* try to build CI and then PROD image locally with breeze, adding --upgrade-to-newer-dependencies flag
|
|
(repeat it for all python versions)
|
|
|
|
CI image:
|
|
|
|
breeze ci-image build --upgrade-to-newer-dependencies --python 3.11
|
|
|
|
Production image:
|
|
|
|
breeze ci-image build --production-image --upgrade-to-newer-dependencies --python 3.11
|
|
|
|
***** End of the instructions ****
|
|
"""
|
|
)
|