Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] Drop support for Python 3.8 #3021

Merged
merged 3 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.2.2):
ryan-williams marked this conversation as resolved.
Show resolved Hide resolved
- 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 @@

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"

Check warning on line 42 in apis/python/src/tiledbsoma/_general_utilities.py

View check run for this annotation

Codecov / codecov/patch

apis/python/src/tiledbsoma/_general_utilities.py#L41-L42

Added lines #L41 - L42 were not covered by tests


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 @@
"""

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 = (

Check warning on line 2662 in apis/python/src/tiledbsoma/io/ingest.py

View check run for this annotation

Codecov / codecov/patch

apis/python/src/tiledbsoma/io/ingest.py#L2662

Added line #L2662 was not covered by tests
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
Loading