SIGN IN SIGN UP
apache / airflow UNCLAIMED

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows

44796 0 1 Python
Add tests for scripts and remove redundant sys.path.insert calls (#63598) * Add tests for scripts and remove redundant sys.path.insert calls - Remove 85 redundant `sys.path.insert(0, str(Path(__file__).parent.resolve()))` calls from scripts in ci/prek/, cov/, and in_container/. Python already adds the script's directory to sys.path when running a file directly, making these calls unnecessary. - Keep 6 cross-directory sys.path.insert calls that are genuinely needed (AIRFLOW_CORE_SOURCES_PATH, AIRFLOW_ROOT, etc.). - Add __init__.py files to scripts/ci/ and scripts/ci/prek/ to make them proper Python packages. - Add scripts/pyproject.toml with package discovery and pytest config. - Add 176 tests covering: common_prek_utils (insert_documentation, check_list_sorted, get_provider_id_from_path, ConsoleDiff, etc.), new_session_in_provide_session, check_deprecations, unittest_testcase, changelog_duplicates, newsfragments, checkout_no_credentials, and check_order_dockerfile_extras. - Add scripts tests to CI: new SCRIPTS_FILES file group in selective checks, run-scripts-tests output, and tests-scripts job in basic-tests.yml. - Document scripts as a workspace distribution in CLAUDE.md. * Add pytest as dev dependency for scripts distribution Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Use devel-common instead of pytest for scripts dev dependencies Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix xdist test collection order for newsfragment tests Sort the VALID_CHANGE_TYPES set when passing to parametrize to ensure deterministic test ordering across xdist workers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update scripts/ci/prek/changelog_duplicates.py Co-authored-by: Dev-iL <6509619+Dev-iL@users.noreply.github.com> * Refactor scripts tests: convert setup methods to fixtures and extract constants --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Dev-iL <6509619+Dev-iL@users.noreply.github.com>
2026-03-14 17:22:46 +01:00
# 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.
[build-system]
requires = [
"hatchling==1.29.0",
"packaging==26.0",
"pathspec==1.0.4",
"pluggy==1.6.0",
"tomli==2.4.1; python_version < '3.11'",
Add tests for scripts and remove redundant sys.path.insert calls (#63598) * Add tests for scripts and remove redundant sys.path.insert calls - Remove 85 redundant `sys.path.insert(0, str(Path(__file__).parent.resolve()))` calls from scripts in ci/prek/, cov/, and in_container/. Python already adds the script's directory to sys.path when running a file directly, making these calls unnecessary. - Keep 6 cross-directory sys.path.insert calls that are genuinely needed (AIRFLOW_CORE_SOURCES_PATH, AIRFLOW_ROOT, etc.). - Add __init__.py files to scripts/ci/ and scripts/ci/prek/ to make them proper Python packages. - Add scripts/pyproject.toml with package discovery and pytest config. - Add 176 tests covering: common_prek_utils (insert_documentation, check_list_sorted, get_provider_id_from_path, ConsoleDiff, etc.), new_session_in_provide_session, check_deprecations, unittest_testcase, changelog_duplicates, newsfragments, checkout_no_credentials, and check_order_dockerfile_extras. - Add scripts tests to CI: new SCRIPTS_FILES file group in selective checks, run-scripts-tests output, and tests-scripts job in basic-tests.yml. - Document scripts as a workspace distribution in CLAUDE.md. * Add pytest as dev dependency for scripts distribution Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Use devel-common instead of pytest for scripts dev dependencies Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix xdist test collection order for newsfragment tests Sort the VALID_CHANGE_TYPES set when passing to parametrize to ensure deterministic test ordering across xdist workers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update scripts/ci/prek/changelog_duplicates.py Co-authored-by: Dev-iL <6509619+Dev-iL@users.noreply.github.com> * Refactor scripts tests: convert setup methods to fixtures and extract constants --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Dev-iL <6509619+Dev-iL@users.noreply.github.com>
2026-03-14 17:22:46 +01:00
"trove-classifiers==2026.1.14.14",
]
build-backend = "hatchling.build"
[project]
name = "apache-airflow-scripts"
description = "Scripts and utilities for Apache Airflow CI, Docker, and development"
classifiers = [
"Private :: Do Not Upload",
]
requires-python = ">=3.10,!=3.15"
Add tests for scripts and remove redundant sys.path.insert calls (#63598) * Add tests for scripts and remove redundant sys.path.insert calls - Remove 85 redundant `sys.path.insert(0, str(Path(__file__).parent.resolve()))` calls from scripts in ci/prek/, cov/, and in_container/. Python already adds the script's directory to sys.path when running a file directly, making these calls unnecessary. - Keep 6 cross-directory sys.path.insert calls that are genuinely needed (AIRFLOW_CORE_SOURCES_PATH, AIRFLOW_ROOT, etc.). - Add __init__.py files to scripts/ci/ and scripts/ci/prek/ to make them proper Python packages. - Add scripts/pyproject.toml with package discovery and pytest config. - Add 176 tests covering: common_prek_utils (insert_documentation, check_list_sorted, get_provider_id_from_path, ConsoleDiff, etc.), new_session_in_provide_session, check_deprecations, unittest_testcase, changelog_duplicates, newsfragments, checkout_no_credentials, and check_order_dockerfile_extras. - Add scripts tests to CI: new SCRIPTS_FILES file group in selective checks, run-scripts-tests output, and tests-scripts job in basic-tests.yml. - Document scripts as a workspace distribution in CLAUDE.md. * Add pytest as dev dependency for scripts distribution Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Use devel-common instead of pytest for scripts dev dependencies Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix xdist test collection order for newsfragment tests Sort the VALID_CHANGE_TYPES set when passing to parametrize to ensure deterministic test ordering across xdist workers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update scripts/ci/prek/changelog_duplicates.py Co-authored-by: Dev-iL <6509619+Dev-iL@users.noreply.github.com> * Refactor scripts tests: convert setup methods to fixtures and extract constants --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Dev-iL <6509619+Dev-iL@users.noreply.github.com>
2026-03-14 17:22:46 +01:00
authors = [
{ name = "Apache Software Foundation", email = "dev@airflow.apache.org" },
]
maintainers = [
{ name = "Apache Software Foundation", email = "dev@airflow.apache.org" },
]
version = "0.0.1"
dependencies = [
"astor>=0.8.1",
"jsonschema>=4.19.1",
Add Python 3.14 Support (#63520) * Update python version exclusion to 3.15 * Add 3.14 metadata version classifiers and related constants * Regenerate Breeze command help screenshots * Assorted workarounds to fix breeze image building - constraints are skipped entirely - greenlet pin updated * Exclude cassandra * Exclude amazon * Exclude google * CI: Only add pydantic extra to Airflow 2 migration tests Before this fix there were two separate issues in the migration-test setup for Python 3.14: 1. The migration workflow always passes --airflow-extras pydantic. 2. For Python 3.14, the minimum Airflow version is resolved to 3.2.0 by get_min_airflow_version_for_python.py, and apache-airflow[pydantic]==3.2.0 is not a valid thing to install. So when constraints installation fails, the fallback path tries to install an invalid spec. * Disable DB migration tests for python 3.14 * Enforce werkzeug 3.x for python 3.14 * Increase K8s executor test timeout for Python 3.14 Python 3.14 changed the default multiprocessing start method from 'fork' to 'forkserver' on Linux. The forkserver start method is slower because each new process must import modules from scratch rather than copying the parent's address space. This makes `multiprocessing.Manager()` initialization take longer, causing the test to exceed its 10s timeout. * Adapt LocalExecutor tests for Python 3.14 forkserver default Python 3.14 changed the default multiprocessing start method from 'fork' to 'forkserver' on Linux. Like 'spawn', 'forkserver' doesn't share the parent's address space, so mock patches applied in the test process are invisible to worker subprocesses. - Skip tests that mock across process boundaries on non-fork methods - Add test_executor_lazy_worker_spawning to verify that non-fork start methods defer worker creation and skip gc.freeze - Make test_multiple_team_executors_isolation and test_global_executor_without_team_name assert the correct worker count for each start method instead of assuming pre-spawning - Remove skip from test_clean_stop_on_signal (works on all methods) and increase timeout from 5s to 30s for forkserver overhead Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Bump dependencies to versions supporting 3.14 * Fix PROD image build failing on Python 3.14 due to excluded providers The PROD image build installed all provider wheels regardless of Python version compatibility. Providers like google and amazon that exclude Python 3.14 were still passed to pip, causing resolution failures (e.g. ray has no cp314 wheel on PyPI). Two fixes: - get_distribution_specs.py now reads each wheel's Requires-Python metadata and skips incompatible wheels instead of passing them to pip. - The requires-python specifier generation used !=3.14 which per PEP 440 only excludes 3.14.0, not 3.14.3. Changed to !=3.14.* wildcard. * Split core test types into 2 matrix groups to avoid OOM on Python 3.14 Non-DB core tests use xdist which runs all test types in a single pytest process. With 2059 items across 4 workers, memory accumulates until the OOM killer strikes at ~86% completion (exit code 137). Split core test types into 2 groups (API/Always/CLI and Core/Other/Serialization), similar to how provider tests already use _split_list with NUMBER_OF_LOW_DEP_SLICES. Each group gets ~1000 items, well under the ~1770 threshold where OOM occurs. Update selective_checks test expectations to reflect the 2-group split. * Gracefully handle an already removed password file in fixture The old code had a check-then-act race (if `os.path.exists` → `os.remove`), which fails when the file doesn't exist at removal time. `contextlib.suppress(FileNotFoundError)` handles this atomically — if the file is missing (never created in this xdist worker, or removed between check and delete), it's silently ignored. * Fix OOM and flaky tests in test_process_utils Replace multiprocessing.Process with subprocess.Popen running minimal inline scripts. multiprocessing.Process uses fork(), which duplicates the entire xdist worker memory. At 95% test completion the worker has accumulated hundreds of MBs; forking it triggers the OOM killer (exit code 137) on Python 3.14. subprocess.Popen starts a fresh lightweight process (~10MB) without copying the parent's memory, avoiding the OOM entirely. Also replace the racy ps -ax process counting in TestKillChildProcessesByPids with psutil.pid_exists() checks on the specific PID — the old approach was non-deterministic because unrelated processes could start/stop between measurements. * Add prek hook to validate python_version markers for excluded providers When a provider declares excluded-python-versions in provider.yaml, every dependency string referencing that provider in pyproject.toml must carry a matching python_version marker. Missing markers cause excluded providers to be silently installed as transitive dependencies (e.g. aiobotocore pulling in amazon on Python 3.14). The new check-excluded-provider-markers hook reads exclusions from provider.yaml and validates all dependency strings in pyproject.toml at commit time, preventing regressions like the one fixed in the previous commit. * Update `uv.lock` --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 23:03:46 +02:00
"libcst>=1.1.0; python_version < '3.14'",
"libcst>=1.8.6; python_version >= '3.14'",
Add tests for scripts and remove redundant sys.path.insert calls (#63598) * Add tests for scripts and remove redundant sys.path.insert calls - Remove 85 redundant `sys.path.insert(0, str(Path(__file__).parent.resolve()))` calls from scripts in ci/prek/, cov/, and in_container/. Python already adds the script's directory to sys.path when running a file directly, making these calls unnecessary. - Keep 6 cross-directory sys.path.insert calls that are genuinely needed (AIRFLOW_CORE_SOURCES_PATH, AIRFLOW_ROOT, etc.). - Add __init__.py files to scripts/ci/ and scripts/ci/prek/ to make them proper Python packages. - Add scripts/pyproject.toml with package discovery and pytest config. - Add 176 tests covering: common_prek_utils (insert_documentation, check_list_sorted, get_provider_id_from_path, ConsoleDiff, etc.), new_session_in_provide_session, check_deprecations, unittest_testcase, changelog_duplicates, newsfragments, checkout_no_credentials, and check_order_dockerfile_extras. - Add scripts tests to CI: new SCRIPTS_FILES file group in selective checks, run-scripts-tests output, and tests-scripts job in basic-tests.yml. - Document scripts as a workspace distribution in CLAUDE.md. * Add pytest as dev dependency for scripts distribution Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Use devel-common instead of pytest for scripts dev dependencies Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix xdist test collection order for newsfragment tests Sort the VALID_CHANGE_TYPES set when passing to parametrize to ensure deterministic test ordering across xdist workers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update scripts/ci/prek/changelog_duplicates.py Co-authored-by: Dev-iL <6509619+Dev-iL@users.noreply.github.com> * Refactor scripts tests: convert setup methods to fixtures and extract constants --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Dev-iL <6509619+Dev-iL@users.noreply.github.com>
2026-03-14 17:22:46 +01:00
"packaging>=25.0",
"python-dateutil>=2.8.2",
"pyyaml>=6.0.3",
"requests>=2.31.0",
"rich>=13.6.0",
"rich-click>=1.9.7",
Add tests for scripts and remove redundant sys.path.insert calls (#63598) * Add tests for scripts and remove redundant sys.path.insert calls - Remove 85 redundant `sys.path.insert(0, str(Path(__file__).parent.resolve()))` calls from scripts in ci/prek/, cov/, and in_container/. Python already adds the script's directory to sys.path when running a file directly, making these calls unnecessary. - Keep 6 cross-directory sys.path.insert calls that are genuinely needed (AIRFLOW_CORE_SOURCES_PATH, AIRFLOW_ROOT, etc.). - Add __init__.py files to scripts/ci/ and scripts/ci/prek/ to make them proper Python packages. - Add scripts/pyproject.toml with package discovery and pytest config. - Add 176 tests covering: common_prek_utils (insert_documentation, check_list_sorted, get_provider_id_from_path, ConsoleDiff, etc.), new_session_in_provide_session, check_deprecations, unittest_testcase, changelog_duplicates, newsfragments, checkout_no_credentials, and check_order_dockerfile_extras. - Add scripts tests to CI: new SCRIPTS_FILES file group in selective checks, run-scripts-tests output, and tests-scripts job in basic-tests.yml. - Document scripts as a workspace distribution in CLAUDE.md. * Add pytest as dev dependency for scripts distribution Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Use devel-common instead of pytest for scripts dev dependencies Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix xdist test collection order for newsfragment tests Sort the VALID_CHANGE_TYPES set when passing to parametrize to ensure deterministic test ordering across xdist workers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Update scripts/ci/prek/changelog_duplicates.py Co-authored-by: Dev-iL <6509619+Dev-iL@users.noreply.github.com> * Refactor scripts tests: convert setup methods to fixtures and extract constants --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Dev-iL <6509619+Dev-iL@users.noreply.github.com>
2026-03-14 17:22:46 +01:00
"tabulate>=0.9.0",
"termcolor>=2.3.0",
]
[dependency-groups]
dev = [
"apache-airflow-devel-common",
]
[tool.uv.sources]
apache-airflow-devel-common = {workspace = true}
[tool.hatch.build.targets.sdist]
exclude = ["*"]
[tool.hatch.build.targets.wheel]
packages = ["ci", "cov", "docker", "in_container", "tools"]
[tool.pytest.ini_options]
# "." makes ci.prek.* importable as packages; "ci/prek" makes bare
# "from common_prek_utils import ..." inside those modules resolve correctly
# (mirroring what Python does automatically when scripts are run directly).
pythonpath = [".", "ci/prek", "in_container"]