Skip to content

Commit 8daa081

Browse files
authored
fix(ci): add numpy to dependencies and pass typing checks (#676)
* fix(ci): add numpy to dependencies and pass typing checks * fix: relax numpy version requirement In NumPy release 1.23.2, Python 3.11 support was added. See https://github.com/numpy/numpy/releases/tag/v1.23.2.
1 parent 1f29ba3 commit 8daa081

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dependencies = [
1414
"rich>=14.0.0",
1515
"python-dotenv>=1.1.0",
1616
"watchfiles>=1.1.0",
17+
"numpy>=1.23.2",
1718
]
1819
license = "Apache-2.0"
1920
urls = { Homepage = "https://cocoindex.io/" }

python/cocoindex/functions.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
"""All builtin functions."""
22

3-
from typing import Annotated, Any, TYPE_CHECKING, Literal
4-
import numpy as np
5-
from numpy.typing import NDArray
63
import dataclasses
4+
from typing import Annotated, Any, Literal
75

8-
from .typing import Float32, Vector, TypeAttr
9-
from . import op, llm
6+
import numpy as np
7+
from numpy.typing import NDArray
108

11-
# Libraries that are heavy to import. Lazily import them later.
12-
if TYPE_CHECKING:
13-
import sentence_transformers
9+
from . import llm, op
10+
from .typing import TypeAttr, Vector
1411

1512
# Check if sentence_transformers is available
1613
try:
17-
import sentence_transformers
14+
import sentence_transformers # type: ignore
1815

1916
_SENTENCE_TRANSFORMERS_AVAILABLE = True
2017
except ImportError:

0 commit comments

Comments
 (0)