art22s opened a new pull request, #71130: URL: https://github.com/apache/airflow/pull/71130
## Summary This PR migrates the `task-sdk` package from `httpx` to `httpx2` as a proof-of-concept to test compatibility and identify any issues, as suggested by @potiuk in #70522. ### Background The `httpx` library may not be actively maintained, and `httpx2` (a fork of `httpx==0.28.1`) has been created with bug fixes and improvements. The maintainer of `starlette` has confirmed that starlette will migrate to `httpx2`, making the migration from `httpx` in FastAPI an eventuality. ### Approach Following the [httpx2 migration guide](https://httpx2.pydantic.dev/migration/), this PR uses the `import httpx2 as httpx` alias approach, which: - Keeps the diff minimal — no need to change any `httpx.X` references in the code - Both `httpx` and `httpx2` can coexist in the same environment, so `airflow-core` and providers that still depend on `httpx` are unaffected - Allows incremental migration — each package/subpackage can be migrated independently ### Changes - **task-sdk/pyproject.toml**: Changed dependency from `httpx>=0.27.0` to `httpx2>=0.28.1` - **task-sdk/src/airflow/sdk/api/client.py**: `import httpx` → `import httpx2 as httpx` - **task-sdk/src/airflow/sdk/execution_time/supervisor.py**: `import httpx` → `import httpx2 as httpx` - **task-sdk/tests/task_sdk/__init__.py**: `import httpx` → `import httpx2 as httpx` - **task-sdk/tests/task_sdk/api/test_client.py**: `import httpx` → `import httpx2 as httpx` - **task-sdk/tests/task_sdk/execution_time/test_supervisor.py**: `import httpx` → `import httpx2 as httpx` - **task-sdk/dev/generate_task_sdk_models.py**: `import httpx` → `import httpx2 as httpx` ### Notes - `certifi` usage in `client.py` is retained as-is — it is used directly for SSL context configuration, not through httpx, and is independent of the httpx/httpx2 choice - The `httpx2` package has the same public API as `httpx 0.28.1`, so no code changes are needed beyond the import statements - Known behavior differences in `httpx2`: SSL verification uses OS trust store via `truststore` instead of `certifi` bundled certs, User-Agent header changes to `python-httpx2/<version>` ## Test plan - [ ] Run task-sdk tests locally: `pytest task-sdk/tests/task_sdk/` - [ ] Verify `httpx2` installs cleanly alongside `httpx` in the same environment - [ ] Verify `Client` class (subclass of `httpx.Client` → `httpx2.Client`) works correctly - [ ] Verify `MockTransport` behavior is compatible - [ ] CI checks pass ##### Was generative AI tooling used to co-author this PR? - [X] Yes (Claude) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
