gaard-client 0.2.4__tar.gz → 0.2.6__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 (22) hide show
  1. {gaard_client-0.2.4 → gaard_client-0.2.6}/PKG-INFO +10 -4
  2. {gaard_client-0.2.4 → gaard_client-0.2.6}/README.md +8 -2
  3. {gaard_client-0.2.4 → gaard_client-0.2.6}/pyproject.toml +2 -2
  4. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client/cli.py +2 -4
  5. gaard_client-0.2.6/src/gaard_client/cli_commands.py +49 -0
  6. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client/client-web/assets/main.js +406 -36
  7. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client/client-web/assets/styles.css +94 -3
  8. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client/main.py +127 -2
  9. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client.egg-info/PKG-INFO +10 -4
  10. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client.egg-info/requires.txt +1 -1
  11. gaard_client-0.2.6/tests/test_cli.py +83 -0
  12. {gaard_client-0.2.4 → gaard_client-0.2.6}/tests/test_client_app.py +139 -10
  13. gaard_client-0.2.4/src/gaard_client/cli_commands.py +0 -21
  14. gaard_client-0.2.4/tests/test_cli.py +0 -20
  15. {gaard_client-0.2.4 → gaard_client-0.2.6}/setup.cfg +0 -0
  16. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client/__init__.py +0 -0
  17. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client/client-web/assets/getgaard.svg +0 -0
  18. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client/client-web/index.html +0 -0
  19. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client.egg-info/SOURCES.txt +0 -0
  20. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client.egg-info/dependency_links.txt +0 -0
  21. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client.egg-info/entry_points.txt +0 -0
  22. {gaard_client-0.2.4 → gaard_client-0.2.6}/src/gaard_client.egg-info/top_level.txt +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gaard-client
3
- Version: 0.2.4
3
+ Version: 0.2.6
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.4
7
+ Requires-Dist: gaard-plugin-api<0.3.0,>=0.2.6
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
@@ -33,7 +33,13 @@ After installation, start it with:
33
33
  gaard-client start
34
34
  ```
35
35
 
36
- The command accepts `--host`, `--port`, and `--reload`. By default the client is
37
- available at `http://localhost:8001?backendUrl=http://localhost:8000`.
36
+ The command accepts `--host`, `--port`, `--reload`, and `--api-url`. By default the client is
37
+ available at `http://localhost:8001`.
38
+
39
+ Use `--api-url` to point the client server to a specific GAARD API instance:
40
+
41
+ ```bash
42
+ gaard-client start --api-url http://localhost:8000
43
+ ```
38
44
 
39
45
  The older `gaard client` command remains available for compatibility.
@@ -16,7 +16,13 @@ After installation, start it with:
16
16
  gaard-client start
17
17
  ```
18
18
 
19
- The command accepts `--host`, `--port`, and `--reload`. By default the client is
20
- available at `http://localhost:8001?backendUrl=http://localhost:8000`.
19
+ The command accepts `--host`, `--port`, `--reload`, and `--api-url`. By default the client is
20
+ available at `http://localhost:8001`.
21
+
22
+ Use `--api-url` to point the client server to a specific GAARD API instance:
23
+
24
+ ```bash
25
+ gaard-client start --api-url http://localhost:8000
26
+ ```
21
27
 
22
28
  The older `gaard client` command remains available for compatibility.
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gaard-client"
7
- version = "0.2.4"
7
+ version = "0.2.6"
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.4,<0.3.0",
13
+ "gaard-plugin-api>=0.2.6,<0.3.0",
14
14
  "fastapi>=0.111.0",
15
15
  "uvicorn[standard]>=0.30.0",
16
16
  "pydantic>=2.7.0",
@@ -1,7 +1,7 @@
1
1
  import argparse
2
2
  from collections.abc import Sequence
3
3
 
4
- from gaard_client.cli_commands import run_client
4
+ from gaard_client.cli_commands import add_client_server_arguments, run_client
5
5
 
6
6
 
7
7
  def create_parser(prog: str = "gaard-client") -> argparse.ArgumentParser:
@@ -12,9 +12,7 @@ def create_parser(prog: str = "gaard-client") -> argparse.ArgumentParser:
12
12
  subparsers = parser.add_subparsers(dest="command", required=True)
13
13
 
14
14
  start_parser = subparsers.add_parser("start", help="Start the client server.")
15
- start_parser.add_argument("--host", default="127.0.0.1")
16
- start_parser.add_argument("--port", type=int, default=8001)
17
- start_parser.add_argument("--reload", action="store_true")
15
+ add_client_server_arguments(start_parser)
18
16
  start_parser.set_defaults(func=run_client)
19
17
 
20
18
  return parser
@@ -0,0 +1,49 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ from argparse import ArgumentParser, ArgumentTypeError, Namespace, _SubParsersAction
5
+ from urllib.parse import urlparse
6
+
7
+ import uvicorn
8
+
9
+
10
+ def normalize_api_url(value: str) -> str:
11
+ normalized = value.strip().rstrip("/")
12
+ parsed = urlparse(normalized)
13
+ if parsed.scheme not in {"http", "https"} or not parsed.netloc:
14
+ raise ArgumentTypeError("API URL must be an absolute http:// or https:// URL.")
15
+
16
+ return normalized
17
+
18
+
19
+ def add_client_server_arguments(parser: ArgumentParser) -> None:
20
+ parser.add_argument("--host", default="127.0.0.1")
21
+ parser.add_argument("--port", type=int, default=8001)
22
+ parser.add_argument("--reload", action="store_true")
23
+ parser.add_argument(
24
+ "--api-url",
25
+ "--backend-url",
26
+ dest="api_url",
27
+ type=normalize_api_url,
28
+ default=None,
29
+ help="GAARD API URL used by the client server, e.g. http://localhost:8000.",
30
+ )
31
+
32
+
33
+ def register(subparsers: _SubParsersAction[ArgumentParser]) -> None:
34
+ parser = subparsers.add_parser("client")
35
+ add_client_server_arguments(parser)
36
+ parser.set_defaults(func=run_client)
37
+
38
+
39
+ def run_client(args: Namespace) -> None:
40
+ api_url = getattr(args, "api_url", None)
41
+ if api_url:
42
+ os.environ["GAARD_CLIENT_BACKEND_URL"] = api_url
43
+
44
+ uvicorn.run(
45
+ "gaard_client.main:app",
46
+ host=args.host,
47
+ port=args.port,
48
+ reload=args.reload,
49
+ )