Skip to content

Commit

Permalink
change import paths (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
masci authored Jan 22, 2024
1 parent 3bd9afe commit 38eb465
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
13 changes: 7 additions & 6 deletions integrations/jina/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Documentation = "https://github.com/deepset-ai/haystack-core-integrations/tree/m
Issues = "https://github.com/deepset-ai/haystack-core-integrations/issues"
Source = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/jina"

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

[tool.hatch.version]
source = "vcs"
tag-pattern = 'integrations\/jina-v(?P<version>.*)'
Expand Down Expand Up @@ -67,7 +70,7 @@ dependencies = [
"ruff>=0.0.243",
]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive {args:src/jina_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 @@ -133,7 +136,7 @@ unfixable = [
known-first-party = ["jina_haystack"]

[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
Expand All @@ -143,12 +146,9 @@ ban-relative-imports = "all"
source_pkgs = ["jina_haystack", "tests"]
branch = true
parallel = true
omit = [
"src/jina_haystack/__about__.py",
]

[tool.coverage.paths]
jina_haystack = ["src/jina_haystack", "*/jina-haystack/src/jina_haystack"]
jina_haystack = ["src"]
tests = ["tests", "*/jina-haystack/tests"]

[tool.coverage.report]
Expand All @@ -161,6 +161,7 @@ exclude_lines = [
[[tool.mypy.overrides]]
module = [
"haystack.*",
"haystack_integrations.*",
"pytest.*"
]
ignore_missing_imports = true
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# SPDX-FileCopyrightText: 2023-present deepset GmbH <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0

from jina_haystack.document_embedder import JinaDocumentEmbedder
from jina_haystack.text_embedder import JinaTextEmbedder
from .document_embedder import JinaDocumentEmbedder
from .text_embedder import JinaTextEmbedder

__all__ = ["JinaDocumentEmbedder", "JinaTextEmbedder"]
7 changes: 3 additions & 4 deletions integrations/jina/tests/test_document_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import pytest
import requests
from haystack import Document

from jina_haystack import JinaDocumentEmbedder
from haystack_integrations.components.embedders.jina import JinaDocumentEmbedder


def mock_session_post_response(*args, **kwargs): # noqa: ARG001
Expand Down Expand Up @@ -65,7 +64,7 @@ def test_to_dict(self):
component = JinaDocumentEmbedder(api_key="fake-api-key")
data = component.to_dict()
assert data == {
"type": "jina_haystack.document_embedder.JinaDocumentEmbedder",
"type": "haystack_integrations.components.embedders.jina.document_embedder.JinaDocumentEmbedder",
"init_parameters": {
"model": "jina-embeddings-v2-base-en",
"prefix": "",
Expand All @@ -90,7 +89,7 @@ def test_to_dict_with_custom_init_parameters(self):
)
data = component.to_dict()
assert data == {
"type": "jina_haystack.document_embedder.JinaDocumentEmbedder",
"type": "haystack_integrations.components.embedders.jina.document_embedder.JinaDocumentEmbedder",
"init_parameters": {
"model": "model",
"prefix": "prefix",
Expand Down
7 changes: 3 additions & 4 deletions integrations/jina/tests/test_text_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

import pytest
import requests

from jina_haystack import JinaTextEmbedder
from haystack_integrations.components.embedders.jina import JinaTextEmbedder


class TestJinaTextEmbedder:
Expand Down Expand Up @@ -39,7 +38,7 @@ def test_to_dict(self):
component = JinaTextEmbedder(api_key="fake-api-key")
data = component.to_dict()
assert data == {
"type": "jina_haystack.text_embedder.JinaTextEmbedder",
"type": "haystack_integrations.components.embedders.jina.text_embedder.JinaTextEmbedder",
"init_parameters": {
"model": "jina-embeddings-v2-base-en",
"prefix": "",
Expand All @@ -56,7 +55,7 @@ def test_to_dict_with_custom_init_parameters(self):
)
data = component.to_dict()
assert data == {
"type": "jina_haystack.text_embedder.JinaTextEmbedder",
"type": "haystack_integrations.components.embedders.jina.text_embedder.JinaTextEmbedder",
"init_parameters": {
"model": "model",
"prefix": "prefix",
Expand Down

0 comments on commit 38eb465

Please sign in to comment.