From 8279ca604f2b86ff7863a08f4940b42189371cdf Mon Sep 17 00:00:00 2001 From: "Lumberbot (aka Jack)" <39504233+meeseeksmachine@users.noreply.github.com> Date: Fri, 16 Feb 2024 23:15:20 +0100 Subject: [PATCH] Backport PR #1373: Test against and list support for python 3.12 (#1377) Co-authored-by: Isaac Virshup --- .azure-pipelines.yml | 10 +++++----- .github/workflows/benchmark.yml | 2 +- .readthedocs.yml | 2 +- anndata/tests/test_layers.py | 7 ++++++- anndata/tests/test_readwrite.py | 25 ++++++++++++++++++++++--- docs/release-notes/0.10.6.md | 1 + pyproject.toml | 1 + 7 files changed, 37 insertions(+), 11 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 8242f5996..81768c776 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -15,14 +15,14 @@ jobs: vmImage: "ubuntu-22.04" strategy: matrix: - Python3.11: - python.version: "3.11" + Python3.12: + python.version: "3.12" RUN_COVERAGE: yes TEST_TYPE: "coverage" Python3.9: python.version: "3.9" PreRelease: - python.version: "3.11" + python.version: "3.12" DEPENDENCIES_VERSION: "pre-release" TEST_TYPE: "strict-warning" minimum_versions: @@ -105,8 +105,8 @@ jobs: steps: - task: UsePythonVersion@0 inputs: - versionSpec: "3.11" - displayName: "Use Python 3.11" + versionSpec: "3.12" + displayName: "Use Python 3.12" - script: | python -m pip install --upgrade pip diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index a86caf98d..f46beb094 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - python: ["3.11"] + python: ["3.12"] os: [ubuntu-latest] env: diff --git a/.readthedocs.yml b/.readthedocs.yml index ec7305492..764eb57bd 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -2,7 +2,7 @@ version: 2 build: os: ubuntu-20.04 tools: - python: "3.11" + python: "3.12" sphinx: configuration: docs/conf.py fail_on_warning: true # do not change or you will be fired diff --git a/anndata/tests/test_layers.py b/anndata/tests/test_layers.py index 18157118d..0eadffdeb 100644 --- a/anndata/tests/test_layers.py +++ b/anndata/tests/test_layers.py @@ -81,7 +81,12 @@ def test_readwrite_loom(tmp_path): adata = AnnData(X=X, layers=dict(L=L.copy())) with warnings.catch_warnings(): - warnings.simplefilter("ignore", NumbaDeprecationWarning) + warnings.filterwarnings("ignore", category=NumbaDeprecationWarning) + warnings.filterwarnings( + "ignore", + message=r"datetime.datetime.utcnow\(\) is deprecated", + category=DeprecationWarning, + ) adata.write_loom(loom_path) adata_read = read_loom(loom_path, X_name="") diff --git a/anndata/tests/test_readwrite.py b/anndata/tests/test_readwrite.py index 4b59791fd..4521936dd 100644 --- a/anndata/tests/test_readwrite.py +++ b/anndata/tests/test_readwrite.py @@ -392,7 +392,12 @@ def test_readwrite_loom(typ, obsm_mapping, varm_mapping, tmp_path): adata_src.varm["X_b"] = np.zeros((adata_src.n_vars, 3)) with warnings.catch_warnings(): - warnings.simplefilter("ignore", NumbaDeprecationWarning) + warnings.filterwarnings("ignore", category=NumbaDeprecationWarning) + warnings.filterwarnings( + "ignore", + message=r"datetime.datetime.utcnow\(\) is deprecated", + category=DeprecationWarning, + ) adata_src.write_loom(tmp_path / "test.loom", write_obsm_varm=True) adata = ad.read_loom( @@ -427,7 +432,15 @@ def test_readwrite_loom(typ, obsm_mapping, varm_mapping, tmp_path): def test_readloom_deprecations(tmp_path): loom_pth = tmp_path / "test.loom" adata_src = gen_adata((5, 10), obsm_types=[np.ndarray], varm_types=[np.ndarray]) - adata_src.write_loom(loom_pth, write_obsm_varm=True) + + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", category=NumbaDeprecationWarning) + warnings.filterwarnings( + "ignore", + message=r"datetime.datetime.utcnow\(\) is deprecated", + category=DeprecationWarning, + ) + adata_src.write_loom(loom_pth, write_obsm_varm=True) # obsm_names -> obsm_mapping obsm_mapping = {"df": adata_src.obs.columns} @@ -536,7 +549,13 @@ def test_readwrite_empty(read, write, name, tmp_path): def test_read_excel(): - adata = ad.read_excel(HERE / "data/excel.xlsx", "Sheet1", dtype=int) + with warnings.catch_warnings(): + warnings.filterwarnings( + "ignore", + message=r"datetime.datetime.utcnow\(\) is deprecated", + category=DeprecationWarning, + ) + adata = ad.read_excel(HERE / "data/excel.xlsx", "Sheet1", dtype=int) assert adata.X.tolist() == X_list diff --git a/docs/release-notes/0.10.6.md b/docs/release-notes/0.10.6.md index 9fbbbe9e3..1ebde67f3 100644 --- a/docs/release-notes/0.10.6.md +++ b/docs/release-notes/0.10.6.md @@ -17,3 +17,4 @@ ``` * `anndata`'s CI now tests against minimum versions of it's dependencies. As a result, several dependencies had their minimum required version bumped. See diff for details {pr}`1314` {user}`ivirshup` +* `anndata` now tests against Python 3.12 {pr}`1373` {user}`ivirshup` diff --git a/pyproject.toml b/pyproject.toml index dfcabf111..a61ca03f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Bio-Informatics", "Topic :: Scientific/Engineering :: Visualization", ]