You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Bret McGuire (Jira)" <ji...@apache.org> on 2026/02/25 00:10:00 UTC

[jira] [Commented] (CASSPYTHON-10) Use packaging.version for cassandra.util.Version

    [ https://issues.apache.org/jira/browse/CASSPYTHON-10?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18060883#comment-18060883 ] 

Bret McGuire commented on CASSPYTHON-10:
----------------------------------------

Unfortunately I don't think this will be quite as easy as it looks.  packaging.version.Version and cassandra.util.Version follow two different versioning schemes.

 

cassandra.util.Version does something like the following:

 
 * Strip off any trailing string separated by a hyphen at the end of the version and make that the prerelease value
 * Otherwise parse the string assuming components are split by a period.  Expected components are major, minor, patch and build (with build being optional)

 

packaging.version.Version follows the [Python version specifier spec|https://packaging.python.org/en/latest/specifications/version-specifiers/] pretty closely.  As a result it recognizes pre, post and dev releases (as defined in that doc).  But nothing there supports the hyphen separator for prerelease values.

 

cassandra.util.Version appears to be an attempt to implement the _Cassandra_ versioning strategy which does match up pretty closely to the rules outlined above.  Since packaging.version.Version has no notion of this idea of version strings it probably doesn't make sense to try to move to it.

> Use packaging.version for cassandra.util.Version
> ------------------------------------------------
>
>                 Key: CASSPYTHON-10
>                 URL: https://issues.apache.org/jira/browse/CASSPYTHON-10
>             Project: Apache Cassandra Python driver
>          Issue Type: Bug
>            Reporter: Bret McGuire
>            Priority: Normal
>
> Lifted version of [PYTHON-1395|https://datastax-oss.atlassian.net/browse/PYTHON-1395].  Original description follows:
> The class cassandra.util.Version has [the comment|https://github.com/apache/cassandra-python-driver/blob/3.29.3/cassandra/util.py#L1696-L1701]:
>  
> {noformat}
>     """
>     Internal minimalist class to compare versions.
>     A valid version is: <int>.<int>.<int>.<int or str>.
>     TODO: when python2 support is removed, use packaging.version.
>     """{noformat}
> This is used in dtests and may be causing some compatibility issues.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org