Skip to content

Python 3.12 compatibility: distutils removal and setuptools dependency #804

@abilun

Description

@abilun

The issue:

ccm relies on distutils in parts of the codebase, which can break on Python 3.12.
distutils is no longer available in stdlib on Python 3.12
Additionally, ccm does not declare setuptools as a dependency, so setuptools is not guaranteed to be available, which can lead to failtures.

Proposed direction:
Make sure that setuptools is listed as a dependency or replace the functionality provided by the distutils package.

Traceback:
../../../../.local/share/uv/python/cpython-3.12.12-macos-aarch64-none/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/integration/test_cluster.py:3: in <module>
    from ccm import launch_cassandra_cluster
tests/integration/ccm.py:1: in <module>
    import ccmlib.cluster
.venv/lib/python3.12/site-packages/ccmlib/cluster.py:18: in <module>
    from ccmlib import common, extension, repository
.venv/lib/python3.12/site-packages/ccmlib/common.py:20: in <module>
    from distutils.version import LooseVersion  #pylint: disable=import-error, no-name-in-module
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   ModuleNotFoundError: No module named 'distutils'

CCM version: 3.1.5
Python: cpython-3.12.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions