Skip to content

Add Python 3.13 support for Airflow. - #46891

Merged
potiuk merged 4 commits into
apache:mainfrom
potiuk:add-python-3-13-support
Jul 17, 2025
Merged

Add Python 3.13 support for Airflow.#46891
potiuk merged 4 commits into
apache:mainfrom
potiuk:add-python-3-13-support

Conversation

@potiuk

@potiukpotiuk commented Feb 19, 2025

Copy link
Copy Markdown
Member

Added Python 3.13 support across the codebase, including:

  • CI/CD workflow updates to handle Python 3.13.
  • Dockerfile and environment variable adjustments for compatibility.
  • Documentation updates to list Python 3.13 as supported.
  • Dependency and code changes for compatibility with new/changed
    libraries (e.g., numpy 2.x, greenlet, pendulum).
  • Test and plugin manager adjustments for Python 3.13-specific behaviors.
  • Removal or skipping of tests and features not compatible with Python 3.13.
  • Improved error handling and logging for unsupported plugins/providers
    on Python 3.13.
  • Updated all provider README.rst files to:
    • List Python 3.13 as a supported version.
    • Adjust dependency requirements for Python 3.13 (e.g., pandas,
      pyarrow, ray, etc.).
    • Add or update notes about excluded or conditionally supported
      dependencies for Python 3.13.
    • Document any known incompatibilities or workarounds for specific
      providers.
  • Updated all provider pyproject.toml files and automation to:
    • Add Python 3.13 to the supported classifiers.
    • Adjust requires-python and dependency constraints for Python 3.13.
    • Exclude Python 3.13 for providers that are not yet compatible (e.g.,
      those depending on Flask AppBuilder).
    • Add conditional dependencies for new versions of libraries required
      by Python 3.13.
  • Updated Breeze and related scripts to:
  • Build and test with Python 3.13.
  • Update documentation and release scripts to include Python 3.13.
  • Ensure all dev tooling and test environments work with Python 3.13.
  • Removed remaining FAB related code from core and removed tests for
    older FAB provider versions (<1.3.0)
  • some of the tests in core still depend on FAB - but we make them
    optional - both for parsing (we need to skip some imports) and
    execution - because they test a legacy behaviour of embedding
    Flask plugins that is still supported in core.
  • k8s tests now run also with SimpleAuthManager and SimpleAuthManager
    is used automatically when runnin tests in Python 3.13
  • migration tests had to be excluded fo Python 3.13 because we cannot
    migrate down on Python 3.13 without FAB tables created. The tests
    will be brought back when FAB is supported or when we release 3.1
    and start working on 3.2, we should be able to migrate down to 3.1
  • Weaviate tests have been updated to handle case where weaviate-client
    is > 2.10.0 - because it started to use httpx instead of requests,
    and Python 3.13 actually unblocks using older version of weaviate
    (it was previously blocked indirectly via Flask dependencies and
    grpcio).
  • Added doc change in our rules on what is the "default" Python version
    for airflow images - handling the case where we cannot use "newest"
    Python version as default where not all "regular" image providers are
    supported in the latest version
  • Connection is now flushed in configure_git_connection_for_dag_bundle
    just before clear_db_connections - in order to handle Python 3.13
    case where FAB app is not initialized by other fixtures - performing
    implicit flush along the way
  • Cleaning db connections was added to test_dag_run and test_dags test
    in fast_api as the test implicitly rely on having connections
    cleared (no test git connections added) - this will make the tests
    side-effect free.

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@potiuk
potiukforce-pushed the add-python-3-13-support branch from 9888b0f to f4f2031CompareFebruary 19, 2025 17:16
@potiukpotiuk added the legacy api Whether legacy API changes should be allowed in PR label Feb 19, 2025
@potiuk
potiukforce-pushed the add-python-3-13-support branch 3 times, most recently from 9c6e93c to b40bf29CompareFebruary 19, 2025 17:44
@potiuk
potiukforce-pushed the add-python-3-13-support branch from b40bf29 to 21a34cbCompareFebruary 19, 2025 18:22
@Lee-W
Lee-W self-requested a review February 20, 2025 07:04
@potiuk
potiukforce-pushed the add-python-3-13-support branch 2 times, most recently from 004dd04 to ec6553dCompareFebruary 20, 2025 15:41
@potiukpotiuk mentioned this pull request Feb 23, 2025
@potiuk
potiukforce-pushed the add-python-3-13-support branch 4 times, most recently from 9d382f4 to 25c5d7aCompareMarch 1, 2025 16:21
@potiuk
potiukforce-pushed the add-python-3-13-support branch 3 times, most recently from 50fc7ee to be6b595CompareMarch 9, 2025 21:52
@potiuk
potiukforce-pushed the add-python-3-13-support branch 3 times, most recently from 4cf2cc3 to b9c8b2bCompareApril 13, 2025 12:26
@potiukpotiuk added full tests needed We need to run full set of tests for this PR to merge all versions If set, the CI build will be forced to use all versions of Python/K8S/DBs labels Apr 13, 2025
@potiuk
potiukforce-pushed the add-python-3-13-support branch 2 times, most recently from 5e1cd92 to c85447fCompareApril 13, 2025 13:32
@potiuk
potiukforce-pushed the add-python-3-13-support branch 3 times, most recently from e39c0f9 to 2d88b64CompareApril 27, 2025 21:07
Comment threadairflow-core/tests/unit/jobs/test_triggerer_job.py
Comment threaddev/breeze/src/airflow_breeze/utils/publish_docs_to_s3.py
Comment threadkubernetes-tests/tests/kubernetes_tests/test_base.py Fixed
Comment threaddocker-stack-docs/index.rst Outdated

@jscheffljscheffl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another review round. LIKE It. Special thanks for also adding notes to the selective areas where upper version binding is made. Hope we remember this in future.

Also I very much like the proposal to keep the non-versioned reference image with 3.12 and upgrade as soon as standard installed providers are all Python 3.13 capable. Especially having reference image w/o Fab would make it hardly usable and would confuse users.

I would be happy to get this merged.

Thanks for the efforts.

Comment threaddocker-stack-docs/index.rst Outdated
Comment threadairflow-core/tests/unit/api_fastapi/core_api/routes/public/test_plugins.py Outdated
Comment threadairflow-core/tests/unit/api_fastapi/conftest.py Outdated

@amoghrajeshamoghrajesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some qns / nits on commit 2

Comment thread.pre-commit-config.yaml
Comment threadairflow-core/pyproject.toml
Comment threaddev/breeze/tests/test_selective_checks.py Outdated
Comment threadproviders/amazon/pyproject.toml Outdated
Comment threadproviders/apache/beam/pyproject.toml
Comment threadscripts/ci/pre_commit/update_airflow_pyproject_toml.py
Comment threadairflow-core/pyproject.toml Outdated
Comment threadairflow-core/src/airflow/api_fastapi/core_api/app.py
Comment threadairflow-core/tests/unit/always/test_example_dags.py
Comment threadtask-sdk/pyproject.toml

@aritra24aritra24 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great Jarek! Had a minor nit, but other than that all looks good from a high level.

Comment threadDockerfile.ci Outdated
@potiuk

Copy link
Copy Markdown
MemberAuthor

Pushed changes trying out the comments in places I am not sure.

@gopidesupavangopidesupavan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @potiuk for all the work, may iterations not an easy task .

@gopidesupavan

Copy link
Copy Markdown
Member

#protm

Added Python 3.13 support across the codebase, including:
* CI/CD workflow updates to handle Python 3.13.
* Dockerfile and environment variable adjustments for compatibility.
* Documentation updates to list Python 3.13 as supported.
* Dependency and code changes for compatibility with new/changed
libraries (e.g., numpy 2.x, greenlet, pendulum).
* Test and plugin manager adjustments for Python 3.13-specific behaviors.
* Removal or skipping of tests and features not compatible with Python 3.13.
* Improved error handling and logging for unsupported plugins/providers
on Python 3.13.
* Updated all provider README.rst files to:
* List Python 3.13 as a supported version.
* Adjust dependency requirements for Python 3.13 (e.g., pandas,
pyarrow, ray, etc.).
* Add or update notes about excluded or conditionally supported
dependencies for Python 3.13.
* Document any known incompatibilities or workarounds for specific
providers.
* Updated all provider pyproject.toml files and automation to:
* Add Python 3.13 to the supported classifiers.
* Adjust requires-python and dependency constraints for Python 3.13.
* Exclude Python 3.13 for providers that are not yet compatible (e.g.,
those depending on Flask AppBuilder).
* Add conditional dependencies for new versions of libraries required
by Python 3.13.
* Updated Breeze and related scripts to:
* Build and test with Python 3.13.
* Update documentation and release scripts to include Python 3.13.
* Ensure all dev tooling and test environments work with Python 3.13.
* Removed remaining FAB related code from core and removed tests for
older FAB provider versions (<1.3.0)
* some of the tests in core still depend on FAB - but we make them
optional - both for parsing (we need to skip some imports) and
execution - because they test a legacy behaviour of embedding
Flask plugins that is still supported in core.
* k8s tests now run also with SimpleAuthManager and SimpleAuthManager
is used automatically when runnin tests in Python 3.13
* migration tests had to be excluded fo Python 3.13 because we cannot
migrate down on Python 3.13 without FAB tables created. The tests
will be brought back when FAB is supported or when we release 3.1
and start working on 3.2, we should be able to migrate down to 3.1
* Weaviate tests have been updated to handle case where weaviate-client
is > 2.10.0 - because it started to use httpx instead of requests,
and Python 3.13 actually unblocks using older version of weaviate
(it was previously blocked indirectly via Flask dependencies and
grpcio).
* Added doc change in our rules on what is the "default" Python version
for airflow images - handling the case where we cannot use "newest"
Python version as default where not all "regular" image providers are
supported in the latest version
* Connection is now flushed in `configure_git_connection_for_dag_bundle`
just before `clear_db_connections` - in order to handle Python 3.13
case where FAB app is not initialized by other fixtures - performing
implicit flush along the way
* Cleaning db connections was added to test_dag_run and test_dags test
in fast_api as the test implicitly rely on having connections
cleared (no test git connections added) - this will make the tests
side-effect free.
* Conditionally skipping some serialization tests involving yandex
and ray on Python 3.13 until they support Python 3.13
@potiuk

Copy link
Copy Markdown
MemberAuthor

Aaand merged :)

@aritra24

Copy link
Copy Markdown
Collaborator

Long effort!! Great job!

@shahar1

Copy link
Copy Markdown
Contributor

#protm for sure, great job Jarek! :)

@eladkal

Copy link
Copy Markdown
Contributor

🎉 🎉🎉

@jscheffl

Copy link
Copy Markdown
Contributor

Wohoo! Party!

@kyungjunleeme

Copy link
Copy Markdown
Contributor

Cool!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

all versionsIf set, the CI build will be forced to use all versions of Python/K8S/DBsarea:dev-toolsfull tests neededWe need to run full set of tests for this PR to mergelegacy apiWhether legacy API changes should be allowed in PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

11 participants

@potiuk@eladkal@jscheffl@gopidesupavan@aritra24@shahar1@kyungjunleeme@Dev-iL@amoghrajesh@github-advanced-security@vincbeck