Skip to content

Wrap form data and await form to fix mypy issues in amazon provider#68857

Merged
potiuk merged 1 commit into
apache:mainfrom
bugraoz93:wrap-form-data
Jun 22, 2026
Merged

Wrap form data and await form to fix mypy issues in amazon provider#68857
potiuk merged 1 commit into
apache:mainfrom
bugraoz93:wrap-form-data

Conversation

@bugraoz93

@bugraoz93 bugraoz93 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Main Canary Run: https://github.com/apache/airflow/actions/runs/27970332910/job/82777675902

Error:

    providers/amazon/src/airflow/providers/amazon/aws/auth_manager/routes/login.py:104: error: Need type annotation for "form_data"  [var-annotated]
            form_data = anyio.from_thread.run(request.form)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    providers/amazon/src/airflow/providers/amazon/aws/auth_manager/routes/login.py:104: error: Argument 1 to "run" has incompatible type
    "def form(self, *, max_files: int | float = ..., max_fields: int | float = ..., max_part_size: int = ...) -> AwaitableOrContextManager[FormData]"; expected "Callable[[], Coroutine[Any, Any, Never]]" 
    [arg-type]
            form_data = anyio.from_thread.run(request.form)
                                              ^~~~~~~~~~~~
    providers/amazon/src/airflow/providers/amazon/aws/auth_manager/routes/login.py:154: error: Need type annotation for "form_data"  [var-annotated]
            form_data = anyio.from_thread.run(request.form)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    providers/amazon/src/airflow/providers/amazon/aws/auth_manager/routes/login.py:154: error: Argument 1 to "run" has incompatible type
    "def form(self, *, max_files: int | float = ..., max_fields: int | float = ..., max_part_size: int = ...) -> AwaitableOrContextManager[FormData]"; expected "Callable[[], Coroutine[Any, Any, Never]]" 
    [arg-type]
            form_data = anyio.from_thread.run(request.form)
                                              ^~~~~~~~~~~~
    Found 4 errors in 1 file (checked 4582 source files)

What changed?

  • FormData imported under if TYPE_CHECKING: (satisfies ruff TC002).
  • TYPE_CHECKING added to the typing import.
  • _read_form(request) helper wrapping request.form() in a real coroutine — fixes both mypy errors (var-annotated + arg-type) with no type: ignore.
  • Both call sites use _read_form(request).

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)
    Claude Opus 4.8

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@bugraoz93 bugraoz93 requested review from o-nikolas and vincbeck June 22, 2026 19:29
@boring-cyborg boring-cyborg Bot added area:providers provider:amazon AWS/Amazon - related issues labels Jun 22, 2026

@vincbeck vincbeck 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.

What does it solve?

@bugraoz93

Copy link
Copy Markdown
Contributor Author

What does it solve?

Sorry for the missing description! Updating..
It fixes some problem here, we can define as var: FormData but that still not solving all issues
https://github.com/apache/airflow/actions/runs/27970332910/job/82777675902

@bugraoz93

Copy link
Copy Markdown
Contributor Author

Description has been updated. I initially cast with var: FormData, then checked with Claude. We can put ignore as well @vincbeck

@bugraoz93 bugraoz93 changed the title Wrap form data and await form Wrap form data and await form to fix mypy issues in amazon provider Jun 22, 2026
@SameerMesiah97

Copy link
Copy Markdown
Contributor

What does it solve?

The issue is breaking main. I ran into this exact CI failure in PR #68775 .

@seanghaeli

Copy link
Copy Markdown
Contributor

Running into the same CI failures

@SameerMesiah97 SameerMesiah97 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.

Looks like you have addressed both lines of code causing the MyPy checks to fail. Approved pending green CI.

@potiuk potiuk merged commit 216ac75 into apache:main Jun 22, 2026
81 checks passed
cetingokhan pushed a commit to cetingokhan/airflow that referenced this pull request Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants