runtime-sdk 0.4.13__tar.gz → 0.4.14__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: runtime-sdk
3
- Version: 0.4.13
3
+ Version: 0.4.14
4
4
  Summary: Runtime Python SDK and CLI
5
5
  Project-URL: Repository, https://github.com/The-Money-Company-Limited/runtimevm
6
6
  Project-URL: Issues, https://github.com/The-Money-Company-Limited/runtimevm/issues
@@ -35,10 +35,12 @@ uv tool upgrade runtime-sdk
35
35
 
36
36
  ## Configure
37
37
 
38
- The CLI talks to `http://127.0.0.1:8080` by default. Override it with:
38
+ The CLI talks to `https://api.runruntime.dev` by default.
39
+
40
+ For local or self-hosted Runtime, override it with:
39
41
 
40
42
  ```bash
41
- export RUNTIME_BASE_URL=https://api.runruntime.dev
43
+ export RUNTIME_BASE_URL=http://127.0.0.1:8080
42
44
  ```
43
45
 
44
46
  Or pass `--base-url` per command.
@@ -16,10 +16,12 @@ uv tool upgrade runtime-sdk
16
16
 
17
17
  ## Configure
18
18
 
19
- The CLI talks to `http://127.0.0.1:8080` by default. Override it with:
19
+ The CLI talks to `https://api.runruntime.dev` by default.
20
+
21
+ For local or self-hosted Runtime, override it with:
20
22
 
21
23
  ```bash
22
- export RUNTIME_BASE_URL=https://api.runruntime.dev
24
+ export RUNTIME_BASE_URL=http://127.0.0.1:8080
23
25
  ```
24
26
 
25
27
  Or pass `--base-url` per command.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "runtime-sdk"
3
- version = "0.4.13"
3
+ version = "0.4.14"
4
4
  description = "Runtime Python SDK and CLI"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -132,7 +132,7 @@ class _UI:
132
132
 
133
133
  def build_parser() -> argparse.ArgumentParser:
134
134
  parser = argparse.ArgumentParser(prog="runtime")
135
- parser.add_argument("--base-url", help="Runtime API base URL")
135
+ parser.add_argument("--base-url", help="Override the Runtime API base URL")
136
136
  parser.add_argument("--version", action="version", version=f"runtime-sdk {__version__}")
137
137
 
138
138
  # Subcommand is optional: bare `runtime` defaults to `create`.
@@ -265,13 +265,12 @@ def main(argv: list[str] | None = None) -> int:
265
265
 
266
266
  try:
267
267
  config = load_config()
268
- base_url = (
269
- args.base_url
270
- or os.environ.get("RUNTIME_BASE_URL")
271
- or config.base_url
272
- or DEFAULT_BASE_URL
273
- )
274
- config.base_url = base_url
268
+ if args.base_url:
269
+ config.base_url = args.base_url
270
+ elif os.environ.get("RUNTIME_BASE_URL"):
271
+ config.base_url = str(os.environ.get("RUNTIME_BASE_URL"))
272
+ else:
273
+ config.base_url = config.configured_base_url or DEFAULT_BASE_URL
275
274
 
276
275
  # Bare `runtime` → first-run onboarding for interactive users, create otherwise.
277
276
  if args.command is None:
@@ -6,7 +6,7 @@ from dataclasses import asdict, dataclass
6
6
  from pathlib import Path
7
7
 
8
8
 
9
- DEFAULT_BASE_URL = "http://127.0.0.1:8080"
9
+ DEFAULT_BASE_URL = "https://api.runruntime.dev"
10
10
 
11
11
 
12
12
  class RuntimeConfigError(RuntimeError):
@@ -23,6 +23,7 @@ class PendingSignup:
23
23
  @dataclass(slots=True)
24
24
  class RuntimeConfig:
25
25
  base_url: str = DEFAULT_BASE_URL
26
+ configured_base_url: str | None = None
26
27
  api_key: str | None = None
27
28
  pending_signup: PendingSignup | None = None
28
29
 
@@ -37,7 +38,7 @@ def config_path() -> Path:
37
38
  def load_config() -> RuntimeConfig:
38
39
  path = config_path()
39
40
  if not path.exists():
40
- return RuntimeConfig(base_url=os.environ.get("RUNTIME_BASE_URL", DEFAULT_BASE_URL))
41
+ return RuntimeConfig()
41
42
 
42
43
  try:
43
44
  data = json.loads(path.read_text())
@@ -48,9 +49,11 @@ def load_config() -> RuntimeConfig:
48
49
  if not isinstance(data, dict):
49
50
  raise RuntimeConfigError("config file must contain a JSON object")
50
51
  pending = data.get("pending_signup")
52
+ configured_base_url = data.get("base_url") or None
51
53
  try:
52
54
  return RuntimeConfig(
53
- base_url=data.get("base_url") or os.environ.get("RUNTIME_BASE_URL", DEFAULT_BASE_URL),
55
+ base_url=configured_base_url or DEFAULT_BASE_URL,
56
+ configured_base_url=configured_base_url,
54
57
  api_key=data.get("api_key"),
55
58
  pending_signup=PendingSignup(**pending) if pending else None,
56
59
  )
@@ -60,7 +63,13 @@ def load_config() -> RuntimeConfig:
60
63
 
61
64
  def save_config(config: RuntimeConfig) -> None:
62
65
  path = config_path()
63
- payload = asdict(config)
66
+ configured_base_url = config.configured_base_url
67
+ payload = {
68
+ "api_key": config.api_key,
69
+ "pending_signup": asdict(config.pending_signup) if config.pending_signup else None,
70
+ }
71
+ if configured_base_url is not None:
72
+ payload["base_url"] = configured_base_url
64
73
  try:
65
74
  path.parent.mkdir(parents=True, exist_ok=True, mode=0o700)
66
75
  path.write_text(json.dumps(payload, indent=2) + "\n")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: runtime-sdk
3
- Version: 0.4.13
3
+ Version: 0.4.14
4
4
  Summary: Runtime Python SDK and CLI
5
5
  Project-URL: Repository, https://github.com/The-Money-Company-Limited/runtimevm
6
6
  Project-URL: Issues, https://github.com/The-Money-Company-Limited/runtimevm/issues
@@ -35,10 +35,12 @@ uv tool upgrade runtime-sdk
35
35
 
36
36
  ## Configure
37
37
 
38
- The CLI talks to `http://127.0.0.1:8080` by default. Override it with:
38
+ The CLI talks to `https://api.runruntime.dev` by default.
39
+
40
+ For local or self-hosted Runtime, override it with:
39
41
 
40
42
  ```bash
41
- export RUNTIME_BASE_URL=https://api.runruntime.dev
43
+ export RUNTIME_BASE_URL=http://127.0.0.1:8080
42
44
  ```
43
45
 
44
46
  Or pass `--base-url` per command.
File without changes