Support for Python 3.10?

Abierto
#921 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
python
Área
data

Línea de trabajo

Comienza en cf/regrid/regrid.py, en la asignación de mask1 alrededor de la línea 2203, y reproduce el fallo de importación en un entorno Python 3.10 usando los comandos del issue. Comprueba si la solución alternativa de indexación de tuplas funciona para el paquete más amplio y, después, verifica que cf se importe correctamente en Python 3.10 sin provocar regresiones en las versiones compatibles.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug?

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

Lenguaje dominante
Python
Estrellas
151
Forks
23
Merge medio
3 d 9 h
PR fusionados (30 d)
2

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NCAS-CMS/cf-python

Todos los issues de NCAS-CMS/cf-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.