Exclude TUI apps from coverage
This commit is contained in:
parent
11534bf686
commit
5dd8a82d1f
14 changed files with 20 additions and 16 deletions
|
|
@ -18,7 +18,7 @@ def run_chat(
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
from haiku.rag.chat.app import ChatApp
|
from haiku.rag.chat.app import ChatApp
|
||||||
except ImportError as e: # pragma: no cover
|
except ImportError as e:
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"textual is not installed. Please install it with `pip install 'haiku.rag-slim[tui]'` or use the full haiku.rag package."
|
"textual is not installed. Please install it with `pip install 'haiku.rag-slim[tui]'` or use the full haiku.rag package."
|
||||||
) from e
|
) from e
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ try:
|
||||||
|
|
||||||
logfire.configure(send_to_logfire="if-token-present", console=False)
|
logfire.configure(send_to_logfire="if-token-present", console=False)
|
||||||
logfire.instrument_pydantic_ai()
|
logfire.instrument_pydantic_ai()
|
||||||
except ImportError: # pragma: no cover
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -47,7 +47,7 @@ try:
|
||||||
from haiku.rag.chat.widgets.chat_history import ChatHistory, CitationWidget
|
from haiku.rag.chat.widgets.chat_history import ChatHistory, CitationWidget
|
||||||
|
|
||||||
TEXTUAL_AVAILABLE = True
|
TEXTUAL_AVAILABLE = True
|
||||||
except ImportError: # pragma: no cover
|
except ImportError:
|
||||||
TEXTUAL_AVAILABLE = False
|
TEXTUAL_AVAILABLE = False
|
||||||
App = object # type: ignore
|
App = object # type: ignore
|
||||||
SystemCommand = object # type: ignore
|
SystemCommand = object # type: ignore
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from textual.screen import ModalScreen
|
||||||
from textual.widgets import Button, Markdown, Static
|
from textual.widgets import Button, Markdown, Static
|
||||||
|
|
||||||
|
|
||||||
class ContextModal(ModalScreen): # pragma: no cover
|
class ContextModal(ModalScreen):
|
||||||
"""Modal screen for viewing session Q&A history."""
|
"""Modal screen for viewing session Q&A history."""
|
||||||
|
|
||||||
BINDINGS = [
|
BINDINGS = [
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from textual.widgets import Button, Checkbox, Input, Static
|
||||||
from haiku.rag.client import HaikuRAG
|
from haiku.rag.client import HaikuRAG
|
||||||
|
|
||||||
|
|
||||||
class DocumentFilterModal(ModalScreen): # pragma: no cover
|
class DocumentFilterModal(ModalScreen):
|
||||||
"""Modal screen for selecting documents to filter searches."""
|
"""Modal screen for selecting documents to filter searches."""
|
||||||
|
|
||||||
BINDINGS = [
|
BINDINGS = [
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
try:
|
try:
|
||||||
from haiku.rag.inspector.app import run_inspector
|
from haiku.rag.inspector.app import run_inspector
|
||||||
except ImportError as e: # pragma: no cover
|
except ImportError as e:
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"textual is not installed. Please install it with `pip install 'haiku.rag-slim[tui]'` or use the full haiku.rag package."
|
"textual is not installed. Please install it with `pip install 'haiku.rag-slim[tui]'` or use the full haiku.rag package."
|
||||||
) from e
|
) from e
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,12 @@ try:
|
||||||
from haiku.rag.inspector.widgets.search_modal import SearchModal
|
from haiku.rag.inspector.widgets.search_modal import SearchModal
|
||||||
|
|
||||||
TEXTUAL_AVAILABLE = True
|
TEXTUAL_AVAILABLE = True
|
||||||
except ImportError: # pragma: no cover
|
except ImportError:
|
||||||
TEXTUAL_AVAILABLE = False
|
TEXTUAL_AVAILABLE = False
|
||||||
App = object # type: ignore
|
App = object # type: ignore
|
||||||
|
|
||||||
|
|
||||||
class InspectorApp(App): # pragma: no cover
|
class InspectorApp(App):
|
||||||
"""Textual TUI for inspecting LanceDB data."""
|
"""Textual TUI for inspecting LanceDB data."""
|
||||||
|
|
||||||
TITLE = "haiku.rag DB Inspector"
|
TITLE = "haiku.rag DB Inspector"
|
||||||
|
|
@ -243,7 +243,7 @@ def run_inspector(
|
||||||
db_path: Path | None = None,
|
db_path: Path | None = None,
|
||||||
read_only: bool = False,
|
read_only: bool = False,
|
||||||
before: datetime | None = None,
|
before: datetime | None = None,
|
||||||
) -> None: # pragma: no cover
|
) -> None:
|
||||||
"""Run the inspector TUI.
|
"""Run the inspector TUI.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from haiku.rag.store.models import Chunk
|
||||||
BATCH_SIZE = 50
|
BATCH_SIZE = 50
|
||||||
|
|
||||||
|
|
||||||
class ChunkList(VerticalScroll): # pragma: no cover
|
class ChunkList(VerticalScroll):
|
||||||
"""Widget for displaying and browsing chunks."""
|
"""Widget for displaying and browsing chunks."""
|
||||||
|
|
||||||
can_focus = False
|
can_focus = False
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ if TYPE_CHECKING:
|
||||||
from haiku.rag.store.models import Chunk
|
from haiku.rag.store.models import Chunk
|
||||||
|
|
||||||
|
|
||||||
class ContextModal(Screen): # pragma: no cover
|
class ContextModal(Screen):
|
||||||
"""Modal screen for displaying how a chunk appears to agents."""
|
"""Modal screen for displaying how a chunk appears to agents."""
|
||||||
|
|
||||||
BINDINGS = [
|
BINDINGS = [
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class ProvenanceData(Protocol):
|
||||||
doc_item_refs: list[str]
|
doc_item_refs: list[str]
|
||||||
|
|
||||||
|
|
||||||
class DetailView(VerticalScroll): # pragma: no cover
|
class DetailView(VerticalScroll):
|
||||||
"""Widget for displaying detailed content of documents or chunks."""
|
"""Widget for displaying detailed content of documents or chunks."""
|
||||||
|
|
||||||
can_focus = True
|
can_focus = True
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from haiku.rag.store.models import Document
|
||||||
BATCH_SIZE = 50
|
BATCH_SIZE = 50
|
||||||
|
|
||||||
|
|
||||||
class DocumentList(VerticalScroll): # pragma: no cover
|
class DocumentList(VerticalScroll):
|
||||||
"""Widget for displaying and browsing documents."""
|
"""Widget for displaying and browsing documents."""
|
||||||
|
|
||||||
can_focus = False
|
can_focus = False
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ if TYPE_CHECKING:
|
||||||
from haiku.rag.client import HaikuRAG
|
from haiku.rag.client import HaikuRAG
|
||||||
|
|
||||||
|
|
||||||
class InfoModal(ModalScreen): # pragma: no cover
|
class InfoModal(ModalScreen):
|
||||||
"""Modal screen for displaying database information."""
|
"""Modal screen for displaying database information."""
|
||||||
|
|
||||||
BINDINGS = [
|
BINDINGS = [
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ from haiku.rag.inspector.widgets.detail_view import DetailView
|
||||||
from haiku.rag.store.models import Chunk, SearchResult
|
from haiku.rag.store.models import Chunk, SearchResult
|
||||||
|
|
||||||
|
|
||||||
class SearchModal(Screen): # pragma: no cover
|
class SearchModal(Screen):
|
||||||
"""Screen for searching chunks."""
|
"""Screen for searching chunks."""
|
||||||
|
|
||||||
BINDINGS = [
|
BINDINGS = [
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ if TYPE_CHECKING:
|
||||||
from haiku.rag.store.models import Chunk
|
from haiku.rag.store.models import Chunk
|
||||||
|
|
||||||
|
|
||||||
class VisualGroundingModal(Screen): # pragma: no cover
|
class VisualGroundingModal(Screen):
|
||||||
"""Modal screen for displaying visual grounding with bounding boxes."""
|
"""Modal screen for displaying visual grounding with bounding boxes."""
|
||||||
|
|
||||||
BINDINGS = [
|
BINDINGS = [
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,10 @@ filterwarnings = ["error", "ignore::UserWarning", "ignore::DeprecationWarning"]
|
||||||
|
|
||||||
[tool.coverage.run]
|
[tool.coverage.run]
|
||||||
source = ["haiku_rag_slim"]
|
source = ["haiku_rag_slim"]
|
||||||
|
omit = [
|
||||||
|
"haiku_rag_slim/haiku/rag/chat/*",
|
||||||
|
"haiku_rag_slim/haiku/rag/inspector/*",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.coverage.report]
|
[tool.coverage.report]
|
||||||
show_missing = true
|
show_missing = true
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue