Skip to content

Commit

Permalink
Move package under haystack_integrations (#214)
Browse files Browse the repository at this point in the history
* Move package under haystack_integrations

* Fix linting

* Fix linting again?
  • Loading branch information
silvanocerza authored Jan 16, 2024
1 parent c54bffe commit 7139745
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
18 changes: 10 additions & 8 deletions integrations/weaviate/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Source = "https://github.com/deepset-ai/haystack-core-integrations"
Documentation = "https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/weaviate/README.md"
Issues = "https://github.com/deepset-ai/haystack-core-integrations/issues"

[tool.hatch.build.targets.wheel]
packages = ["src/haystack_integrations"]

[tool.hatch.version]
source = "vcs"
tag-pattern = 'integrations\/weaviate-v(?P<version>.*)'
Expand Down Expand Up @@ -71,7 +74,7 @@ dependencies = [
"ruff>=0.0.243",
]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive {args:src/weaviate_haystack tests}"
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = [
"ruff {args:.}",
"black --check --diff {args:.}",
Expand Down Expand Up @@ -137,25 +140,23 @@ unfixable = [
]

[tool.ruff.isort]
known-first-party = ["weaviate_haystack"]
known-first-party = ["src"]

[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"
ban-relative-imports = "parents"

[tool.ruff.per-file-ignores]
# Tests can use magic values, assertions, and relative imports
"tests/**/*" = ["PLR2004", "S101", "TID252"]

[tool.coverage.run]
source_pkgs = ["weaviate_haystack", "tests"]
source_pkgs = ["src", "tests"]
branch = true
parallel = true
omit = [
"src/weaviate_haystack/__about__.py",
]


[tool.coverage.paths]
weaviate_haystack = ["src/weaviate_haystack", "*/weaviate-haystack/src/weaviate_haystack"]
weaviate_haystack = ["src/haystack_integrations", "*/weaviate-haystack/src"]
tests = ["tests", "*/weaviate-haystack/tests"]

[tool.coverage.report]
Expand All @@ -168,6 +169,7 @@ exclude_lines = [
[[tool.mypy.overrides]]
module = [
"haystack.*",
"haystack_integrations.*",
"pytest.*",
"weaviate.*",
"numpy",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# SPDX-FileCopyrightText: 2023-present deepset GmbH <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
from .document_store import WeaviateDocumentStore

from weaviate_haystack.document_store import WeaviateDocumentStore

__all__ = ("WeaviateDocumentStore",)
__all__ = ["WeaviateDocumentStore"]
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
from dataclasses import asdict
from typing import Any, Dict, List, Optional, Tuple, Union

import weaviate
from haystack.core.serialization import default_from_dict, default_to_dict
from haystack.dataclasses.document import Document
from haystack.document_stores.protocol import DuplicatePolicy

import weaviate
from weaviate.auth import AuthCredentials
from weaviate.config import Config, ConnectionConfig
from weaviate.embedded import EmbeddedOptions
Expand Down
11 changes: 5 additions & 6 deletions integrations/weaviate/tests/test_document_store.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest.mock import patch

from haystack_integrations.document_stores.weaviate.document_store import WeaviateDocumentStore
from weaviate.auth import AuthApiKey
from weaviate.config import Config
from weaviate.embedded import (
Expand All @@ -10,11 +11,9 @@
EmbeddedOptions,
)

from weaviate_haystack.document_store import WeaviateDocumentStore


class TestWeaviateDocumentStore:
@patch("weaviate_haystack.document_store.weaviate")
@patch("haystack_integrations.document_stores.weaviate.document_store.weaviate")
def test_to_dict(self, _mock_weaviate):
document_store = WeaviateDocumentStore(
url="http://localhost:8080",
Expand All @@ -30,7 +29,7 @@ def test_to_dict(self, _mock_weaviate):
additional_config=Config(grpc_port_experimental=12345),
)
assert document_store.to_dict() == {
"type": "weaviate_haystack.document_store.WeaviateDocumentStore",
"type": "haystack_integrations.document_stores.weaviate.document_store.WeaviateDocumentStore",
"init_parameters": {
"url": "http://localhost:8080",
"auth_client_secret": {
Expand Down Expand Up @@ -61,11 +60,11 @@ def test_to_dict(self, _mock_weaviate):
},
}

@patch("weaviate_haystack.document_store.weaviate")
@patch("haystack_integrations.document_stores.weaviate.document_store.weaviate")
def test_from_dict(self, _mock_weaviate):
document_store = WeaviateDocumentStore.from_dict(
{
"type": "weaviate_haystack.document_store.WeaviateDocumentStore",
"type": "haystack_integrations.document_stores.weaviate.document_store.WeaviateDocumentStore",
"init_parameters": {
"url": "http://localhost:8080",
"auth_client_secret": {
Expand Down

0 comments on commit 7139745

Please sign in to comment.