Skip to content

Conversation

szymon-miezal
Copy link

@szymon-miezal szymon-miezal commented Aug 22, 2025

What is the issue

The old internal python driver disallows using Python 3.12 in cqlsh.

What does this PR fix and why was it fixed

  • Replace cassandra-driver-internal-only-3.26.0 with 3.29.2
  • Update cqlsh and cqlsh.py to support the new driver version
  • Remove obsolete Python 2.7, 3.7 Docker configurations, update 3.8 Dockerfile
  • Add Python 3.12 Docker configuration support
  • Update requirements.txt and test configurations
  • In ports the work done under CASSANDRA-19245, CASSANDRA-17417 and CASSANDRA-18354

CNDB PR: https://github.com/riptano/cndb/pull/15198.

Copy link

Checklist before you submit for review

  • This PR adheres to the Definition of Done
  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits
  • All new files should contain the DataStax copyright header instead of the Apache License one

@szymon-miezal szymon-miezal force-pushed the HCD-190 branch 2 times, most recently from dfa84f4 to cba0817 Compare August 22, 2025 16:03
Copy link

@szymon-miezal
Copy link
Author

@szymon-miezal szymon-miezal force-pushed the HCD-190 branch 2 times, most recently from 3b89f5d to d062014 Compare August 26, 2025 12:17
@szymon-miezal szymon-miezal changed the title WIP: HCD-190: Bump internal pyhon driver to 3.29.2 WIP: HCD-190: Upgrade internal pyhon driver to 3.29.2 Aug 26, 2025
@szymon-miezal szymon-miezal changed the title WIP: HCD-190: Upgrade internal pyhon driver to 3.29.2 HCD-190: Upgrade internal pyhon driver to 3.29.2 Aug 26, 2025
@michaelsembwever
Copy link
Member

Can you update the commit message to reference those CASSANDRA tickets. This makes life easier for the CC rebaser (e.g. knowing whether they should rebase the commit or throw it away).

Copy link
Member

@tiagomlalves tiagomlalves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Mick on adding the C* tickets.
I've added a minor suggestion. Approving ticket as there's not need for further review rounds.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially we could remove the try clause as this was meant to support older Python versions which we no longer support. I wonder if there aren't more such cases.

Copy link

@adelapena adelapena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but I think we should update:

Also, there are multiple CircleCI jobs using Python 2.7 that we should remove. But, since I think we are not using CircleCI anymore, probably we will be fine with a followup ticket to remove those jobs. Or perhaps even the entire CircleCI config?

@adelapena
Copy link

@szymon-miezal Do we have a companion CNDB PR to verify that this doesn't break something there?

@szymon-miezal
Copy link
Author

@szymon-miezal Do we have a companion CNDB PR to verify that this doesn't break something there?

I did create https://github.com/riptano/cndb/pull/15198 for that purpose, it looks somewhat ok, I mean, the failures seem unrelated but a CNDB-trained eye would be appreciated on it for sure.

@adelapena
Copy link

@szymon-miezal Do we have a companion CNDB PR to verify that this doesn't break something there?

I did create riptano/cndb#15198 for that purpose, it looks somewhat ok, I mean, the failures seem unrelated but a CNDB-trained eye would be appreciated on it for sure.

Thanks, I've just approved the CNDB PR. It will need to be updated after merging this PR.

bin/cqlsh.py Outdated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Python 2.7 doesn't work at all now. Cqlsh will immediately fail with a syntax error before ever reaching this check. So I think we can remove the entire maybe_warn_py2 check and its associated test, test_warn_py2.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. Honestly I wanted to keep this test and see whether it will break in CI but then I realise given https://jenkins-stargazer.aws.dsinternal.org/job/ds-cassandra-pr-gate/job/PR-1960/9/testReport/cqlshlib.python3.8.jdk11.no-cython.x86_64.test.test_cqlsh_output/TestCqlshOutput/ isn't run against python 2.7 (as the config has been removed) it won't be run at all.
And yes you are right, it will fail much earlier in the call-stack so it doesn't make much sense to keep it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the test_no_warn_py3 would serve little value after the deletion of maybe_warn_py2, I think it would make sense to remove it too as part of this little rework.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, that one can be deleted too.

@szymon-miezal
Copy link
Author

I found apache@768bdff, which I figure shall be incorporated as well as part of this effort (given the current state of the patch removes python 2.7 support).

@szymon-miezal
Copy link
Author

The latest commit broke CI, I need to fix it.

Copy link

sonarqubecloud bot commented Sep 2, 2025

@cassci-bot
Copy link

❌ Build ds-cassandra-pr-gate/PR-1960 rejected by Butler


1 regressions found
See build details here


Found 1 new test failures

Test Explanation Runs Upstream
o.a.c.sensors.SensorsReadTest.BeforeFirstTest NEW 🔴 0 / 2

Found 1 known test failures

- Replace cassandra-driver-internal-only-3.26.0 with 3.29.2.
- Update cqlsh and cqlsh.py to support the new driver version.
- Remove obsolete Python 2.7, 3.7 Docker configurations, update 3.8 Dockerfile.
- Add Python 3.12 Docker configuration support.
- Update requirements.txt and test configurations.

Apply review feedback

Review feedback part2
Remove Pytonh 2.7 dependency from saferscanner
Change six functions in cqlshlib to native Python 3 ones.
@szymon-miezal
Copy link
Author

It turns out to be blocked by https://issues.apache.org/jira/browse/CASSANDRA-20053 due to the asyncore removal.
I am going to put it back into the draft stage before the tackle the blocker.

@szymon-miezal szymon-miezal marked this pull request as draft September 4, 2025 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants