Skip to content

Support for Python 3.10? #921

@jatkinson1000

Description

@jatkinson1000

Firstly, thank you for maintaining this software.

The latest update of cf-python appears to break for Python 3.10.

Importing leads to a traceback detailed below.

PyPI still lists 3.10 as being supported and there is a possible fix (see below) so we presume this is a bug and not a dropping in support for Python 3.10 (not mentioned in the release notes for cf-python 3.19).

Steps to reproduce:

Create an environment with Python 3.10 and install cf-python, launch a repl, and attempt to import cf.

python3.10 -m venv cf-venv
source cf-venv/bin/activate
pip install cf-python
python
Python 3.10.19 (main, Oct  9 2025, 15:25:03) [Clang 17.0.0 (clang-1700.0.13.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cf

Expected behaviour:

cf-python imported and useable, as is the case for Python >=3.11

Actual behaviour:

Import fails due to invalid syntax

>>> import cf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jwa34/venv/lib/python3.10/site-packages/cf/__init__.py", line 215, in <module>
    from .regrid import RegridOperator
  File "/Users/jwa34/venv/lib/python3.10/site-packages/cf/regrid/__init__.py", line 1, in <module>
    from .regrid import regrid
  File "/Users/jwa34/venv/lib/python3.10/site-packages/cf/regrid/regrid.py", line 2203
    mask1 = mask1[..., *partition]
                       ^
SyntaxError: invalid syntax

Version:

Downloaded: cf_python-3.19.0.tar.gz
Working on M2 Macbook, but reproducible on linux rhel environment and GitHub Workflow.

Possible Solution/Workaround:

Editing the offending line to be a tuple of arguments allows successful import, but this is not extensively tested to you will need to confirm that it is satisfactory for the wider package.

mask1 = mask1[(..., *partition)]

cc @sjavis

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions