Skip to content
This repository was archived by the owner on Apr 30, 2026. It is now read-only.

Commit d1d84e8

Browse files
authored
Merge pull request #616 from bbrowning/sdg-tox-fix
Fix up mypy in recent CI testing
2 parents aa28357 + 2b971b3 commit d1d84e8

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/instructlab/sdg/utils/chunkers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ def chunk_documents(self) -> List:
179179
all_chunks = []
180180
for conversion_result in parsed_documents:
181181
doc = conversion_result.document
182-
chunker = HybridChunker(tokenizer=self.tokenizer, max_tokens=500)
182+
# max_tokens in HybridChunker is handled by a pydantic validation
183+
# hook, and mypy doesn't handle that. So, ignore mypy types here.
184+
chunker = HybridChunker(tokenizer=self.tokenizer, max_tokens=500) # type: ignore
183185
try:
184186
chunk_iter = chunker.chunk(dl_doc=doc)
185187
chunks = [chunker.serialize(chunk=chunk) for chunk in chunk_iter]

tox.ini

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ wheel_build_env = pkg
1919
deps = -r requirements-dev.txt
2020
commands =
2121
unit: {envpython} -m pytest {posargs:tests --ignore=tests/functional}
22-
unitcov: {envpython} -W error::UserWarning -m pytest --cov=instructlab.sdg --cov-report term --cov-report=html:coverage-{env_name} --cov-report=xml:coverage-{env_name}.xml --html=durations/{env_name}.html {posargs:tests --ignore=tests/functional -m "not (examples or gpu)"}
22+
unitcov: {envpython} -W error::UserWarning -m pytest --cov=instructlab.sdg --cov-report term --cov-report=html:coverage-{env_name} --cov-report=xml:coverage-{env_name}.xml --html=durations/{env_name}.html -p no:unraisableexception {posargs:tests --ignore=tests/functional -m "not (examples or gpu)"}
2323
functional: {envpython} -m pytest {posargs:tests/functional -m "not gpu"}
2424

2525
# format, check, and linting targets don't build and install the project to
@@ -68,13 +68,10 @@ allowlist_externals = sh
6868

6969
[testenv:mypy]
7070
description = Python type checking with mypy
71-
# Note: 'mypy<1.14' by default pulls the latest 'pydantic' release as a dependency, but 'pydantic>=2.10' does not
72-
# work with 'mypy<1.14', so for compatibility purposes, we set 'pydantic<=2.9.2'
7371
deps =
74-
mypy>=1.10.0,<1.14
72+
mypy
7573
types-PyYAML
7674
pytest
77-
pydantic<=2.9.2
7875
commands =
7976
mypy src
8077

0 commit comments

Comments
 (0)