From 7dbee0788587f8064d90bcc32532bd10220b337d Mon Sep 17 00:00:00 2001 From: Agisilaos Kounelis Date: Mon, 2 Sep 2024 13:26:42 +0300 Subject: [PATCH 1/3] Drop 3.8 support --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/workflows/python-ci-full.yml | 2 +- .github/workflows/python-ci-minimal.yml | 2 +- apis/python/pyproject.toml | 2 +- apis/python/setup.py | 5 ++--- .../src/tiledbsoma/_general_utilities.py | 20 ++++++------------- apis/python/tests/test_funcs.py | 6 +----- libtiledbsoma/README.md | 2 +- 8 files changed, 14 insertions(+), 27 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 00c757220a..0cf6057224 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -15,7 +15,7 @@ Provide a code example and any sample input data (e.g. an H5AD) as an attachment **Versions (please complete the following information):** - TileDB-SOMA version: - - Language and language version (e.g. Python 3.8, R 4.2.2): + - Language and language version (e.g. Python 3.9, R 4.2.2): - OS (e.g. MacOS, Ubuntu Linux): - Note: you can use `tiledbsoma.show_package_versions()` (Python) or `tiledbsoma::show_package_versions()` (R) diff --git a/.github/workflows/python-ci-full.yml b/.github/workflows/python-ci-full.yml index 8df965e8ba..c3442799b8 100644 --- a/.github/workflows/python-ci-full.yml +++ b/.github/workflows/python-ci-full.yml @@ -25,7 +25,7 @@ jobs: # os: [ubuntu-22.04, macos-12, windows-2019] # TODO: add 3.12 # https://github.com/single-cell-data/TileDB-SOMA/issues/1849 - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11'] include: - runs-on: ubuntu-22.04 cc: gcc-11 diff --git a/.github/workflows/python-ci-minimal.yml b/.github/workflows/python-ci-minimal.yml index 8eaad1ad4b..5052d64fe2 100644 --- a/.github/workflows/python-ci-minimal.yml +++ b/.github/workflows/python-ci-minimal.yml @@ -29,7 +29,7 @@ jobs: matrix: os: [ubuntu-22.04, macos-12] - python-version: ['3.8', '3.11'] + python-version: ['3.9', '3.11'] include: - os: ubuntu-22.04 cc: gcc-11 diff --git a/apis/python/pyproject.toml b/apis/python/pyproject.toml index fd19b1e007..04251e67da 100644 --- a/apis/python/pyproject.toml +++ b/apis/python/pyproject.toml @@ -12,7 +12,7 @@ show_error_codes = true ignore_missing_imports = true warn_unreachable = true strict = true -python_version = 3.8 +python_version = 3.9 [[tool.mypy.overrides]] module = "tiledbsoma._query_condition" diff --git a/apis/python/setup.py b/apis/python/setup.py index ce7cdc9bd1..b2ffddf44a 100644 --- a/apis/python/setup.py +++ b/apis/python/setup.py @@ -288,7 +288,6 @@ def run(self): "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Programming Language :: Python", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -327,7 +326,7 @@ def run(self): setup_requires=["pybind11"], install_requires=[ # Tracked in https://github.com/single-cell-data/TileDB-SOMA/issues/1785 - "anndata != 0.10.0; python_version>='3.8'", + "anndata != 0.10.0", "attrs>=22.2", "numba>=0.58.0", "numpy<2.0", @@ -343,7 +342,7 @@ def run(self): extras_require={ "dev": open("requirements_dev.txt").read(), }, - python_requires=">=3.8", + python_requires=">=3.9", cmdclass={"build_ext": build_ext, "bdist_wheel": bdist_wheel}, version=version.get_version(), ) diff --git a/apis/python/src/tiledbsoma/_general_utilities.py b/apis/python/src/tiledbsoma/_general_utilities.py index 7e592a8bf2..82a4efd4c3 100644 --- a/apis/python/src/tiledbsoma/_general_utilities.py +++ b/apis/python/src/tiledbsoma/_general_utilities.py @@ -5,6 +5,7 @@ """General utility functions. """ +import importlib.metadata import platform import sys import warnings @@ -34,20 +35,11 @@ def get_implementation_version() -> str: Lifecycle: Maturing. """ - if sys.version_info < (3, 8, 0): - from pkg_resources import DistributionNotFound, get_distribution - - try: - return get_distribution("tiledbsoma").version - except DistributionNotFound: - return "unknown" - else: - import importlib.metadata - - try: - return importlib.metadata.version("tiledbsoma") - except importlib.metadata.PackageNotFoundError: - return "unknown" + + try: + return importlib.metadata.version("tiledbsoma") + except importlib.metadata.PackageNotFoundError: + return "unknown" def assert_version_before(major: int, minor: int) -> None: diff --git a/apis/python/tests/test_funcs.py b/apis/python/tests/test_funcs.py index 9a34a8d82e..efe2cb1177 100644 --- a/apis/python/tests/test_funcs.py +++ b/apis/python/tests/test_funcs.py @@ -1,5 +1,4 @@ import inspect -import sys import textwrap import pytest @@ -26,13 +25,10 @@ "(__pos_only, *dont_shadow, do_rename: bytes = b'', **kwargs) -> complex", "(__pos_only, *dont_shadow_, do_rename: bytes = b'', dont_shadow: int, do_rename_: str, **do_rename__: frozenset) -> complex", ), - pytest.param( + ( "(pos_only, some_name, /, dst_both_arg, *args, dst_kwarg=1, **dup_dict: complex)", "(dst_both_arg, dst_kwarg: int = 10, /, dup_dict: dict = (), **kwargs) -> None", "(dst_both_arg_, dst_kwarg_: int = 10, /, dup_dict: dict = (), *, dst_both_arg, dst_kwarg=1, **dup_dict_: complex) -> None", - marks=pytest.mark.skipif( - sys.version_info < (3, 8), reason="/ is new in 3.8" - ), ), ], ) diff --git a/libtiledbsoma/README.md b/libtiledbsoma/README.md index c23cbe9841..648a1f623f 100644 --- a/libtiledbsoma/README.md +++ b/libtiledbsoma/README.md @@ -3,7 +3,7 @@ ## System Dependencies * C++17 compiler -* Python 3.8+ +* Python 3.9+ Run these commands to setup a fresh Ubuntu 22.04 instance (tested on x86 and Arm): ``` From f94dd1a70d4264e488e605ed44b121cbb169ffd1 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Fri, 20 Sep 2024 14:22:09 -0400 Subject: [PATCH 2/3] lint, update numpy type aliases comment --- apis/python/src/tiledbsoma/_types.py | 9 ++++----- apis/python/src/tiledbsoma/io/ingest.py | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apis/python/src/tiledbsoma/_types.py b/apis/python/src/tiledbsoma/_types.py index ab40eb5890..5dc742c252 100644 --- a/apis/python/src/tiledbsoma/_types.py +++ b/apis/python/src/tiledbsoma/_types.py @@ -32,15 +32,14 @@ PDSeries = pd.Series PDIndex = pd.Index - # Type subscription requires python >= 3.9, and we currently only type-check against 3.11. - # TODO: remove these (and unify around subscripted types above) when we drop support for 3.8. + # Tests pass `Matrix` (type alias which includes `NPNDArray`, via `DenseMatrix`), as well as other numpy types, to + # `isinstance`, which causes error "argument 2 cannot be a parameterized generic" using the typedefs in the + # `TYPE_CHECKING` branch above. NPInteger = np.integer NPFloating = np.floating - # This alias likely needs to remain special-cased, even in Python ≥3.11, as tests pass the `Matrix` type alias - # (which includes `NPNDArray` via `DenseMatrix`) to `isinstance`, causing error "argument 2 cannot be a - # parameterized generic". NPNDArray = np.ndarray + Path = Union[str, pathlib.Path] Ids = Union[List[str], List[bytes], List[int]] diff --git a/apis/python/src/tiledbsoma/io/ingest.py b/apis/python/src/tiledbsoma/io/ingest.py index 90f2c6e40f..b7dc9044f7 100644 --- a/apis/python/src/tiledbsoma/io/ingest.py +++ b/apis/python/src/tiledbsoma/io/ingest.py @@ -2655,11 +2655,11 @@ def _ingest_uns_string_array( """ if len(value.shape) == 1: - helper = _ingest_uns_1d_string_array # type:ignore[unreachable] + helper = _ingest_uns_1d_string_array elif len(value.shape) == 2: helper = _ingest_uns_2d_string_array else: - msg = ( # type:ignore[unreachable] + msg = ( f"Skipped {coll.uri}[{key!r}]" f" (uns object): string array is neither one-dimensional nor two-dimensional" ) From 8847690635ea354b8e7aa98dd3292371e8604c4d Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Mon, 23 Sep 2024 16:21:36 -0400 Subject: [PATCH 3/3] Bump R version to `4.3.2` Co-authored-by: John Kerl --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 0cf6057224..e4cd99cadf 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -15,7 +15,7 @@ Provide a code example and any sample input data (e.g. an H5AD) as an attachment **Versions (please complete the following information):** - TileDB-SOMA version: - - Language and language version (e.g. Python 3.9, R 4.2.2): + - Language and language version (e.g. Python 3.9, R 4.3.2): - OS (e.g. MacOS, Ubuntu Linux): - Note: you can use `tiledbsoma.show_package_versions()` (Python) or `tiledbsoma::show_package_versions()` (R)