Skip to content

Commit 15a653d

Browse files
authored
chore(spm): drop support for python 3.7 (#106)
Reached end-of-life over a year ago and no longer supported by our upcoming dependencies
1 parent 12cfde7 commit 15a653d

File tree

13 files changed

+44
-44
lines changed

13 files changed

+44
-44
lines changed

.github/workflows/python-package.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ jobs:
7979
fail-fast: true
8080
matrix:
8181
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
82-
python-version: ["3.7", "3.13"]
82+
python-version: ["3.8", "3.13"]
8383
exclude:
8484
# Latest macos runner does not support older Python versions
8585
# https://github.com/actions/setup-python/issues/852
8686
- os: macos-latest
87-
python-version: "3.7"
87+
python-version: "3.8"
8888
steps:
8989
- uses: actions/checkout@v4
9090
with:
@@ -100,10 +100,10 @@ jobs:
100100
python -m pip install --upgrade pip wheel
101101
python -m pip install --editable .[dev]
102102
- name: Downgrade numpy
103-
if: ${{ matrix.python-version == '3.7' }}
103+
if: ${{ matrix.python-version == '3.8' }}
104104
run: |
105105
# test with older numpy version to ensure compatibility
106-
python -m pip install numpy==1.15
106+
python -m pip install numpy~=1.17.5
107107
- name: Test with pytest
108108
run: |
109109
pytest -v --benchmark-disable -n auto
@@ -129,7 +129,7 @@ jobs:
129129
platforms: arm64
130130
- uses: pypa/[email protected]
131131
env:
132-
CIBW_SKIP: cp36-* pp*-win* pp*-macosx* *_i686
132+
CIBW_SKIP: cp36-* cp37-* pp*-win* pp*-macosx* *_i686
133133
CIBW_TEST_SKIP: "*-win_arm64"
134134
CIBW_ARCHS_LINUX: "x86_64 aarch64"
135135
CIBW_ARCHS_MACOS: "x86_64 arm64 universal2"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for full details.
1919
### Prerequisites
2020

2121
- Git and Git LFS
22-
- Python >= 3.7
22+
- Python >= 3.8
2323
- Miniconda3
2424
- C compiler such as GCC or Clang
2525

cryosparc/dataset.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,20 @@
3636
Generator,
3737
Generic,
3838
List,
39+
Literal,
3940
Mapping,
4041
MutableMapping,
4142
Optional,
4243
Sequence,
4344
Set,
45+
SupportsIndex,
4446
Tuple,
4547
Type,
4648
Union,
4749
overload,
4850
)
4951

5052
import numpy as n
51-
from typing_extensions import Literal, SupportsIndex
5253

5354
from .column import Column
5455
from .core import Data, DsetType, Stream

cryosparc/dtype.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
"""
44

55
import json
6-
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Type, Union
6+
from typing import TYPE_CHECKING, Dict, List, Literal, Optional, Sequence, Tuple, Type, TypedDict, Union
77

88
import numpy as n
9-
from typing_extensions import Literal, Sequence, TypedDict
109

1110
from .core import Data, DsetType
1211

cryosparc/errors.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
Definitions for various error classes raised by cryosparc-tools functions
33
"""
44

5-
from typing import Any, List
6-
7-
from typing_extensions import TypedDict
5+
from typing import Any, List, TypedDict
86

97
from .spec import Datafield, Datatype, SlotSpec
108

cryosparc/job.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010
from io import BytesIO
1111
from pathlib import PurePath, PurePosixPath
1212
from time import sleep, time
13-
from typing import IO, TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Pattern, Union, overload
13+
from typing import IO, TYPE_CHECKING, Any, Dict, Iterable, List, Literal, Optional, Pattern, Union, overload
1414

1515
import numpy as n
16-
from typing_extensions import Literal
1716

1817
from .command import CommandError, make_json_request, make_request
1918
from .dataset import DEFAULT_FORMAT, Dataset

cryosparc/spec.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
"""
2121

2222
from abc import ABC, abstractmethod
23-
from typing import TYPE_CHECKING, Any, Dict, Generic, List, Optional, Tuple, TypeVar, Union
24-
25-
from typing_extensions import Literal, TypedDict
26-
27-
if TYPE_CHECKING:
28-
from typing_extensions import Self # not present in typing-extensions=3.7
23+
from typing import Any, Dict, Generic, List, Literal, Optional, Tuple, TypedDict, TypeVar, Union
2924

3025
# Database document
3126
D = TypeVar("D")
@@ -964,6 +959,6 @@ def doc(self) -> D:
964959
return self._doc
965960

966961
@abstractmethod
967-
def refresh(self) -> "Self":
962+
def refresh(self):
968963
# Must be implemented in subclasses
969964
return self

cryosparc/star.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,23 @@
33
"""
44

55
from pathlib import PurePath
6-
from typing import IO, TYPE_CHECKING, Any, Callable, Dict, List, Mapping, Optional, Tuple, Type, Union, overload
6+
from typing import (
7+
IO,
8+
TYPE_CHECKING,
9+
Any,
10+
Callable,
11+
Dict,
12+
List,
13+
Literal,
14+
Mapping,
15+
Optional,
16+
Tuple,
17+
Type,
18+
Union,
19+
overload,
20+
)
721

822
import numpy as n
9-
from typing_extensions import Literal
1023

1124
if TYPE_CHECKING:
1225
from numpy.typing import NDArray # type: ignore

cryosparc/stream.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@
44
from pathlib import PurePath
55
from typing import (
66
IO,
7-
TYPE_CHECKING,
87
Any,
98
AsyncGenerator,
9+
AsyncIterable,
1010
AsyncIterator,
1111
BinaryIO,
1212
Generator,
13+
Iterable,
1314
Iterator,
1415
Optional,
16+
Protocol,
1517
Union,
1618
)
1719

18-
from typing_extensions import Protocol
19-
20-
if TYPE_CHECKING:
21-
from typing_extensions import Self # not present in typing-extensions=3.7
20+
from typing_extensions import Self
2221

2322

2423
class AsyncBinaryIO(Protocol):
@@ -93,7 +92,7 @@ async def read(self, n: Optional[int] = None):
9392
out = []
9493
if n is None or n < 0:
9594
while True:
96-
m = self._read1()
95+
m = await self._read1()
9796
if not m:
9897
break
9998
out.append(m)
@@ -153,8 +152,8 @@ async def from_async_iterator(cls, iterator: Union[AsyncIterator[bytes], AsyncGe
153152
return await cls.from_async_stream(AsyncBinaryIteratorIO(iterator))
154153

155154
@abstractmethod
156-
def stream(self) -> Generator[bytes, None, None]: ...
155+
def stream(self) -> Iterable[bytes]: ...
157156

158-
async def astream(self):
157+
async def astream(self) -> AsyncIterable[bytes]:
159158
for chunk in self.stream():
160159
yield chunk

cryosparc/util.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,7 @@ def default_rng(seed=None) -> "n.random.Generator":
310310
Returns:
311311
numpy.random.Generator: Random number generator
312312
"""
313-
try:
314-
return n.random.default_rng(seed)
315-
except AttributeError:
316-
return n.random.RandomState(seed) # type: ignore
313+
return n.random.default_rng(seed)
317314

318315

319316
def random_integers(
@@ -337,11 +334,7 @@ def random_integers(
337334
Returns:
338335
NDArray: Numpy array of randomly-generated integers.
339336
"""
340-
try:
341-
f = rng.integers
342-
except AttributeError:
343-
f = rng.randint # type: ignore
344-
return f(low=low, high=high, size=size, dtype=dtype) # type: ignore
337+
return rng.integers(low=low, high=high, size=size, dtype=dtype) # type: ignore
345338

346339

347340
def print_table(headings: List[str], rows: List[List[str]]):

0 commit comments

Comments
 (0)