Skip to content

Commit

Permalink
[python] Drop support for Python 3.8 (#3021)
Browse files Browse the repository at this point in the history
* Drop 3.8 support

* lint, update numpy type aliases comment

* Bump R version to `4.3.2`

Co-authored-by: John Kerl <[email protected]>

---------

Co-authored-by: Agisilaos Kounelis <[email protected]>
Co-authored-by: John Kerl <[email protected]>
  • Loading branch information
3 people authored Sep 25, 2024
1 parent fd1537f commit a724018
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.3.2):
- OS (e.g. MacOS, Ubuntu Linux):
- Note: you can use `tiledbsoma.show_package_versions()` (Python) or `tiledbsoma::show_package_versions()` (R)

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-ci-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-ci-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apis/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions apis/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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(),
)
20 changes: 6 additions & 14 deletions apis/python/src/tiledbsoma/_general_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

"""General utility functions.
"""
import importlib.metadata
import platform
import sys
import warnings
Expand Down Expand Up @@ -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:
Expand Down
9 changes: 4 additions & 5 deletions apis/python/src/tiledbsoma/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
4 changes: 2 additions & 2 deletions apis/python/src/tiledbsoma/io/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
6 changes: 1 addition & 5 deletions apis/python/tests/test_funcs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import inspect
import sys
import textwrap

import pytest
Expand All @@ -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"
),
),
],
)
Expand Down
2 changes: 1 addition & 1 deletion libtiledbsoma/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
```
Expand Down

0 comments on commit a724018

Please sign in to comment.