Skip to content

Incompatibility between Airflow 3.0.6 and FastAPI 0.121.0 #57752

@hnomichith

Description

@hnomichith

Apache Airflow version

Other Airflow 2/3 version

If "Other Airflow 2/3 version" selected, which one?

3.0.6

What happened?

Hello,

Today, FastAPI released a new minor version, going from 0.120.4 to 0.121.0.

This new release has moved the is_async_gen_callable method from fastapi.dependants.utils to being a method on the fastapi.dependants.models.Dependant data class.

It triggered an error from a project using Airflow 3.0.6:

ImportError while loading conftest '/home/runner/work/scraping-toolbox/scraping-toolbox/scraping-toolbox-core/tests/conftest.py'.
tests/conftest.py:6: in <module>
    from airflow.utils.db import check, resetdb
.tox/py313-airflow30/lib/python3.13/site-packages/airflow/utils/db.py:59: in <module>
    from airflow.utils.db_manager import RunDBManager
.tox/py313-airflow30/lib/python3.13/site-packages/airflow/utils/db_manager.py:26: in <module>
    from airflow.api_fastapi.app import create_auth_manager
.tox/py313-airflow30/lib/python3.13/site-packages/airflow/api_fastapi/app.py:35: in <module>
    from airflow.api_fastapi.execution_api.app import create_task_execution_api_app
.tox/py313-airflow30/lib/python3.13/site-packages/airflow/api_fastapi/execution_api/app.py:27: in <module>
    from cadwyn import (
.tox/py313-airflow30/lib/python3.13/site-packages/cadwyn/__init__.py:3: in <module>
    from .applications import Cadwyn
.tox/py313-airflow30/lib/python3.13/site-packages/cadwyn/applications.py:31: in <module>
    from cadwyn.changelogs import CadwynChangelogResource, _generate_changelog
.tox/py313-airflow30/lib/python3.13/site-packages/cadwyn/changelogs.py:21: in <module>
    from cadwyn.route_generation import _get_routes
.tox/py313-airflow30/lib/python3.13/site-packages/cadwyn/route_generation.py:34: in <module>
    from cadwyn.schema_generation import (
.tox/py313-airflow30/lib/python3.13/site-packages/cadwyn/schema_generation.py:30: in <module>
    from fastapi.dependencies.utils import is_async_gen_callable, is_coroutine_callable, is_gen_callable
E   ImportError: cannot import name 'is_async_gen_callable' from 'fastapi.dependencies.utils' (/home/runner/work/scraping-toolbox/scraping-toolbox/scraping-toolbox-core/.tox/py313-airflow30/lib/python3.13/site-packages/fastapi/dependencies/utils.py)
py313-airflow30: exit 4 (4.45 seconds) /home/runner/work/scraping-toolbox/scraping-toolbox/scraping-toolbox-core> pytest pid=2405
  py313-airflow30: FAIL code 4 (25.57=setup[21.12]+cmd[4.45] seconds)
  evaluation failed :( (25.60 seconds)

I would guess the issue could be fixed here by adding a maximum version ; but we could also consider fixing the import.

What you think should happen instead?

Airflow 3.0 shouldn't have an incompatibility with FastAPI.

How to reproduce

  • Create a new folder
  • Start a new Python virtual environment with whatever tool you prefer (I used Mise and UV)
  • I installed apache-airflow==3.0.6 with uv add apache-airflow==3.0.6.
  • I checked fastapi version with uv pip show fastapi, it was indeed fastapi==0.121.0
  • Then in the Python console, I reproducted the issue with from airflow.utils.db import check, resetdb

Operating System

Ubuntu 24.04.3 LTS

Versions of Apache Airflow Providers

apache-airflow-providers-common-compat==1.8.0
apache-airflow-providers-common-io==1.6.4
apache-airflow-providers-common-sql==1.28.2
apache-airflow-providers-smtp==2.3.1
apache-airflow-providers-standard==1.9.1

Deployment

Astronomer

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:APIAirflow's REST/HTTP APIarea:corekind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions