Support for Python 3.10?

未關閉
#921 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
55/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
python
領域
data

研究方向

從 cf/regrid/regrid.py 中 2203 行附近的 mask1 指派處開始,使用 issue 中的命令在 Python 3.10 環境中重現匯入失敗。檢查 tuple 索引的替代方案是否適用於更廣泛的套件,然後驗證 cf 是否能在 Python 3.10 上成功匯入,同時不使受支援的版本發生回歸。

由索引模型根據 Issue 內容生成。

描述

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

主要語言
Python
星號
151
分支
23
平均合併
3 天 9 小時
30 天內合併 PR
2

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

NCAS-CMS/cf-python 的其他 Issue

查看 NCAS-CMS/cf-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。