Skip to content

Commit 1646ff6

Browse files
authored
chore: mistral - improve type checking + add py.typed (#2009)
* chore: mistral - improve type checking + add py.typed * fixes
1 parent 1c27cd0 commit 1646ff6

File tree

6 files changed

+9
-34
lines changed

6 files changed

+9
-34
lines changed

.github/workflows/mistral.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,9 @@ jobs:
5050
- name: Install Hatch
5151
run: pip install --upgrade hatch
5252

53-
# TODO: Once this integration is properly typed, use hatch run test:types
54-
# https://github.com/deepset-ai/haystack-core-integrations/issues/1771
5553
- name: Lint
5654
if: matrix.python-version == '3.9' && runner.os == 'Linux'
57-
run: hatch run fmt-check && hatch run lint:typing
55+
run: hatch run fmt-check && hatch run test:types
5856

5957
- name: Generate docs
6058
if: matrix.python-version == '3.9' && runner.os == 'Linux'

integrations/mistral/pyproject.toml

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
requires = ["hatchling", "hatch-vcs"]
33
build-backend = "hatchling.build"
44

5-
[project]
5+
[project]
66
name = "mistral-haystack"
77
dynamic = ["version"]
88
description = ''
@@ -67,19 +67,14 @@ integration = 'pytest -m "integration" {args:tests}'
6767
all = 'pytest {args:tests}'
6868
cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x'
6969

70-
types = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
71-
72-
# TODO: remove lint environment once this integration is properly typed
73-
# test environment should be used instead
74-
# https://github.com/deepset-ai/haystack-core-integrations/issues/1771
75-
[tool.hatch.envs.lint]
76-
installer = "uv"
77-
detached = true
78-
dependencies = ["pip", "mypy>=1.0.0", "ruff>=0.0.243"]
79-
80-
[tool.hatch.envs.lint.scripts]
81-
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
70+
types = """mypy -p haystack_integrations.components.embedders.mistral \
71+
-p haystack_integrations.components.generators.mistral {args}"""
8272

73+
[tool.mypy]
74+
install_types = true
75+
non_interactive = true
76+
check_untyped_defs = true
77+
disallow_incomplete_defs = true
8378

8479
[tool.ruff]
8580
target-version = "py38"
@@ -156,23 +151,9 @@ show_missing = true
156151
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
157152

158153

159-
[[tool.mypy.overrides]]
160-
module = [
161-
"mistral.*",
162-
"haystack.*",
163-
"haystack_integrations.*",
164-
"openai.*",
165-
"pytest.*",
166-
"numpy.*",
167-
]
168-
ignore_missing_imports = true
169-
170154
[tool.pytest.ini_options]
171155
addopts = "--strict-markers"
172156
markers = [
173157
"integration: integration tests",
174-
"unit: unit tests",
175-
"embedders: embedders tests",
176-
"chat_generators: chat_generators tests",
177158
]
178159
log_cli = true

integrations/mistral/src/haystack_integrations/components/embedders/py.typed

Whitespace-only changes.

integrations/mistral/src/haystack_integrations/components/generators/py.typed

Whitespace-only changes.

integrations/mistral/tests/test_mistral_document_embedder.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
from haystack_integrations.components.embedders.mistral.document_embedder import MistralDocumentEmbedder
1111

12-
pytestmark = pytest.mark.embedders
13-
1412

1513
class TestMistralDocumentEmbedder:
1614
def test_init_default(self, monkeypatch):

integrations/mistral/tests/test_mistral_text_embedder.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
from haystack_integrations.components.embedders.mistral.text_embedder import MistralTextEmbedder
1010

11-
pytestmark = pytest.mark.embedders
12-
1311

1412
class TestMistralTextEmbedder:
1513
def test_init_default(self, monkeypatch):

0 commit comments

Comments
 (0)