Skip to content

Commit 18eb369

Browse files
authored
fix: fix Snowflake types + add py.typed (#2021)
1 parent dd0be92 commit 18eb369

File tree

4 files changed

+11
-21
lines changed

4 files changed

+11
-21
lines changed

.github/workflows/snowflake.yml

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

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

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

integrations/snowflake/pyproject.toml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,13 @@ integration = 'pytest -m "integration" {args:tests}'
6868
all = 'pytest {args:tests}'
6969
cov-retry = 'all --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x'
7070

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

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

8579
[tool.ruff]
8680
target-version = "py38"
@@ -155,8 +149,4 @@ parallel = false
155149
[tool.coverage.report]
156150
omit = ["*/tests/*", "*/__init__.py"]
157151
show_missing = true
158-
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
159-
160-
[[tool.mypy.overrides]]
161-
module = ["haystack.*", "haystack_integrations.*", "pytest.*", "openai.*", "polars.*"]
162-
ignore_missing_imports = true
152+
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]

integrations/snowflake/src/haystack_integrations/components/retrievers/py.typed

Whitespace-only changes.

integrations/snowflake/src/haystack_integrations/components/retrievers/snowflake/snowflake_table_retriever.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ def _snowflake_uri_constructor(self) -> str:
143143
uri = uri.rstrip("&?")
144144

145145
# Logging placeholder for the actual password
146-
masked_uri = uri.replace(self.api_key.resolve_value(), "***REDACTED***")
146+
masked_uri = uri
147+
if resolved_api_key := self.api_key.resolve_value():
148+
masked_uri = uri.replace(resolved_api_key, "***REDACTED***")
147149
logger.info("Constructed Snowflake URI: {masked_uri}", masked_uri=masked_uri)
148150
return uri
149151

0 commit comments

Comments
 (0)