glaip-sdk 0.6.18__py3-none-any.whl → 0.6.20__py3-none-any.whl

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.
@@ -18,19 +18,89 @@ from glaip_sdk.branding import ACCENT_STYLE, ERROR_STYLE, INFO_STYLE, SUCCESS_ST
18
18
  PACKAGE_NAME = "glaip-sdk"
19
19
 
20
20
 
21
- def _build_upgrade_command(include_prerelease: bool) -> Sequence[str]:
22
- """Return the pip command used to upgrade the SDK."""
23
- command = [
24
- sys.executable,
25
- "-m",
26
- "pip",
27
- "install",
28
- "--upgrade",
29
- PACKAGE_NAME,
30
- ]
21
+ def _is_uv_managed_environment() -> bool:
22
+ """Check if running in a uv-managed tool environment.
23
+
24
+ Uses a path-based heuristic that may need updates if uv changes its layout.
25
+ """
26
+ executable = str(sys.executable)
27
+ # Check for uv tool install paths: ~/.local/share/uv/tools/*/bin/python*
28
+ return ".local/share/uv/tools" in executable or "/uv/tools/" in executable
29
+
30
+
31
+ def _build_command_parts(
32
+ *,
33
+ package_name: str = PACKAGE_NAME,
34
+ is_uv: bool | None = None,
35
+ force_reinstall: bool = False,
36
+ include_prerelease: bool = False,
37
+ ) -> tuple[list[str], str]:
38
+ """Build the common parts of upgrade commands.
39
+
40
+ Returns:
41
+ Tuple of (command parts list, force_reinstall flag name).
42
+ For uv: (["uv", "tool", "install", "--upgrade", package_name], "--reinstall")
43
+ For pip: (["pip", "install", "--upgrade", package_name], "--force-reinstall")
44
+ """
45
+ if is_uv is None:
46
+ is_uv = _is_uv_managed_environment()
47
+
48
+ if is_uv:
49
+ command = ["uv", "tool", "install", "--upgrade", package_name]
50
+ reinstall_flag = "--reinstall"
51
+ else:
52
+ command = ["pip", "install", "--upgrade", package_name]
53
+ reinstall_flag = "--force-reinstall"
54
+
55
+ if force_reinstall:
56
+ command.insert(-1, reinstall_flag)
57
+
31
58
  if include_prerelease:
32
59
  command.append("--pre")
33
- return command
60
+
61
+ return command, reinstall_flag
62
+
63
+
64
+ def _build_upgrade_command(
65
+ include_prerelease: bool,
66
+ *,
67
+ package_name: str = PACKAGE_NAME,
68
+ is_uv: bool | None = None,
69
+ force_reinstall: bool = False,
70
+ ) -> Sequence[str]:
71
+ """Return the command used to upgrade the SDK (pip or uv tool install)."""
72
+ if is_uv is None:
73
+ is_uv = _is_uv_managed_environment()
74
+
75
+ command_parts, _ = _build_command_parts(
76
+ package_name=package_name,
77
+ is_uv=is_uv,
78
+ force_reinstall=force_reinstall,
79
+ include_prerelease=include_prerelease,
80
+ )
81
+
82
+ # For pip, prepend sys.executable and -m
83
+ if not is_uv:
84
+ command_parts = [sys.executable, "-m"] + command_parts
85
+
86
+ return command_parts
87
+
88
+
89
+ def _build_manual_upgrade_command(
90
+ include_prerelease: bool,
91
+ *,
92
+ package_name: str = PACKAGE_NAME,
93
+ is_uv: bool | None = None,
94
+ force_reinstall: bool = False,
95
+ ) -> str:
96
+ """Return a manual upgrade command string matching the active environment."""
97
+ command_parts, _ = _build_command_parts(
98
+ package_name=package_name,
99
+ is_uv=is_uv,
100
+ force_reinstall=force_reinstall,
101
+ include_prerelease=include_prerelease,
102
+ )
103
+ return " ".join(command_parts)
34
104
 
35
105
 
36
106
  @click.command(name="update")
@@ -41,21 +111,31 @@ def _build_upgrade_command(include_prerelease: bool) -> Sequence[str]:
41
111
  help="Include pre-release versions when upgrading.",
42
112
  )
43
113
  def update_command(include_prerelease: bool) -> None:
44
- """Upgrade the glaip-sdk package using pip."""
114
+ """Upgrade the glaip-sdk package using pip or uv tool install."""
45
115
  console = Console()
46
- upgrade_cmd = _build_upgrade_command(include_prerelease)
116
+ # Call _is_uv_managed_environment() once and pass explicitly to avoid redundant calls
117
+ is_uv = _is_uv_managed_environment()
118
+ upgrade_cmd = _build_upgrade_command(include_prerelease, is_uv=is_uv)
119
+
120
+ # Determine the appropriate manual command for error messages
121
+ manual_cmd = _build_manual_upgrade_command(include_prerelease, is_uv=is_uv)
122
+
47
123
  console.print(f"[{ACCENT_STYLE}]Upgrading {PACKAGE_NAME} using[/] [{INFO_STYLE}]{' '.join(upgrade_cmd)}[/]")
48
124
 
49
125
  try:
50
126
  subprocess.run(upgrade_cmd, check=True)
51
127
  except FileNotFoundError as exc:
128
+ if is_uv:
129
+ raise click.ClickException(
130
+ f"Unable to locate uv executable. Please ensure uv is installed and on your PATH.\n"
131
+ f"Install uv: curl -LsSf https://astral.sh/uv/install.sh | sh\n"
132
+ f"Or run manually: {manual_cmd}"
133
+ ) from exc
52
134
  raise click.ClickException(
53
135
  "Unable to locate Python executable to run pip. Please ensure Python is installed and try again."
54
136
  ) from exc
55
137
  except subprocess.CalledProcessError as exc:
56
- console.print(
57
- f"[{ERROR_STYLE}]Automatic upgrade failed.[/] Please run `pip install -U {PACKAGE_NAME}` manually."
58
- )
138
+ console.print(f"[{ERROR_STYLE}]Automatic upgrade failed.[/] Please run `{manual_cmd}` manually.")
59
139
  raise click.ClickException("Automatic upgrade failed.") from exc
60
140
 
61
141
  console.print(f"[{SUCCESS_STYLE}]✅ {PACKAGE_NAME} upgraded successfully.[/]")
glaip_sdk/cli/main.py CHANGED
@@ -35,7 +35,12 @@ from glaip_sdk.cli.commands.mcps import mcps_group
35
35
  from glaip_sdk.cli.commands.models import models_group
36
36
  from glaip_sdk.cli.commands.tools import tools_group
37
37
  from glaip_sdk.cli.commands.transcripts import transcripts_group
38
- from glaip_sdk.cli.commands.update import _build_upgrade_command, update_command
38
+ from glaip_sdk.cli.commands.update import (
39
+ _build_manual_upgrade_command,
40
+ _build_upgrade_command,
41
+ _is_uv_managed_environment,
42
+ update_command,
43
+ )
39
44
  from glaip_sdk.cli.config import load_config
40
45
  from glaip_sdk.cli.hints import in_slash_mode
41
46
  from glaip_sdk.cli.transcript import get_transcript_cache_stats
@@ -549,13 +554,24 @@ def update(check_only: bool, force: bool) -> None:
549
554
  ),
550
555
  )
551
556
 
552
- # Update using pip
557
+ # Update using pip or uv tool install
553
558
  try:
554
- cmd = list(_build_upgrade_command(include_prerelease=False))
555
- # Replace package name with "glaip-sdk" (main.py uses different name)
556
- cmd[-1] = "glaip-sdk"
557
- if force:
558
- cmd.insert(5, "--force-reinstall")
559
+ is_uv = _is_uv_managed_environment()
560
+ cmd = list(
561
+ _build_upgrade_command(
562
+ include_prerelease=False,
563
+ package_name="glaip-sdk",
564
+ is_uv=is_uv,
565
+ force_reinstall=force,
566
+ )
567
+ )
568
+
569
+ manual_cmd = _build_manual_upgrade_command(
570
+ include_prerelease=False,
571
+ package_name="glaip-sdk",
572
+ is_uv=is_uv,
573
+ force_reinstall=force,
574
+ )
559
575
  subprocess.run(cmd, capture_output=True, text=True, check=True)
560
576
 
561
577
  verify_hint = ""
@@ -582,15 +598,35 @@ def update(check_only: bool, force: bool) -> None:
582
598
  )
583
599
  console.print(f"📋 New version: {version_result.stdout.strip()}")
584
600
 
601
+ except FileNotFoundError:
602
+ troubleshooting = f"💡 Troubleshooting:\n • Try running: {manual_cmd}\n"
603
+ if is_uv:
604
+ troubleshooting += " • Ensure uv is installed: curl -LsSf https://astral.sh/uv/install.sh | sh"
605
+ error_detail = "uv executable not found in your PATH."
606
+ else:
607
+ troubleshooting += " • Ensure Python and pip are installed"
608
+ error_detail = "Python executable not found to run pip."
609
+ console.print(
610
+ AIPPanel(
611
+ f"[{ERROR_STYLE}]❌ Update failed[/]\n\n🔍 Error: {error_detail}\n\n{troubleshooting}",
612
+ title="❌ Update Error",
613
+ border_style=ERROR,
614
+ padding=(0, 1),
615
+ ),
616
+ )
617
+ sys.exit(1)
585
618
  except subprocess.CalledProcessError as e:
619
+ troubleshooting = (
620
+ f"💡 Troubleshooting:\n • Check your internet connection\n • Try running: {manual_cmd}\n"
621
+ )
622
+ if is_uv:
623
+ troubleshooting += " • Ensure uv is installed: curl -LsSf https://astral.sh/uv/install.sh | sh"
624
+ else:
625
+ troubleshooting += " • Check if you have write permissions"
626
+
586
627
  console.print(
587
628
  AIPPanel(
588
- f"[{ERROR_STYLE}]❌ Update failed[/]\n\n"
589
- f"🔍 Error: {e.stderr}\n\n"
590
- "💡 Troubleshooting:\n"
591
- " • Check your internet connection\n"
592
- " • Try running: pip install --upgrade glaip-sdk\n"
593
- " • Check if you have write permissions",
629
+ f"[{ERROR_STYLE}]❌ Update failed[/]\n\n🔍 Error: {e.stderr}\n\n{troubleshooting}",
594
630
  title="❌ Update Error",
595
631
  border_style=ERROR,
596
632
  padding=(0, 1),
@@ -22,10 +22,15 @@ from rich.console import Console
22
22
  from glaip_sdk.branding import (
23
23
  ACCENT_STYLE,
24
24
  ERROR_STYLE,
25
+ INFO_STYLE,
25
26
  SUCCESS_STYLE,
26
27
  WARNING_STYLE,
27
28
  )
28
- from glaip_sdk.cli.commands.update import update_command
29
+ from glaip_sdk.cli.commands.update import (
30
+ _build_manual_upgrade_command,
31
+ _is_uv_managed_environment,
32
+ update_command,
33
+ )
29
34
  from glaip_sdk.cli.constants import UPDATE_CHECK_ENABLED
30
35
  from glaip_sdk.cli.hints import format_command_hint
31
36
  from glaip_sdk.cli.utils import command_hint
@@ -221,6 +226,16 @@ def _run_update_command(console: Console, ctx: Any) -> None:
221
226
  except click.ClickException as exc:
222
227
  exc.show()
223
228
  console.print(f"[{ERROR_STYLE}]Update command exited with an error.[/]")
229
+ # Provide additional context for uv environments
230
+ try:
231
+ if _is_uv_managed_environment():
232
+ manual_cmd = _build_manual_upgrade_command(include_prerelease=False, is_uv=True)
233
+ console.print(
234
+ f"[{INFO_STYLE}]💡 Tip:[/] If automatic update failed, try running manually:\n"
235
+ f" [{ACCENT_STYLE}]{manual_cmd}[/]"
236
+ )
237
+ except Exception as exc: # pragma: no cover - defensive guard
238
+ _LOGGER.debug("Failed to render uv update tip: %s", exc, exc_info=True)
224
239
  except click.Abort:
225
240
  console.print(f"[{WARNING_STYLE}]Update aborted by user.[/]")
226
241
  except Exception as exc: # pragma: no cover - defensive guard
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: glaip-sdk
3
- Version: 0.6.18
4
- Summary: Python SDK for GL AIP (GDP Labs AI Agent Package) - Simplified CLI Design
3
+ Version: 0.6.20
4
+ Summary: Python SDK and CLI for GL AIP (GDP Labs AI Agent Package) - Build, run, and manage AI agents
5
5
  Author-email: Raymond Christopher <raymond.christopher@gdplabs.id>
6
6
  License: MIT
7
7
  Requires-Python: <3.13,>=3.11
@@ -19,11 +19,13 @@ Requires-Dist: textual>=0.52.0
19
19
  Requires-Dist: gllm-core-binary>=0.1.0
20
20
  Requires-Dist: langchain-core>=0.3.0
21
21
  Requires-Dist: gllm-tools-binary>=0.1.3
22
- Requires-Dist: aip-agents-binary[local]>=0.5.13
22
+ Provides-Extra: local
23
+ Requires-Dist: aip-agents-binary[local]>=0.5.14; (python_version >= "3.11" and python_version < "3.13") and extra == "local"
24
+ Requires-Dist: wrapt>=1.17.0; (python_version >= "3.11" and python_version < "3.13") and extra == "local"
23
25
  Provides-Extra: memory
24
- Requires-Dist: aip-agents-binary[memory]>=0.5.13; (python_version >= "3.11" and python_version < "3.13") and extra == "memory"
26
+ Requires-Dist: aip-agents-binary[memory]>=0.5.14; (python_version >= "3.11" and python_version < "3.13") and extra == "memory"
25
27
  Provides-Extra: privacy
26
- Requires-Dist: aip-agents-binary[privacy]>=0.5.13; (python_version >= "3.11" and python_version < "3.13") and extra == "privacy"
28
+ Requires-Dist: aip-agents-binary[privacy]>=0.5.14; (python_version >= "3.11" and python_version < "3.13") and extra == "privacy"
27
29
  Requires-Dist: en-core-web-sm; extra == "privacy"
28
30
  Provides-Extra: dev
29
31
  Requires-Dist: pytest>=7.0.0; extra == "dev"
@@ -48,16 +50,27 @@ GL stands for **GDP Labs**—GL AIP is our AI Agents Package for building, runni
48
50
 
49
51
  ### Installation
50
52
 
53
+ Installing `glaip-sdk` provides both the **Python SDK** and the **`aip` CLI command** in a single package.
54
+
51
55
  ```bash
52
56
  # Using pip (recommended)
53
57
  pip install --upgrade glaip-sdk
54
58
 
55
59
  # Using uv (fast alternative)
56
60
  uv tool install glaip-sdk
61
+
62
+ # Using pipx (CLI-focused, isolated environment)
63
+ pipx install glaip-sdk
57
64
  ```
58
65
 
59
66
  **Requirements**: Python 3.11 or 3.12
60
67
 
68
+ **Updating**: The `aip` CLI automatically detects your installation method and uses the correct update command:
69
+
70
+ - If installed via `pip`: Uses `pip install --upgrade glaip-sdk`
71
+ - If installed via `uv tool install`: Uses `uv tool install --upgrade glaip-sdk`
72
+ - You can also update manually using the same command you used to install
73
+
61
74
  ## 🐍 Hello World - Python SDK
62
75
 
63
76
  Perfect for building applications and integrations.
@@ -16,13 +16,13 @@ glaip_sdk/cli/context.py,sha256=--Y5vc6lgoAV7cRoUAr9UxSQaLmkMg29FolA7EwoRqM,3803
16
16
  glaip_sdk/cli/display.py,sha256=ojgWdGeD5KUnGOmWNqqK4JP-1EaWHWX--DWze3BmIz0,12137
17
17
  glaip_sdk/cli/hints.py,sha256=ca4krG103IS43s5BSLr0-N7uRMpte1_LY4nAXVvgDxo,1596
18
18
  glaip_sdk/cli/io.py,sha256=ChP6CRKbtuENsNomNEaMDfPDU0iqO-WuVvl4_y7F2io,3871
19
- glaip_sdk/cli/main.py,sha256=YBWAC6ehffLP_TXZkNBxPrIHN5RqsSD8GLeIZdRBoIg,21911
19
+ glaip_sdk/cli/main.py,sha256=vQ8YcsFT4tG0xXCsJdS1WEWHK6ojiQS6pWIRWiW9PnA,23275
20
20
  glaip_sdk/cli/masking.py,sha256=2lrXQ-pfL7N-vNEQRT1s4Xq3JPDPDT8RC61OdaTtkkc,4060
21
21
  glaip_sdk/cli/mcp_validators.py,sha256=cwbz7p_p7_9xVuuF96OBQOdmEgo5UObU6iWWQ2X03PI,10047
22
22
  glaip_sdk/cli/pager.py,sha256=XygkAB6UW3bte7I4KmK7-PUGCJiq2Pv-4-MfyXAmXCw,7925
23
23
  glaip_sdk/cli/resolution.py,sha256=K-VaEHm9SYY_qfb9538VNHykL4_2N6F8iQqI1zMx_64,2402
24
24
  glaip_sdk/cli/rich_helpers.py,sha256=kO47N8e506rxrN6Oc9mbAWN3Qb536oQPWZy1s9A616g,819
25
- glaip_sdk/cli/update_notifier.py,sha256=FnTjzS8YT94RmP6c5aU_XNIyRi7FRHvAskMy-VJikl8,10064
25
+ glaip_sdk/cli/update_notifier.py,sha256=Wbe_6WD_iQKq1GvoFS_vdcD_PIfj1LGCXMf0on2jKMY,10732
26
26
  glaip_sdk/cli/utils.py,sha256=iemmKkpPndoZFBasoVqV7QArplchtr08yYWLA2efMzg,11996
27
27
  glaip_sdk/cli/validators.py,sha256=d-kq4y7HWMo6Gc7wLXWUsCt8JwFvJX_roZqRm1Nko1I,5622
28
28
  glaip_sdk/cli/commands/__init__.py,sha256=6Z3ASXDut0lAbUX_umBFtxPzzFyqoiZfVeTahThFu1A,219
@@ -34,7 +34,7 @@ glaip_sdk/cli/commands/mcps.py,sha256=tttqQnfM89iI9Pm94u8YRhiHMQNYNouecFX0brsT4c
34
34
  glaip_sdk/cli/commands/models.py,sha256=vfcGprK5CHprQ0CNpNzQlNNTELvdgKC7JxTG_ijOwmE,2009
35
35
  glaip_sdk/cli/commands/tools.py,sha256=_VBqG-vIjnn-gqvDlSTvcU7_F4N3ANGGKEECcQVR-BM,18430
36
36
  glaip_sdk/cli/commands/transcripts.py,sha256=ofxZLus1xLB061NxrLo1J6LPEb2VIxJTjmz7hLKgPmc,26377
37
- glaip_sdk/cli/commands/update.py,sha256=rIZo_x-tvpvcwpQLpwYwso1ix6qTHuNNTL4egmn5fEM,1812
37
+ glaip_sdk/cli/commands/update.py,sha256=BZJ_E0iF0K9n6EupQAqjTSzUP4GPmq5ybqhx5i-_xQ0,4611
38
38
  glaip_sdk/cli/core/__init__.py,sha256=HTQqpijKNts6bYnwY97rpP3J324phoQmGFi6OXqi0E4,2116
39
39
  glaip_sdk/cli/core/context.py,sha256=I22z5IhZ09g5FPtMycDGU9Aj20Qv3TOQLhA5enaU2qk,3970
40
40
  glaip_sdk/cli/core/output.py,sha256=hj5F1M_rEqr4CChmdyW1QzGiWL0Mwzf-BFw-d6pjhjY,28304
@@ -156,8 +156,8 @@ glaip_sdk/utils/rendering/steps/format.py,sha256=Chnq7OBaj8XMeBntSBxrX5zSmrYeGcO
156
156
  glaip_sdk/utils/rendering/steps/manager.py,sha256=BiBmTeQMQhjRMykgICXsXNYh1hGsss-fH9BIGVMWFi0,13194
157
157
  glaip_sdk/utils/rendering/viewer/__init__.py,sha256=XrxmE2cMAozqrzo1jtDFm8HqNtvDcYi2mAhXLXn5CjI,457
158
158
  glaip_sdk/utils/rendering/viewer/presenter.py,sha256=mlLMTjnyeyPVtsyrAbz1BJu9lFGQSlS-voZ-_Cuugv0,5725
159
- glaip_sdk-0.6.18.dist-info/METADATA,sha256=cPfNrNuml65FqIP1ZhrAp2AEiiipu3OADHcT345uI6g,7716
160
- glaip_sdk-0.6.18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
161
- glaip_sdk-0.6.18.dist-info/entry_points.txt,sha256=65vNPUggyYnVGhuw7RhNJ8Fp2jygTcX0yxJBcBY3iLU,48
162
- glaip_sdk-0.6.18.dist-info/top_level.txt,sha256=td7yXttiYX2s94-4wFhv-5KdT0rSZ-pnJRSire341hw,10
163
- glaip_sdk-0.6.18.dist-info/RECORD,,
159
+ glaip_sdk-0.6.20.dist-info/METADATA,sha256=m7NqyPGjDfUjM7TCsH_KcD_NSlQKW3-BesUIpYdEq5g,8455
160
+ glaip_sdk-0.6.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
161
+ glaip_sdk-0.6.20.dist-info/entry_points.txt,sha256=65vNPUggyYnVGhuw7RhNJ8Fp2jygTcX0yxJBcBY3iLU,48
162
+ glaip_sdk-0.6.20.dist-info/top_level.txt,sha256=td7yXttiYX2s94-4wFhv-5KdT0rSZ-pnJRSire341hw,10
163
+ glaip_sdk-0.6.20.dist-info/RECORD,,