gaard-client 0.2.1__tar.gz → 0.2.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 (19) hide show
  1. {gaard_client-0.2.1 → gaard_client-0.2.2}/PKG-INFO +3 -3
  2. {gaard_client-0.2.1 → gaard_client-0.2.2}/pyproject.toml +3 -3
  3. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client/cli_commands.py +5 -2
  4. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client/client-web/assets/styles.css +1 -0
  5. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client/main.py +18 -11
  6. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client.egg-info/PKG-INFO +3 -3
  7. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client.egg-info/requires.txt +2 -2
  8. {gaard_client-0.2.1 → gaard_client-0.2.2}/tests/test_client_app.py +1 -1
  9. {gaard_client-0.2.1 → gaard_client-0.2.2}/README.md +0 -0
  10. {gaard_client-0.2.1 → gaard_client-0.2.2}/setup.cfg +0 -0
  11. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client/__init__.py +0 -0
  12. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client/cli.py +0 -0
  13. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client/client-web/assets/main.js +0 -0
  14. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client/client-web/index.html +0 -0
  15. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client.egg-info/SOURCES.txt +0 -0
  16. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client.egg-info/dependency_links.txt +0 -0
  17. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client.egg-info/entry_points.txt +0 -0
  18. {gaard_client-0.2.1 → gaard_client-0.2.2}/src/gaard_client.egg-info/top_level.txt +0 -0
  19. {gaard_client-0.2.1 → gaard_client-0.2.2}/tests/test_cli.py +0 -0
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gaard-client
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: GAARD frontend web services providing client interface
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
7
- Requires-Dist: gaard-plugin-api<0.3.0,>=0.2.0
7
+ Requires-Dist: gaard-plugin-api<0.3.0,>=0.2.2
8
8
  Requires-Dist: fastapi>=0.111.0
9
9
  Requires-Dist: uvicorn[standard]>=0.30.0
10
10
  Requires-Dist: pydantic>=2.7.0
11
- Requires-Dist: httpx>=0.27.0
11
+ Requires-Dist: httpx2>=2.5.0
12
12
  Provides-Extra: dev
13
13
  Requires-Dist: pytest>=8.0.0; extra == "dev"
14
14
  Requires-Dist: ruff>=0.5.0; extra == "dev"
@@ -4,17 +4,17 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gaard-client"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "GAARD frontend web services providing client interface"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
11
11
 
12
12
  dependencies = [
13
- "gaard-plugin-api>=0.2.0,<0.3.0",
13
+ "gaard-plugin-api>=0.2.2,<0.3.0",
14
14
  "fastapi>=0.111.0",
15
15
  "uvicorn[standard]>=0.30.0",
16
16
  "pydantic>=2.7.0",
17
- "httpx>=0.27.0",
17
+ "httpx2>=2.5.0",
18
18
  ]
19
19
 
20
20
  [project.optional-dependencies]
@@ -1,7 +1,10 @@
1
+ from __future__ import annotations
2
+
1
3
  import uvicorn
4
+ from argparse import ArgumentParser, Namespace, _SubParsersAction
2
5
 
3
6
 
4
- def register(subparsers):
7
+ def register(subparsers: _SubParsersAction[ArgumentParser]) -> None:
5
8
  parser = subparsers.add_parser("client")
6
9
  parser.add_argument("--host", default="127.0.0.1")
7
10
  parser.add_argument("--port", type=int, default=8001)
@@ -9,7 +12,7 @@ def register(subparsers):
9
12
  parser.set_defaults(func=run_client)
10
13
 
11
14
 
12
- def run_client(args):
15
+ def run_client(args: Namespace) -> None:
13
16
  uvicorn.run(
14
17
  "gaard_client.main:app",
15
18
  host=args.host,
@@ -467,6 +467,7 @@ textarea {
467
467
  }
468
468
 
469
469
  .data-table th {
470
+ overflow-wrap: break-word;
470
471
  background: #f7f9fb;
471
472
  color: var(--muted);
472
473
  font-size: 12px;
@@ -1,22 +1,29 @@
1
1
  import json
2
2
  import os
3
- from typing import Any
3
+
4
+ from collections.abc import AsyncIterator
5
+ from importlib.resources import as_file, files
6
+ from pathlib import Path
7
+
8
+ from typing import Any, cast
4
9
  from urllib.parse import urlparse
5
10
 
6
- import httpx
11
+ import httpx2 as httpx
7
12
  from fastapi import FastAPI, HTTPException
8
13
  from fastapi.responses import FileResponse, Response, StreamingResponse
9
14
  from fastapi.staticfiles import StaticFiles
10
15
  from pydantic import BaseModel, Field
11
- from importlib.resources import files
12
16
 
13
17
 
14
- CLIENT_WEB_DIR = files("gaard_client").joinpath("client-web")
18
+ with as_file(files("gaard_client").joinpath("client-web")) as _path:
19
+ CLIENT_WEB_DIR: Path = Path(_path).absolute()
20
+
15
21
  DEFAULT_BACKEND_URL = "http://localhost:8000"
16
22
 
23
+
17
24
  app = FastAPI(
18
25
  title="GAARD Client",
19
- version="0.2.1",
26
+ version="0.2.2",
20
27
  description="Community client for asking governed natural-language questions.",
21
28
  )
22
29
 
@@ -110,7 +117,7 @@ async def query_backend(request: ClientQueryRequest) -> dict[str, Any]:
110
117
  else response.text,
111
118
  )
112
119
 
113
- return response.json()
120
+ return cast(dict[str, Any], response.json())
114
121
 
115
122
 
116
123
  @app.post("/api/widgets/from-query")
@@ -145,7 +152,7 @@ async def create_widget_from_query(request: ClientWidgetFromQueryRequest) -> dic
145
152
  else response.text,
146
153
  )
147
154
 
148
- return response.json()
155
+ return cast(dict[str, Any], response.json())
149
156
 
150
157
 
151
158
  @app.post("/api/query/stream")
@@ -153,7 +160,7 @@ async def query_backend_stream(request: ClientQueryRequest) -> StreamingResponse
153
160
  backend_url = normalize_backend_url(request.backend_url or get_default_backend_url())
154
161
  query_url = f"{backend_url}/api/v1/query/stream"
155
162
 
156
- async def stream_backend():
163
+ async def stream_backend() -> AsyncIterator[str]:
157
164
  try:
158
165
  async with httpx.AsyncClient(timeout=120.0) as client:
159
166
  async with client.stream(
@@ -201,7 +208,7 @@ async def analysis_backend_stream(request: ClientQueryRequest) -> StreamingRespo
201
208
  backend_url = normalize_backend_url(request.backend_url or get_default_backend_url())
202
209
  analysis_url = f"{backend_url}/api/v1/analysis/stream"
203
210
 
204
- async def stream_backend():
211
+ async def stream_backend() -> AsyncIterator[str]:
205
212
  async for chunk in proxy_stream(
206
213
  url=analysis_url,
207
214
  payload={
@@ -222,7 +229,7 @@ async def analysis_message_backend_stream(
222
229
  backend_url = normalize_backend_url(request.backend_url or get_default_backend_url())
223
230
  analysis_url = f"{backend_url}/api/v1/analysis/{session_id}/messages/stream"
224
231
 
225
- async def stream_backend():
232
+ async def stream_backend() -> AsyncIterator[str]:
226
233
  async for chunk in proxy_stream(
227
234
  url=analysis_url,
228
235
  payload={
@@ -234,7 +241,7 @@ async def analysis_message_backend_stream(
234
241
  return StreamingResponse(stream_backend(), media_type="application/x-ndjson")
235
242
 
236
243
 
237
- async def proxy_stream(url: str, payload: dict[str, Any]):
244
+ async def proxy_stream(url: str, payload: dict[str, Any]) -> AsyncIterator[str]:
238
245
  try:
239
246
  async with httpx.AsyncClient(timeout=120.0) as client:
240
247
  async with client.stream("POST", url, json=payload) as response:
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gaard-client
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: GAARD frontend web services providing client interface
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
7
- Requires-Dist: gaard-plugin-api<0.3.0,>=0.2.0
7
+ Requires-Dist: gaard-plugin-api<0.3.0,>=0.2.2
8
8
  Requires-Dist: fastapi>=0.111.0
9
9
  Requires-Dist: uvicorn[standard]>=0.30.0
10
10
  Requires-Dist: pydantic>=2.7.0
11
- Requires-Dist: httpx>=0.27.0
11
+ Requires-Dist: httpx2>=2.5.0
12
12
  Provides-Extra: dev
13
13
  Requires-Dist: pytest>=8.0.0; extra == "dev"
14
14
  Requires-Dist: ruff>=0.5.0; extra == "dev"
@@ -1,8 +1,8 @@
1
- gaard-plugin-api<0.3.0,>=0.2.0
1
+ gaard-plugin-api<0.3.0,>=0.2.2
2
2
  fastapi>=0.111.0
3
3
  uvicorn[standard]>=0.30.0
4
4
  pydantic>=2.7.0
5
- httpx>=0.27.0
5
+ httpx2>=2.5.0
6
6
 
7
7
  [dev]
8
8
  pytest>=8.0.0
@@ -1,6 +1,6 @@
1
1
  import json
2
2
 
3
- import httpx
3
+ import httpx2 as httpx
4
4
  from fastapi.testclient import TestClient
5
5
 
6
6
  from gaard_client.main import app
File without changes
File without changes