Skip to content

Commit c85447f

Browse files
committed
Add support for Python 3.13
1 parent 1781dc9 commit c85447f

File tree

324 files changed

+1072
-843
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

324 files changed

+1072
-843
lines changed

.github/actions/post_tests_success/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ runs:
4747
uses: codecov/codecov-action@v4
4848
env:
4949
CODECOV_TOKEN: ${{ inputs.codecov-token }}
50-
if: env.ENABLE_COVERAGE == 'true' && env.TEST_TYPES != 'Helm' && inputs.python-version != '3.12'
50+
if: >
51+
env.ENABLE_COVERAGE == 'true' && env.TEST_TYPES != 'Helm' && inputs.python-version != '3.12'
52+
&& inputs.python-version != '3.13'
5153
with:
5254
name: coverage-${{env.JOB_ID}}
5355
flags: python-${{ env.PYTHON_MAJOR_MINOR_VERSION }},${{ env.BACKEND }}-${{ env.BACKEND_VERSION }}

.github/actions/prepare_all_ci_images/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,9 @@ runs:
6666
platform: ${{ inputs.platform }}
6767
python: "3.12"
6868
python-versions-list-as-string: ${{ inputs.python-versions-list-as-string }}
69+
- name: "Restore CI docker image ${{ inputs.platform }}:3.13"
70+
uses: ./.github/actions/prepare_single_ci_image
71+
with:
72+
platform: ${{ inputs.platform }}
73+
python: "3.13"
74+
python-versions-list-as-string: ${{ inputs.python-versions-list-as-string }}

Dockerfile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ else
111111
exit 1
112112
fi
113113

114+
PYTHON_MAJOR_MINOR_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}', end='')")
115+
114116
function get_dev_apt_deps() {
115117
if [[ "${DEV_APT_DEPS=}" == "" ]]; then
116118
DEV_APT_DEPS="apt-transport-https apt-utils build-essential ca-certificates dirmngr \
@@ -182,6 +184,12 @@ function install_debian_dev_dependencies() {
182184
echo
183185
# shellcheck disable=SC2086
184186
apt-get install -y --no-install-recommends ${DEV_APT_DEPS} ${ADDITIONAL_DEV_APT_DEPS}
187+
# TODO(potiuk) remove me: until we got pendulum released with Python 3.13 support, we have to
188+
# install latest cargo to support let..else statement from pendulum
189+
if [[ "${PYTHON_MAJOR_MINOR_VERSION}" == "3.13" ]]; then
190+
echo "Installing cargo"
191+
curl https://sh.rustup.rs -sSf | sh -s -- -y
192+
fi
185193
}
186194

187195
function install_debian_runtime_dependencies() {
@@ -202,6 +210,12 @@ function install_debian_runtime_dependencies() {
202210
apt-get autoremove -yqq --purge
203211
apt-get clean
204212
rm -rf /var/lib/apt/lists/* /var/log/*
213+
# TODO(potiuk) remove me: until we got pendulum released with Python 3.13 support, we have to
214+
# install latest cargo to support let..else statement from pendulum
215+
if [[ "${PYTHON_MAJOR_MINOR_VERSION}" == "3.13" ]]; then
216+
echo "Installing cargo"
217+
curl https://sh.rustup.rs -sSf | sh -s -- -y
218+
fi
205219
}
206220

207221
if [[ "${INSTALLATION_TYPE}" == "RUNTIME" ]]; then
@@ -1459,7 +1473,7 @@ COPY --from=scripts install_mysql.sh install_mssql.sh install_postgres.sh /scrip
14591473
RUN bash /scripts/docker/install_mysql.sh dev && \
14601474
bash /scripts/docker/install_mssql.sh dev && \
14611475
bash /scripts/docker/install_postgres.sh dev
1462-
ENV PATH=${PATH}:/opt/mssql-tools/bin
1476+
ENV PATH=${HOME}/.cargo/bin:${PATH}:/opt/mssql-tools/bin
14631477

14641478
# By default we do not install from docker context files but if we decide to install from docker context
14651479
# files, we should override those variables to "docker-context-files"

Dockerfile.ci

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ else
5050
exit 1
5151
fi
5252

53+
PYTHON_MAJOR_MINOR_VERSION=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}', end='')")
54+
5355
function get_dev_apt_deps() {
5456
if [[ "${DEV_APT_DEPS=}" == "" ]]; then
5557
DEV_APT_DEPS="apt-transport-https apt-utils build-essential ca-certificates dirmngr \
@@ -121,6 +123,12 @@ function install_debian_dev_dependencies() {
121123
echo
122124
# shellcheck disable=SC2086
123125
apt-get install -y --no-install-recommends ${DEV_APT_DEPS} ${ADDITIONAL_DEV_APT_DEPS}
126+
# TODO(potiuk) remove me: until we got pendulum released with Python 3.13 support, we have to
127+
# install latest cargo to support let..else statement from pendulum
128+
if [[ "${PYTHON_MAJOR_MINOR_VERSION}" == "3.13" ]]; then
129+
echo "Installing cargo"
130+
curl https://sh.rustup.rs -sSf | sh -s -- -y
131+
fi
124132
}
125133

126134
function install_debian_runtime_dependencies() {
@@ -141,6 +149,12 @@ function install_debian_runtime_dependencies() {
141149
apt-get autoremove -yqq --purge
142150
apt-get clean
143151
rm -rf /var/lib/apt/lists/* /var/log/*
152+
# TODO(potiuk) remove me: until we got pendulum released with Python 3.13 support, we have to
153+
# install latest cargo to support let..else statement from pendulum
154+
if [[ "${PYTHON_MAJOR_MINOR_VERSION}" == "3.13" ]]; then
155+
echo "Installing cargo"
156+
curl https://sh.rustup.rs -sSf | sh -s -- -y
157+
fi
144158
}
145159

146160
if [[ "${INSTALLATION_TYPE}" == "RUNTIME" ]]; then
@@ -1357,8 +1371,8 @@ ENV AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION} \
13571371
UV_LINK_MODE=copy \
13581372
AIRFLOW_PRE_COMMIT_VERSION=${AIRFLOW_PRE_COMMIT_VERSION}
13591373

1360-
# The PATH is needed for PIPX to find the tools installed
1361-
ENV PATH="/root/.local/bin:${PATH}"
1374+
# The PATH is needed for PIPX to find the tools installed and cargo to build the wheels
1375+
ENV PATH="/root/.local/bin:/root/.cargo/bin:${PATH}"
13621376

13631377
# Useful for creating a cache id based on the underlying architecture, preventing the use of cached python packages from
13641378
# an incorrect architecture.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ Airflow is not a streaming solution, but it is often used to process real-time d
9696

9797
Apache Airflow is tested with:
9898

99-
| | Main version (dev) | Stable version (2.10.5) |
100-
|------------|------------------------|----------------------------|
101-
| Python | 3.9, 3.10, 3.11, 3.12 | 3.8, 3.9, 3.10, 3.11, 3.12 |
102-
| Platform | AMD64/ARM64(\*) | AMD64/ARM64(\*) |
103-
| Kubernetes | 1.29, 1.30, 1.31, 1.32 | 1.27, 1.28, 1.29, 1.30 |
104-
| PostgreSQL | 13, 14, 15, 16, 17 | 12, 13, 14, 15, 16 |
105-
| MySQL | 8.0, 8.4, Innovation | 8.0, 8.4, Innovation |
106-
| SQLite | 3.15.0+ | 3.15.0+ |
99+
| | Main version (dev) | Stable version (2.10.5) |
100+
|------------|-----------------------------|----------------------------|
101+
| Python | 3.9, 3.10, 3.11, 3.12, 3.13 | 3.8, 3.9, 3.10, 3.11, 3.12 |
102+
| Platform | AMD64/ARM64(\*) | AMD64/ARM64(\*) |
103+
| Kubernetes | 1.29, 1.30, 1.31, 1.32 | 1.27, 1.28, 1.29, 1.30 |
104+
| PostgreSQL | 13, 14, 15, 16, 17 | 12, 13, 14, 15, 16 |
105+
| MySQL | 8.0, 8.4, Innovation | 8.0, 8.4, Innovation |
106+
| SQLite | 3.15.0+ | 3.15.0+ |
107107

108108
\* Experimental
109109

airflow-core/docs/installation/prerequisites.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Prerequisites
2020

2121
Airflow® is tested with:
2222

23-
* Python: 3.9, 3.10, 3.11, 3.12
23+
* Python: 3.9, 3.10, 3.11, 3.12, 3.13
2424

2525
* Databases:
2626

airflow-core/docs/start.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This quick start guide will help you bootstrap an Airflow standalone instance on
2424

2525
.. note::
2626

27-
Successful installation requires a Python 3 environment. Starting with Airflow 2.7.0, Airflow supports Python 3.9, 3.10, 3.11, and 3.12.
27+
Successful installation requires a Python 3 environment. Starting with Airflow 2.7.0, Airflow supports Python 3.9, 3.10, 3.11, 3.12, 3.13.
2828

2929
Officially supported installation methods include ``pip`` and ``uv``. Both tools provide a streamlined workflow for installing Airflow and managing dependencies.
3030

airflow-core/pyproject.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ name = "apache-airflow-core"
3535
description = "Core packages for Apache Airflow, schedule and API server"
3636
readme = { file = "README.md", content-type = "text/markdown" }
3737
license-files.globs = ["LICENSE", "3rd-party-licenses/*.txt", "NOTICE"]
38-
requires-python = "~=3.9,<3.13"
38+
requires-python = "~=3.9,<3.14"
3939
authors = [
4040
{ name = "Apache Software Foundation", email = "[email protected]" },
4141
]
@@ -106,6 +106,7 @@ dependencies = [
106106
"pathspec>=0.9.0",
107107
'pendulum>=2.1.2,<4.0;python_version<"3.12"',
108108
'pendulum>=3.0.0,<4.0;python_version>="3.12"',
109+
'pendulum @ git+https://github.com/python-pendulum/pendulum.git ; python_version>="3.13"',
109110
"pluggy>=1.5.0",
110111
"psutil>=5.8.0",
111112
"pydantic>=2.11.0",
@@ -194,10 +195,8 @@ dependencies = [
194195
]
195196

196197
"pandas" = [
197-
# In pandas 2.2 minimal version of the sqlalchemy is 2.0
198-
# https://pandas.pydata.org/docs/whatsnew/v2.2.0.html#increased-minimum-versions-for-dependencies
199-
# However Airflow not fully supports it yet: https://github.com/apache/airflow/issues/28723
200-
"pandas>=2.1.2,<2.3",
198+
'pandas>=2.1.2; python_version <"3.13"',
199+
'pandas>=2.2.0; python_version >="3.13"',
201200
]
202201
"rabbitmq" = [
203202
"amqp>=5.2.0",
@@ -239,7 +238,6 @@ Mastodon = "https://fosstodon.org/@airflow"
239238
Bluesky = "https://bsky.app/profile/apache-airflow.bsky.social"
240239
YouTube = "https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/"
241240

242-
243241
[tool.hatch.version]
244242
path = "src/airflow/__init__.py"
245243

@@ -275,6 +273,9 @@ exclude = [
275273
"src/airflow/api_fastapi/auth/managers/simple/ui/node_modules",
276274
]
277275

276+
[tool.hatch.metadata]
277+
allow-direct-references = true
278+
278279
[dependency-groups]
279280
dev = [
280281
"apache-airflow-core[all]",

airflow-core/src/airflow/cli/commands/dag_command.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ def dag_test(args, dag: DAG | None = None, session: Session = NEW_SESSION) -> No
646646
logical_date = args.logical_date or timezone.utcnow()
647647
use_executor = args.use_executor
648648

649+
# TODO(potiuk): we should likely get rid of rege passed by user here
649650
mark_success_pattern = (
650651
re.compile(args.mark_success_pattern) if args.mark_success_pattern is not None else None
651652
)

airflow-core/src/airflow/metrics/validators.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ def _has_pattern_match(self, name: str) -> bool:
253253
return False
254254

255255

256+
# TODO(potiuk): check if regexp pattern matching in list validations are safe
256257
class PatternAllowListValidator(ListValidator):
257258
"""Match the provided strings anywhere in the metric name."""
258259

@@ -263,6 +264,7 @@ def test(self, name: str) -> bool:
263264
return True # default is all metrics are allowed
264265

265266

267+
# TODO(potiuk): check if regexp pattern matching in list validations are safe
266268
class PatternBlockListValidator(ListValidator):
267269
"""Only allow names that do not match the blocked strings."""
268270

0 commit comments

Comments
 (0)