Fix CI: bump mypy pin for numpy 2.5 stubs, sync confection pin

mypy 1.5.x crashes with an internal error on numpy>=2.3 type stubs,
which killed the mypy step on Python 3.12+. Bump to mypy 1.20.x and
fix the type errors the newer mypy reports.

Also sync the confection pin in requirements.txt with setup.cfg
(>=1.3.2), which was the single test failure on Python 3.10/3.11.
This commit is contained in:
Matthew Honnibal
2026-08-07 09:34:11 +02:00
parent edd3d0fcca
commit 768e8d572c
8 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -28,11 +28,11 @@ pytest>=5.2.0,!=7.1.0
pytest-timeout>=1.3.0,<2.0.0
mock>=2.0.0,<3.0.0
hypothesis>=3.27.0,<7.0.0
mypy>=1.5.0,<1.6.0; platform_machine != "aarch64" and python_version >= "3.8"
mypy>=1.20.2,<1.21.0; platform_machine != "aarch64" and python_version >= "3.8"
types-mock>=0.1.1
types-setuptools>=57.0.0
types-requests
types-setuptools>=57.0.0
ruff>=0.9.0
cython-lint>=0.15.0
confection>=1.1.0,<2.0.0
confection>=1.3.2,<2.0.0
+1 -1
View File
@@ -579,7 +579,7 @@ def debug_data(
if "morphologizer" in factory_names:
msg.divider("Morphologizer (POS+Morph)")
label_list = [label for label in gold_train_data["morphs"]]
label_list = tuple(gold_train_data["morphs"])
model_labels = _get_labels_from_model(nlp, "morphologizer")
msg.info(f"{len(label_list)} label(s) in train data")
labels = set(label_list)
+1 -1
View File
@@ -66,7 +66,7 @@ def profile(model: str, inputs: Optional[Path] = None, n_texts: int = 10000) ->
with msg.loading("Loading IMDB dataset via ml_datasets..."):
imdb_train, _ = ml_datasets.imdb(train_limit=n_texts, dev_limit=0)
texts, _ = zip(*imdb_train)
texts = [text for text, _ in imdb_train]
msg.info(f"Loaded IMDB dataset and using {n_texts} examples")
with msg.loading(f"Loading pipeline '{model}'..."):
nlp = load_model(model)
+1 -1
View File
@@ -388,7 +388,7 @@ class DependencyRenderer:
lang=self.lang,
)
def render_word(self, text: str, tag: str, lemma: str, i: int) -> str:
def render_word(self, text: str, tag: str, lemma: Optional[str], i: int) -> str:
"""Render individual word.
text (str): Word text.
+1 -1
View File
@@ -61,7 +61,7 @@ class JapaneseTokenizer(DummyTokenizer):
zip(*dtokens) if dtokens else [[]] * 7
)
sub_tokens_list = list(sub_tokens_list)
doc = Doc(self.vocab, words=words, spaces=spaces)
doc = Doc(self.vocab, words=list(words), spaces=spaces)
next_pos = None # for bi-gram rules
for idx, (token, dtoken) in enumerate(zip(doc, dtokens)):
token.tag_ = dtoken.tag
+1 -1
View File
@@ -605,7 +605,7 @@ class Language:
existing_func = registry.factories.get(internal_name)
closure = existing_func.__closure__
wrapped = [c.cell_contents for c in closure][0] if closure else None
if util.is_same_func(wrapped, component_func):
if wrapped is not None and util.is_same_func(wrapped, component_func):
factory_func = existing_func # noqa: F811
cls.factory(
+1 -1
View File
@@ -250,7 +250,7 @@ class SpanCategorizer(TrainablePipe):
DOCS: https://spacy.io/api/spancategorizer#init
"""
self.cfg = {
self.cfg: Dict[str, Any] = {
"labels": [],
"spans_key": spans_key,
"threshold": threshold,
+4 -4
View File
@@ -242,10 +242,10 @@ class TokenPatternNumber(BaseModel):
class TokenPatternOperatorSimple(str, Enum):
plus: StrictStr = StrictStr("+")
star: StrictStr = StrictStr("*")
question: StrictStr = StrictStr("?")
exclamation: StrictStr = StrictStr("!")
plus = StrictStr("+")
star = StrictStr("*")
question = StrictStr("?")
exclamation = StrictStr("!")
TokenPatternOperatorMinMax = constr(pattern=r"^(\{\d+\}|\{\d+,\d*\}|\{\d*,\d+\})$")