Skip to content

Commit

Permalink
chore: Chroma - ruff update, don't ruff tests (#983)
Browse files Browse the repository at this point in the history
* Ruff update, don't ruff tests

* More update to pass CI
  • Loading branch information
vblagoje authored Aug 16, 2024
1 parent ddfd74b commit ac2680c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
8 changes: 5 additions & 3 deletions integrations/chroma/example/example.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# Colab: https://colab.research.google.com/drive/1YpDetI8BRbObPDEVdfqUcwhEX9UUXP-m?usp=sharing

import os
from pathlib import Path

from haystack import Pipeline
from haystack.components.converters import TextFileToDocument
from haystack.components.writers import DocumentWriter

from haystack_integrations.document_stores.chroma import ChromaDocumentStore
from haystack_integrations.components.retrievers.chroma import ChromaQueryTextRetriever
from haystack_integrations.document_stores.chroma import ChromaDocumentStore

# Chroma is used in-memory so we use the same instances in the two pipelines below
document_store = ChromaDocumentStore()

HERE = Path(__file__).resolve().parent
file_paths = [HERE / "data" / Path(name) for name in os.listdir("data")]

# Chroma is used in-memory so we use the same instances in the two pipelines below
document_store = ChromaDocumentStore()

indexing = Pipeline()
indexing.add_component("converter", TextFileToDocument())
Expand Down
13 changes: 7 additions & 6 deletions integrations/chroma/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ dependencies = [
]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = ["ruff check {args:.}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff --fix {args:.}", "style"]
style = ["ruff check {args:. --exclude tests/}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff --fix {args:. --exclude tests/}", "style"]
all = ["style", "typing"]

[tool.hatch.metadata]
Expand All @@ -85,7 +85,7 @@ skip-string-normalization = true
[tool.ruff]
target-version = "py38"
line-length = 120
select = [
lint.select = [
"A",
"ARG",
"B",
Expand All @@ -112,7 +112,7 @@ select = [
"W",
"YTT",
]
ignore = [
lint.ignore = [
# Allow non-abstract empty methods in abstract base classes
"B027",
# Allow boolean positional values in function calls, like `dict.get(... True)`
Expand All @@ -130,21 +130,22 @@ ignore = [
# Ignore unused params
"ARG002",
]
unfixable = [
lint.unfixable = [
# Don't touch unused imports
"F401",
]
exclude = ["example"]

[tool.ruff.isort]
known-first-party = ["src"]
known-first-party = ["src", "example", "tests"]

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

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

[tool.coverage.run]
source = ["haystack_integrations"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from haystack import Document, component, default_from_dict, default_to_dict
from haystack.document_stores.types import FilterPolicy
from haystack.document_stores.types.filter_policy import apply_filter_policy

from haystack_integrations.document_stores.chroma import ChromaDocumentStore


Expand Down
1 change: 1 addition & 0 deletions integrations/chroma/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
DeleteDocumentsTest,
LegacyFilterDocumentsTest,
)

from haystack_integrations.document_stores.chroma import ChromaDocumentStore


Expand Down
1 change: 1 addition & 0 deletions integrations/chroma/tests/test_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
import pytest
from haystack.document_stores.types import FilterPolicy

from haystack_integrations.components.retrievers.chroma import ChromaQueryTextRetriever
from haystack_integrations.document_stores.chroma import ChromaDocumentStore

Expand Down

0 comments on commit ac2680c

Please sign in to comment.