Skip to content

Commit b5c085f

Browse files
committed
Ban new httpx imports in airflow-core
The Dag processor API client kept catching httpx exceptions after the Task SDK client moved to httpx2, and nothing at lint time flagged the mismatch. With httpx banned, the next mix-up is a ruff error instead of failing tests; the modules not yet migrated are exempt until #70522 moves them.
1 parent 4d61fc0 commit b5c085f

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

‎airflow-core/pyproject.toml‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ dependencies = [
103103
# parsed with no field-count or field-size bound at all.
104104
"starlette>=1.3.1",
105105
"httpx>=0.25.0",
106-
# Only for InProcessExecutionAPI's transports, which feed httpx2-based Task SDK clients.
107-
# The rest of airflow-core is still on httpx; tracked at https://github.com/apache/airflow/issues/70522
106+
# Only for code that talks to the httpx2-based Task SDK client: InProcessExecutionAPI's transports
107+
# and the Dag processor's API client. The rest of airflow-core is still on httpx; tracked at
108+
# https://github.com/apache/airflow/issues/70522
108109
"httpx2>=2.0.0",
109110
'importlib_metadata>=6.5;python_version<"3.12"',
110111
'importlib_metadata>=7.0;python_version>="3.12"',
@@ -332,6 +333,21 @@ required-version = ">=0.11.8"
332333
apache-airflow-core = {workspace = true}
333334
apache-airflow-devel-common = { workspace = true }
334335

336+
[tool.ruff]
337+
extend = "../pyproject.toml"
338+
339+
# Not yet migrated to httpx2; tracked at https://github.com/apache/airflow/issues/70522
340+
[tool.ruff.lint.extend-per-file-ignores]
341+
"src/airflow/api/client/local_client.py" = ["TID251"]
342+
"src/airflow/api_fastapi/auth/tokens.py" = ["TID251"]
343+
"src/airflow/example_dags/example_dag_decorator.py" = ["TID251"]
344+
"tests/unit/api_fastapi/auth/test_tokens.py" = ["TID251"]
345+
"tests/unit/api_fastapi/core_api/routes/public/test_dag_sources.py" = ["TID251"]
346+
"tests/unit/api_fastapi/execution_api/versions/head/test_hitl.py" = ["TID251"]
347+
348+
[tool.ruff.lint.flake8-tidy-imports.extend-banned-api]
349+
"httpx".msg = "Use httpx2; httpx objects do not interoperate with the httpx2-based Task SDK client. See https://github.com/apache/airflow/issues/70522"
350+
335351
[tool.airflow]
336352
shared_distributions = [
337353
"apache-airflow-shared-configuration",

0 commit comments

Comments
 (0)