From 23d001c9249b1f1ba17a2a0fa770dad6e1ba495f Mon Sep 17 00:00:00 2001 From: Ash Berlin-Taylor Date: Mon, 21 Oct 2024 19:12:14 +0100 Subject: [PATCH 1/2] More correctly work around `uv sync` issue with python 3.10+ only dep Just having the python_version requirement doesn't seem to correctly make uv "fork" the resolver path (Charlie's words/terms), so we either need to specify both module versions here. The other option that could work is putting this in our pyproject.toml ``` [tool.uv] environments = ["python_version >= '3.10'", "python_version < '3.10'"] ``` But having both versions specified keeps the fix localized into the provider so I have chosen this approach --- generated/provider_dependencies.json | 1 + providers/src/airflow/providers/cloudant/provider.yaml | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/generated/provider_dependencies.json b/generated/provider_dependencies.json index 4457556be0da4..7bfbd76acad7f 100644 --- a/generated/provider_dependencies.json +++ b/generated/provider_dependencies.json @@ -353,6 +353,7 @@ "cloudant": { "deps": [ "apache-airflow>=2.8.0", + "ibmcloudant==0.7.0 ; python_version < \"3.10\"", "ibmcloudant==0.9.1 ; python_version >= \"3.10\"" ], "devel-deps": [], diff --git a/providers/src/airflow/providers/cloudant/provider.yaml b/providers/src/airflow/providers/cloudant/provider.yaml index 01a0c0a15d82a..19def5b526b4a 100644 --- a/providers/src/airflow/providers/cloudant/provider.yaml +++ b/providers/src/airflow/providers/cloudant/provider.yaml @@ -48,9 +48,11 @@ versions: dependencies: - apache-airflow>=2.8.0 - # Even though 3.9 is excluded below, we need to make this python_version aware so that `uv` can generate a - # full lock file when building lock file from provider sources + # Even though 3.9 is excluded below, we need to make this python_version aware so that `uv` (at least as of + # 0.4.25) can generate a full lock file when building lock file from provider sources. Seeing the duplicate + # dep makes the UV resolver correctly "fork" and try to come up with alternative solutions. - 'ibmcloudant==0.9.1 ; python_version >= "3.10"' + - 'ibmcloudant==0.7.0 ; python_version < "3.10"' excluded-python-versions: # ibmcloudant transitively brings in urllib3 2.x, but the snowflake provider has a dependency that pins From e099fa42702d7fb226133155f2809bc39882ef4c Mon Sep 17 00:00:00 2001 From: Ash Berlin-Taylor Date: Mon, 21 Oct 2024 19:19:12 +0100 Subject: [PATCH 2/2] Apply suggestions from code review --- providers/src/airflow/providers/cloudant/provider.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/providers/src/airflow/providers/cloudant/provider.yaml b/providers/src/airflow/providers/cloudant/provider.yaml index 19def5b526b4a..706a26210615f 100644 --- a/providers/src/airflow/providers/cloudant/provider.yaml +++ b/providers/src/airflow/providers/cloudant/provider.yaml @@ -51,6 +51,7 @@ dependencies: # Even though 3.9 is excluded below, we need to make this python_version aware so that `uv` (at least as of # 0.4.25) can generate a full lock file when building lock file from provider sources. Seeing the duplicate # dep makes the UV resolver correctly "fork" and try to come up with alternative solutions. + # https://github.com/astral-sh/uv/issues/4668 - 'ibmcloudant==0.9.1 ; python_version >= "3.10"' - 'ibmcloudant==0.7.0 ; python_version < "3.10"'