From 599c8db9efcd4cd372792a2bcae3cc555f9e2072 Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Sun, 13 Oct 2024 23:26:00 +0100 Subject: [PATCH] Add py3.13 support w/ minimal deps (#4732) * Add Python 3.13 to minimal CI testing, and include some minor test shims to accommodate. --- .github/workflows/deploy.yaml | 4 ++-- .github/workflows/gh-ci-cron.yaml | 4 +--- .github/workflows/gh-ci.yaml | 5 +++++ azure-pipelines.yml | 2 +- package/CHANGELOG | 1 + package/pyproject.toml | 3 ++- testsuite/MDAnalysisTests/analysis/test_base.py | 8 ++++---- testsuite/MDAnalysisTests/lib/test_log.py | 4 ++-- 8 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 09a79a64c20..5db1a4f5c16 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -41,7 +41,7 @@ jobs: - [macos-12, macosx_*, x86_64] - [windows-2019, win_amd64, AMD64] - [macos-14, macosx_*, arm64] - python: ["cp310", "cp311", "cp312"] + python: ["cp310", "cp311", "cp312", "cp313"] defaults: run: working-directory: ./package @@ -243,7 +243,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11", "3.12", "3.13"] type: ["FULL", "MIN"] exclude: # Multiple deps don't like windows diff --git a/.github/workflows/gh-ci-cron.yaml b/.github/workflows/gh-ci-cron.yaml index 0df5ad460f3..072d1cecb51 100644 --- a/.github/workflows/gh-ci-cron.yaml +++ b/.github/workflows/gh-ci-cron.yaml @@ -41,8 +41,6 @@ jobs: os-type: "ubuntu" - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} # minimally install nightly wheels & core deps - name: nightly_wheels @@ -197,7 +195,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/gh-ci.yaml b/.github/workflows/gh-ci.yaml index 8a45aec650f..c07535e2f78 100644 --- a/.github/workflows/gh-ci.yaml +++ b/.github/workflows/gh-ci.yaml @@ -32,6 +32,11 @@ jobs: full-deps: [true, ] codecov: [true, ] include: + - name: python_313 + os: ubuntu-latest + python-version: "3.13" + full-deps: false + codecov: true - name: macOS_monterey_py311 os: macOS-12 python-version: "3.12" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 250f3ba63b5..27b1c0db3f9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -47,7 +47,7 @@ jobs: PYTHON_VERSION: '3.12' PYTHON_ARCH: 'x64' BUILD_TYPE: 'wheel' - NUMPY_MIN: '1.26.0' + NUMPY_MIN: '2.1.0' imageName: 'ubuntu-latest' Linux-Python310-64bit-full-wheel: PYTHON_VERSION: '3.10' diff --git a/package/CHANGELOG b/package/CHANGELOG index b284ffddeec..de7fddd2660 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -56,6 +56,7 @@ Fixes * Fix groups.py doctests using sphinx directives (Issue #3925, PR #4374) Enhancements + * MDAnalysis now supports Python 3.13 (PR #4732) * Introduce parallelization API to `AnalysisBase` and to `analysis.rms.RMSD` class (Issue #4158, PR #4304) * Enables parallelization for analysis.gnm.GNMAnalysis (Issue #4672) diff --git a/package/pyproject.toml b/package/pyproject.toml index 3d1ea04bddb..24d726c3ab4 100644 --- a/package/pyproject.toml +++ b/package/pyproject.toml @@ -61,6 +61,7 @@ classifiers = [ 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'Programming Language :: C', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Bio-Informatics', @@ -124,6 +125,6 @@ MDAnalysis = [ [tool.black] line-length = 79 -target-version = ['py310', 'py311', 'py312'] +target-version = ['py310', 'py311', 'py312', 'py313'] extend-exclude = '.' required-version = '24' diff --git a/testsuite/MDAnalysisTests/analysis/test_base.py b/testsuite/MDAnalysisTests/analysis/test_base.py index 623b2ca5fe1..345e0dc671e 100644 --- a/testsuite/MDAnalysisTests/analysis/test_base.py +++ b/testsuite/MDAnalysisTests/analysis/test_base.py @@ -345,17 +345,17 @@ def test_verbose_progressbar(u, capsys): def test_verbose_progressbar_run(u, capsys): FrameAnalysis(u.trajectory).run(verbose=True) _, err = capsys.readouterr() - expected = u'100%|██████████| 98/98 [00:00<00:00, 8799.49it/s]' + expected = u'100%|██████████' actual = err.strip().split('\r')[-1] - assert actual[:24] == expected[:24] + assert actual[:15] == expected def test_verbose_progressbar_run_with_kwargs(u, capsys): FrameAnalysis(u.trajectory).run( verbose=True, progressbar_kwargs={'desc': 'custom'}) _, err = capsys.readouterr() - expected = u'custom: 100%|██████████| 98/98 [00:00<00:00, 8799.49it/s]' + expected = u'custom: 100%|██████████' actual = err.strip().split('\r')[-1] - assert actual[:30] == expected[:30] + assert actual[:23] == expected def test_progressbar_multiprocessing(u): diff --git a/testsuite/MDAnalysisTests/lib/test_log.py b/testsuite/MDAnalysisTests/lib/test_log.py index c0f413ba2d2..acaa876df92 100644 --- a/testsuite/MDAnalysisTests/lib/test_log.py +++ b/testsuite/MDAnalysisTests/lib/test_log.py @@ -32,9 +32,9 @@ def test_output(self, capsys): for i in ProgressBar(list(range(10))): pass out, err = capsys.readouterr() - expected = u'100%|██████████| 10/10 [00:00<00:00, 583.67it/s]' + expected = u'100%|██████████' actual = err.strip().split('\r')[-1] - assert actual[:24] == expected[:24] + assert actual[:15] == expected def test_disable(self, capsys): for i in ProgressBar(list(range(10)), disable=True):