searchly 2.0.1__tar.gz → 2.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {searchly-2.0.1 → searchly-2.0.2}/PKG-INFO +1 -1
  2. {searchly-2.0.1 → searchly-2.0.2}/pyproject.toml +6 -1
  3. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/__init__.py +2 -0
  4. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/config.py +21 -0
  5. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/brave_provider/client.py +6 -2
  6. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/exa_provider/exa.py +1 -1
  7. {searchly-2.0.1 → searchly-2.0.2}/LICENSE +0 -0
  8. {searchly-2.0.1 → searchly-2.0.2}/README.md +0 -0
  9. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/base.py +0 -0
  10. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/exceptions.py +0 -0
  11. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/log.py +0 -0
  12. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/__init__.py +0 -0
  13. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/brave_provider/__init__.py +0 -0
  14. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/dataforseo_provider/__init__.py +0 -0
  15. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/dataforseo_provider/dataforseo.py +0 -0
  16. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/exa_provider/__init__.py +0 -0
  17. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/jigsawstack_provider/__init__.py +0 -0
  18. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/jigsawstack_provider/jigsawstack.py +0 -0
  19. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/kagi_provider/__init__.py +0 -0
  20. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/kagi_provider/client.py +0 -0
  21. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/linkup_provider/__init__.py +0 -0
  22. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/linkup_provider/client.py +0 -0
  23. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/search1_provider/__init__.py +0 -0
  24. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/search1_provider/client.py +0 -0
  25. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/serpapi_provider/__init__.py +0 -0
  26. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/serpapi_provider/client.py +0 -0
  27. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/serper_provider/__init__.py +0 -0
  28. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/serper_provider/client.py +0 -0
  29. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/tavily_provider/__init__.py +0 -0
  30. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/tavily_provider/client.py +0 -0
  31. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/you_provider/__init__.py +0 -0
  32. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/providers/you_provider/you.py +0 -0
  33. {searchly-2.0.1 → searchly-2.0.2}/src/searchly/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: searchly
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: Search tools for agents
5
5
  Keywords:
6
6
  Author: Philipp Temminghoff
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "searchly"
3
- version = "2.0.1"
3
+ version = "2.0.2"
4
4
  description = "Search tools for agents"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -50,6 +50,7 @@ dev = [
50
50
  "devtools",
51
51
  "pyreadline3",
52
52
  "pytest",
53
+ "pytest-asyncio",
53
54
  "pytest-cov",
54
55
  # Only add below (Copier)
55
56
  ]
@@ -124,6 +125,10 @@ log_date_format = "%Y-%m-%d %H:%M:%S"
124
125
  log_format = "%(asctime)s %(levelname)s %(message)s"
125
126
  testpaths = "tests/"
126
127
  asyncio_mode = "auto"
128
+ addopts = "-m 'not integration'"
129
+ markers = [
130
+ "integration: mark test as integration test (skipped by default)",
131
+ ]
127
132
 
128
133
  [tool.ruff]
129
134
  line-length = 100
@@ -34,6 +34,7 @@ from searchly.config import (
34
34
  WebSearchProviderConfig,
35
35
  WebSearchProviderName,
36
36
  YouConfig,
37
+ get_config_class,
37
38
  )
38
39
  from searchly.providers.brave_provider.client import AsyncBraveSearch
39
40
  from searchly.providers.dataforseo_provider.dataforseo import AsyncDataForSEOClient
@@ -94,4 +95,5 @@ __all__ = [
94
95
  "WebSearchResult",
95
96
  "YouConfig",
96
97
  "__version__",
98
+ "get_config_class",
97
99
  ]
@@ -470,3 +470,24 @@ NewsSearchProviderConfig = Annotated[
470
470
  BraveSearchConfig | DataForSEOConfig | SerpAPIConfig | SerperConfig | TavilyConfig | YouConfig,
471
471
  Field(discriminator="type"),
472
472
  ]
473
+
474
+
475
+ def get_config_class(
476
+ provider_name: WebSearchProviderName,
477
+ ) -> type[BaseSearchProviderConfig]:
478
+ """Get the config class for a provider name.
479
+
480
+ Args:
481
+ provider_name: The provider type literal value.
482
+
483
+ Returns:
484
+ The corresponding config class.
485
+
486
+ Raises:
487
+ ValueError: If the provider name is unknown.
488
+ """
489
+ for cls in BaseSearchProviderConfig.__subclasses__():
490
+ if cls.model_fields["type"].default == provider_name:
491
+ return cls
492
+ msg = f"Unknown provider: {provider_name}"
493
+ raise ValueError(msg)
@@ -5,8 +5,6 @@ from __future__ import annotations
5
5
  import os
6
6
  from typing import TYPE_CHECKING, Any, cast
7
7
 
8
- import brave_search_python_client as brave # type: ignore[import-untyped]
9
-
10
8
  from searchly.base import (
11
9
  NewsSearchProvider,
12
10
  NewsSearchResponse,
@@ -38,6 +36,8 @@ class AsyncBraveSearch(WebSearchProvider, NewsSearchProvider):
38
36
  retries: Number of retries for failed requests.
39
37
  wait_time: Time to wait between retries in seconds.
40
38
  """
39
+ import brave_search_python_client as brave # type: ignore[import-untyped]
40
+
41
41
  self.api_key = api_key or os.getenv("BRAVE_API_KEY")
42
42
  if not self.api_key:
43
43
  msg = "No API key provided. Set BRAVE_API_KEY env var or pass api_key"
@@ -68,6 +68,8 @@ class AsyncBraveSearch(WebSearchProvider, NewsSearchProvider):
68
68
  Returns:
69
69
  Unified web search response.
70
70
  """
71
+ import brave_search_python_client as brave
72
+
71
73
  req = brave.WebSearchRequest(
72
74
  q=query,
73
75
  count=max_results,
@@ -108,6 +110,8 @@ class AsyncBraveSearch(WebSearchProvider, NewsSearchProvider):
108
110
  Returns:
109
111
  Unified news search response.
110
112
  """
113
+ import brave_search_python_client as brave
114
+
111
115
  req = brave.NewsSearchRequest(
112
116
  q=query,
113
117
  count=max_results,
@@ -28,7 +28,7 @@ class AsyncExaClient(WebSearchProvider):
28
28
  try:
29
29
  from exa_py import AsyncExa
30
30
  except ImportError as e:
31
- msg = "Could not import exa_py. Install it with 'pip install exa_py'"
31
+ msg = "Could not import exa_py."
32
32
  raise ImportError(msg) from e
33
33
 
34
34
  self.api_key = api_key or os.getenv("EXA_API_KEY")
File without changes
File without changes
File without changes
File without changes
File without changes