Skip to content

Commit 47d4426

Browse files
authored
chore: Deprecated Python 3.9 support (#74)
* Deprecated Python 3.9 support * Deprecated Python 3.9 support
1 parent 25970d7 commit 47d4426

16 files changed

Lines changed: 35 additions & 278 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: ["ubuntu-latest", "windows-latest"]
15-
python-version: ["3.9", "3.10", "3.11", "3.12"]
15+
python-version: ["3.10", "3.11", "3.12"]
1616
exclude:
17-
- os: windows-latest
18-
python-version: "3.9"
1917
- os: windows-latest
2018
python-version: "3.11"
2119
- os: windows-latest

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "vicinity"
33
description = "Lightweight Nearest Neighbors with Flexible Backends"
44
readme = { file = "README.md", content-type = "text/markdown" }
55
dynamic = ["version"]
6-
requires-python = ">=3.9"
6+
requires-python = ">=3.10"
77
license = { file = "LICENSE" }
88
authors = [{ name = "Stéphan Tulkens", email = "stephantul@gmail.com"}, {name = "Thomas van Dongen", email = "thomas123@live.nl"}]
99

@@ -15,7 +15,6 @@ classifiers = [
1515
"Topic :: Software Development :: Libraries",
1616
"License :: OSI Approved :: MIT License",
1717
"Programming Language :: Python :: 3 :: Only",
18-
"Programming Language :: Python :: 3.9",
1918
"Programming Language :: Python :: 3.10",
2019
"Programming Language :: Python :: 3.11",
2120
"Programming Language :: Python :: 3.12",

uv.lock

Lines changed: 3 additions & 241 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vicinity/backends/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from importlib.util import find_spec
2-
from typing import Union
32

43
from vicinity.backends.base import AbstractBackend
54
from vicinity.backends.basic import BasicBackend, BasicVectorStore
@@ -20,7 +19,7 @@ def _require(module_name: str, backend: Backend, extra: str) -> None:
2019
raise OptionalDependencyError(backend, extra)
2120

2221

23-
def get_backend_class(backend: Union[Backend, str]) -> type[AbstractBackend]:
22+
def get_backend_class(backend: Backend | str) -> type[AbstractBackend]:
2423
"""Get the requested backend and ensure its dependencies are installed."""
2524
backend = Backend(backend)
2625

vicinity/backends/annoy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from dataclasses import dataclass
44
from pathlib import Path
5-
from typing import Any, Union
5+
from typing import Any
66

77
import numpy as np
88
from annoy import AnnoyIndex
@@ -46,7 +46,7 @@ def __init__(
4646
def from_vectors(
4747
cls: type[AnnoyBackend],
4848
vectors: npt.NDArray,
49-
metric: Union[str, Metric],
49+
metric: str | Metric,
5050
trees: int,
5151
**kwargs: Any,
5252
) -> AnnoyBackend:

vicinity/backends/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def dump(self, file: Path) -> None:
2626
@classmethod
2727
def load(cls: type[ArgType], file: Path) -> ArgType:
2828
"""Load the arguments from a file."""
29-
with open(file, "r") as f:
29+
with open(file) as f:
3030
data = json.load(f)
3131
data["metric"] = Metric.from_string(data["metric"])
3232
return cls(**data)

vicinity/backends/basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from abc import ABC, abstractmethod
44
from dataclasses import dataclass
55
from pathlib import Path
6-
from typing import Any, Union
6+
from typing import Any
77

88
import numpy as np
99
from numpy import typing as npt
@@ -115,7 +115,7 @@ def _dist(self, x: npt.NDArray) -> npt.NDArray:
115115
raise NotImplementedError()
116116

117117
@classmethod
118-
def from_vectors(cls, vectors: npt.NDArray, metric: Union[str, Metric] = "cosine", **kwargs: Any) -> BasicBackend:
118+
def from_vectors(cls, vectors: npt.NDArray, metric: str | Metric = "cosine", **kwargs: Any) -> BasicBackend:
119119
"""Create a new instance from vectors."""
120120
metric_enum = Metric.from_string(metric)
121121
if metric_enum not in cls.supported_metrics:

vicinity/backends/faiss.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44
from dataclasses import dataclass
55
from pathlib import Path
6-
from typing import Any, Union
6+
from typing import Any
77

88
import faiss
99
from numpy import typing as npt
@@ -65,7 +65,7 @@ def from_vectors( # noqa: C901
6565
cls: type[FaissBackend],
6666
vectors: npt.NDArray,
6767
index_type: str = "flat",
68-
metric: Union[str, Metric] = "cosine",
68+
metric: str | Metric = "cosine",
6969
nlist: int = 100,
7070
m: int = 8,
7171
nbits: int = 8,

vicinity/backends/hnsw.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from dataclasses import dataclass
44
from pathlib import Path
5-
from typing import Any, Union
5+
from typing import Any
66

77
from hnswlib import Index as HnswIndex
88
from numpy import typing as npt
@@ -41,7 +41,7 @@ def __init__(
4141
def from_vectors(
4242
cls: type[HNSWBackend],
4343
vectors: npt.NDArray,
44-
metric: Union[str, Metric],
44+
metric: str | Metric,
4545
ef_construction: int,
4646
m: int,
4747
**kwargs: Any,

vicinity/backends/pynndescent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from dataclasses import dataclass
44
from pathlib import Path
5-
from typing import Any, Union
5+
from typing import Any
66

77
import numpy as np
88
from numpy import typing as npt
@@ -37,7 +37,7 @@ def from_vectors(
3737
cls: type[PyNNDescentBackend],
3838
vectors: npt.NDArray,
3939
n_neighbors: int = 15,
40-
metric: Union[str, Metric] = "cosine",
40+
metric: str | Metric = "cosine",
4141
**kwargs: Any,
4242
) -> PyNNDescentBackend:
4343
"""Create a new instance from vectors."""

0 commit comments

Comments
 (0)