From 5f9fdc9436897b251d71136841673dfbeeef4f34 Mon Sep 17 00:00:00 2001 From: Wei Lee Date: Thu, 2 Jul 2026 18:36:13 +0800 Subject: [PATCH] Export FanOutMapper and wait policies from airflow.partition_mappers The package root exported every mapper and window except FanOutMapper, WaitForAll, and MinimumCount, while the Task SDK package already exports all three. Align the core exports with their siblings and the SDK. --- .../src/airflow/partition_mappers/__init__.py | 5 ++++ .../tests/unit/partition_mappers/test_init.py | 30 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 airflow-core/tests/unit/partition_mappers/test_init.py diff --git a/airflow-core/src/airflow/partition_mappers/__init__.py b/airflow-core/src/airflow/partition_mappers/__init__.py index f780603870736..fe2157ee98c56 100644 --- a/airflow-core/src/airflow/partition_mappers/__init__.py +++ b/airflow-core/src/airflow/partition_mappers/__init__.py @@ -23,6 +23,7 @@ from airflow.partition_mappers.identity import IdentityMapper from airflow.partition_mappers.product import ProductMapper from airflow.partition_mappers.temporal import ( + FanOutMapper, StartOfDayMapper, StartOfHourMapper, StartOfMonthMapper, @@ -30,6 +31,7 @@ StartOfWeekMapper, StartOfYearMapper, ) +from airflow.partition_mappers.wait_policy import MinimumCount, WaitForAll from airflow.partition_mappers.window import ( DayWindow, HourWindow, @@ -45,9 +47,11 @@ "AllowedKeyMapper", "ChainMapper", "DayWindow", + "FanOutMapper", "FixedKeyMapper", "HourWindow", "IdentityMapper", + "MinimumCount", "MonthWindow", "PartitionMapper", "ProductMapper", @@ -60,6 +64,7 @@ "StartOfQuarterMapper", "StartOfWeekMapper", "StartOfYearMapper", + "WaitForAll", "WeekWindow", "Window", "YearWindow", diff --git a/airflow-core/tests/unit/partition_mappers/test_init.py b/airflow-core/tests/unit/partition_mappers/test_init.py new file mode 100644 index 0000000000000..e7579ec6eec11 --- /dev/null +++ b/airflow-core/tests/unit/partition_mappers/test_init.py @@ -0,0 +1,30 @@ +# 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 airflow.partition_mappers +import airflow.sdk + + +def test_package_root_exports_match_sdk(): + """Every partition-mapper symbol exported from airflow.sdk must also be exported from the core package root.""" + sdk_names = { + name + for name, module in airflow.sdk.__lazy_imports.items() + if module.startswith(".definitions.partition_mappers") + } + assert sdk_names == set(airflow.partition_mappers.__all__)