CASSPYTHON-12 Mark eventlet, gevent and Twisted event loops as deprecated#1279
CASSPYTHON-12 Mark eventlet, gevent and Twisted event loops as deprecated#1279absurdfarce wants to merge 4 commits intoapache:trunkfrom
Conversation
|
Jenkins run looks normal so the deprecation warnings don't seem to interfere with functionality |
|
@absurdfarce I noticed pyproject.toml has mismatched versions. Would be good to align those here. |
There was a problem hiding this comment.
Pull request overview
This PR introduces standardized deprecation warnings for the gevent, eventlet, and Twisted-based connection implementations by using the Deprecated package, and updates the installation docs to reflect the event-loop roadmap.
Changes:
- Add
Deprecatedas a runtime dependency. - Decorate
GeventConnection,EventletConnection, andTwistedConnectionwith@deprecated(...)to emitDeprecationWarnings. - Update documentation for supported event loops and deprecation/removal timelines.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Adds Deprecated to runtime dependencies to support deprecation decorators. |
| docs/installation.rst | Updates supported event loop guidance and notes deprecation/removal plans. |
| cassandra/io/geventreactor.py | Marks GeventConnection class as deprecated via Deprecated. |
| cassandra/io/eventletreactor.py | Marks EventletConnection class as deprecated via Deprecated. |
| cassandra/io/twistedreactor.py | Marks TwistedConnection class as deprecated via Deprecated. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
pyproject.toml
Outdated
| description = "Apache Cassandra Python Driver" | ||
| version = "3.30.0" | ||
| dependencies = ['geomet>=1.1'] | ||
| dependencies = ['geomet>=1.1', "Deprecated"] |
There was a problem hiding this comment.
Deprecated is added as a new runtime dependency, but it is unversioned while the existing core dependency (geomet>=1.1) uses a lower bound. Please add an explicit version specifier for Deprecated (at least a tested minimum), and ensure the dependency lists used for manual/test installs (e.g., requirements.txt referenced by docs and test-requirements.txt) are kept in sync so from deprecated import deprecated doesn't fail in those workflows.
| dependencies = ['geomet>=1.1', "Deprecated"] | |
| dependencies = ['geomet>=1.1', "Deprecated>=1.2.0"] |
There was a problem hiding this comment.
Sure, okay. It seems quite unlikely that (a) venvs (or an equivalent) with older versions of deprecated would even wind up being used and (b) even if they were they prolly wouldn't be likely to break things but sure, I guess it doesn't hurt anything.
My testing was done locally with deprecated 1.3.1 so I'm going with that.
| available via Python modules or C extensions. Python 3.12 has removed ``asyncore`` entirely | ||
| so for this platform one of these other event loops must be used. | ||
| The ``asyncore`` and ``libev`` event loops are proven production-grade event loops. Python 3.12 removed | ||
| asyncore from the runtime but this event loop can still be used in newer versions of Python via the |
There was a problem hiding this comment.
In this paragraph, asyncore is mentioned without literal formatting while other module names are consistently marked up (e.g., asyncore / libev). For consistency and to avoid Sphinx formatting drift, wrap this asyncore occurrence in double backticks.
| asyncore from the runtime but this event loop can still be used in newer versions of Python via the | |
| ``asyncore`` from the runtime but this event loop can still be used in newer versions of Python via the |
There was a problem hiding this comment.
I disagree with this suggestion for two reasons.
First, I prefer the idea of highlighting the first usage of a name and then leaving all other subsequent usages to be rendered as regular text.
Second (and perhaps more importantly): the second usage refers to the asyncore package in the Python runtime and not the asyncore event loop built on that package. They are two different things and using the same formatting to indicate the would confuse the issue.
|
Good catch on the pyproject.toml mismatch @bschoening. The classifiers weren't updated in general so Python 3.14 also isn't there. I'll have a fix coming momentarily. |
…n versions and the list of versions we included in the classifiers.
| description = "Apache Cassandra Python Driver" | ||
| version = "3.30.0" | ||
| dependencies = ['geomet>=1.1'] | ||
| dependencies = ['geomet>=1.1', "Deprecated>=1.3.1"] |
There was a problem hiding this comment.
Worth noting that this dependency will only be present for this release. The plan is to remove the event loops in question in the next release (currently slated to be 3.31.0) and at that time deprecated can be removed as a dependency as well.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Leverage the deprecated Python package to handle most of the heavy lifting here.
Local testing confirms that gevent connections still work and that the deprecation warning is printed as expected: