From 4509fb208bb866999cbbac1b27f0e892c5cdcfcf Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Mon, 11 Mar 2024 20:29:10 +0100 Subject: [PATCH] Exclude Cassandra for Python 3.12 We need to exclude Cassandra separately, in order to make sure that cassandra drivers are not installed in the Python 3.12 image when preparing it from the main branch. Generally speaking the dependencies are cached from the main branch when image is built, which means that the resulting image will still have cassandra driver even if we remove it in final pyproject.toml. The way how to get rid of it is two fold: 1) add the exclusion to main 2) after it is merged, increase the EPOCH number in the Dockerfile.ci in the PR that adds Python 3.12 compatibility --- .../providers/apache/cassandra/provider.yaml | 20 +++++++++++++++++++ generated/provider_dependencies.json | 4 +++- pyproject.toml | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/airflow/providers/apache/cassandra/provider.yaml b/airflow/providers/apache/cassandra/provider.yaml index 9fdbe4a5d4527..a1b09ef22ce3b 100644 --- a/airflow/providers/apache/cassandra/provider.yaml +++ b/airflow/providers/apache/cassandra/provider.yaml @@ -46,6 +46,26 @@ dependencies: - apache-airflow>=2.6.0 - cassandra-driver>=3.13.0 +# Cassandra provider is not yet compatible with Python 3.12 +# The main issue is that python cassandra driver by default uses asyncore which has been deprecated since +# Python 3.6 and removed in Python 3.12 (https://docs.python.org/3.11/library/asyncore.html) +# +# Currently the "wheel" package 3.29.0 distributed for manylinux platform is build without libev support ( +# which could be a viable asyncore replacement), and cassandra driver works in Python 3.12 if it is built +# with libev support (using sdist, having gcc, libev4 and libev-dev installed). But it would be too much to +# expect our users to build the driver from sources to use it with Python 3.12, so we are waiting for the +# next release of cassandra-driver which will have libev support in the wheel package. +# The issue is tracked here https://datastax-oss.atlassian.net/browse/PYTHON-1378 +# +# Another option to get cassandra drive back is to have asyncio support in the driver instead of asyncore: +# The issue is tracked here: https://datastax-oss.atlassian.net/browse/PYTHON-1375 and is scheduled +# to be fixed in cassandra-driver 3.30.0. +# +# All Cassandra tests are automatically skipped if cassandra package is not present, so once you remove the +# exclusion, they will start running for Python 3.12. +# +excluded-python-versions: ['3.12'] + integrations: - integration-name: Apache Cassandra external-doc-url: https://cassandra.apache.org/ diff --git a/generated/provider_dependencies.json b/generated/provider_dependencies.json index e04f2c92c6641..11bf459e27cfc 100644 --- a/generated/provider_dependencies.json +++ b/generated/provider_dependencies.json @@ -90,7 +90,9 @@ ], "devel-deps": [], "cross-providers-deps": [], - "excluded-python-versions": [], + "excluded-python-versions": [ + "3.12" + ], "state": "ready" }, "apache.drill": { diff --git a/pyproject.toml b/pyproject.toml index 69ddb532264e0..58cbcfa0e72eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -573,7 +573,7 @@ apache-beam = [ # source: airflow/providers/apache/beam/provider.yaml "pyarrow>=14.0.1;python_version != \"3.12\"", ] apache-cassandra = [ # source: airflow/providers/apache/cassandra/provider.yaml - "cassandra-driver>=3.13.0", + "cassandra-driver>=3.13.0;python_version != \"3.12\"", ] apache-drill = [ # source: airflow/providers/apache/drill/provider.yaml "apache-airflow[common_sql]",