envloop-cli 1.30.0__py3-none-any.whl → 1.32.0__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.
envloop/_optional.py CHANGED
@@ -38,7 +38,7 @@ CLIENTS = {
38
38
  **{name: ('experiment', 'client') for name in ('TrialService', 'RpcService', 'load_task', 'validate_command', 'dataset_selector', 'Trials', 'runner_selector', 'job_budget', 'Jobs')},
39
39
  **{name: ('base', 'downloads') for name in ('ArtifactError', 'artifact_path')},
40
40
  }
41
- DATA_ENDPOINTS = set('open_download resolve_dataset list_runners get_runner_revision register_runner_revision runner_path profile_path put_profile list_profiles get_profile resolve_profile set_default_profile archive_profile revoke_profile_secret export_profile import_profile open_checkpoint_archive'.split())
41
+ DATA_ENDPOINTS = set('open_download resolve_dataset list_runners get_runner_revision register_runner_revision runner_path profile_path put_profile list_profiles get_profile resolve_profile set_default_profile archive_profile set_profile_visibility fork_profile revoke_profile_secret export_profile import_profile open_checkpoint_archive'.split())
42
42
  EXPERIMENT_ENDPOINTS = set('submit_job get_job get_job_result get_job_logs list_jobs job_action job_events stop_job list_trials get_task_run get_trial_detail get_trial_training list_trial_metrics list_trial_checkpoints get_task_result get_task_snapshot stop_task list_trial_artifacts open_trial_artifact'.split())
43
43
 
44
44
 
envloop/cli_errors.py CHANGED
@@ -47,6 +47,7 @@ _register("CONFLICT VERSION_CONFLICT RESOURCE_VERSION_CONFLICT PRECONDITION_FAIL
47
47
  _register("BAD_REQUEST VALIDATION_ERROR VALIDATION_FAILED INVALID_REQUEST INVALID_ARGUMENT INVALID_CURSOR INVALID_PROFILE INVALID_PROFILE_SECRETS", "The request or input is invalid.")
48
48
  _register("PROFILE_SECRET_NAME_INVALID", "A Secret parameter name must look like a credential, as the platform decides: it ends with API_KEY or _TOKEN, or contains PASSWORD, SECRET, CREDENTIAL, AUTHORIZATION, ACCESS_TOKEN, AUTH_TOKEN, BEARER_TOKEN or PRIVATE_KEY. Otherwise list the name in the Profile's secret_params. Names use letters, digits and underscores.")
49
49
  _register("PROFILE_SECRET_VALUE_INVALID", "A Secret parameter value is missing or unusable: it must be non-empty UTF-8 text of at most 64 KiB from a prompt, stdin, an environment variable or a file.")
50
+ _register("PROFILE_MODEL_KEY_UNSUPPORTED", "--model-api-key-stdin and --prompt-model-api-key only set the encrypted key of a managed model connection (params.model_connection). Store other keys as a Secret parameter, for example --secret MODEL_API_KEY=stdin.")
50
51
  _register("PROFILE_SECRET_CONFLICT", "Give each Secret parameter once, by --secret only (not also in the Profile file or patch), and read at most one value from stdin.")
51
52
  _register("RUNNER_PACKAGE_INVALID", "The Runner package directory is invalid. It needs runner.toml whose [runner] name matches the Runner and has no version, the [execution] entrypoint main.py or main.sh, at most 100 regular files, no symlinks, and path parts of letters, digits, '_', '.' or '-' that do not start with '.'.")
52
53
  _register("RUNNER_REVISION_INVALID", "Use the full lowercase 40- or 64-character source commit as --revision and a NAMESPACE/NAME Runner name.")
@@ -105,6 +106,11 @@ _register("INVALID_PROFILE_RUNNER", "The Profile Runner binding is invalid.")
105
106
  _register("PROFILE_RUNNER_CONFLICT", "The explicit Runner conflicts with the Profile binding.")
106
107
  _register("PROFILE_RUNNER_UNSUPPORTED", "This submission path cannot execute the Profile-bound Runner.")
107
108
  _register("PROFILE_ARCHIVED PROFILE_HASH_MISMATCH", "The selected Profile is archived or does not match its frozen version.")
109
+ _register("NAMED_PROFILE_INVALID PROFILE_INPUT_INVALID PROFILE_CHECKPOINT_MODEL_MISMATCH", "The named Profile or input binding is incompatible. Use its declared input slots and allowed parameter replacements.")
110
+ _register("PROFILE_AUTHORIZATION_UNAVAILABLE", "Current Profile authorization could not be verified. Retry the same request after authorization is available.")
111
+ _register("VISIBILITY_CONFLICT", "Visibility changed since it was read. Read the resource and use its current visibility and ACL revision before retrying.")
112
+ _register("VISIBILITY_INVALID", "Choose private or public visibility for a supported resource.")
113
+ _register("PUBLIC_DEPENDENCY_UNAVAILABLE PUBLIC_CONTENT_UNSAFE PUBLICATION_REVIEW_REQUIRED", "Public sharing requires reviewed content and currently readable public dependencies. Private dependencies are never published automatically.")
108
114
  _register("CHECKPOINT_AMBIGUOUS", "More than one checkpoint matches this selection.")
109
115
  _register("CHECKPOINT_FILES_UNAVAILABLE ARTIFACT_NOT_READY", "The requested download is not available yet.")
110
116
  _register("CHECKPOINT_FILES_INVALID ARTIFACT_LISTING_INVALID ARTIFACT_NAME_UNSAFE UNSAFE_ARTIFACT_REDIRECT ARTIFACT_SIZE_MISMATCH ARTIFACT_HASH_MISMATCH", "The download failed a safety or integrity check.")
@@ -305,6 +311,9 @@ def format_error(error: BaseException) -> str:
305
311
  code = remote.code
306
312
  local = _http_message(status) if code == "HTTP_ERROR" or code not in _MESSAGES else _MESSAGES[code]
307
313
  extra: dict[str, Any] = {"hint": remote.hint, "details": remote.details, "request_id": remote.request_id} if remote else {}
314
+ if remote and remote.message and remote.details:
315
+ # A detail that repeats the message (one refused field) only adds where it is: show the field alone.
316
+ extra["details"] = [line.removesuffix(": " + remote.message) for line in remote.details if line != remote.message]
308
317
  if remote and remote.message:
309
318
  # Local text only adds guidance for codes the CLI documents.
310
319
  # A gateway timeout always adds that the request may have been processed.
@@ -320,14 +329,18 @@ def format_error(error: BaseException) -> str:
320
329
  def upload_recovery(error: BaseException) -> str:
321
330
  """Display only server upload IDs and keys generated locally for recovery."""
322
331
  lines = []
332
+ running = isinstance(error, TimeoutError)
323
333
  staging_id = getattr(error,'staging_id',None)
324
334
  if isinstance(staging_id,str) and re.fullmatch(r'pub_[a-f0-9]{64}',staging_id):
325
- lines.append(f' Staging retained: {staging_id}. Retry the same create or update input.')
335
+ lines.append(f' Native publication {staging_id} is still running on the platform. Re-run the same create or update '
336
+ 'input to keep waiting.' if running else f' Staging retained: {staging_id}. Retry the same create or update input.')
326
337
  if getattr(error,'retirement_pending',False) is True:
327
338
  lines.append(' Retirement is pending; retry deletion of the same resource to complete it.')
328
339
  upload_id = getattr(error, 'upload_id', None)
329
340
  if isinstance(upload_id, str) and re.fullmatch(r'upload_[a-f0-9]{32}', upload_id):
330
341
  lines.extend([f' Upload retained: {upload_id}', f' Inspect with: el data upload get {upload_id}'])
342
+ if running:
343
+ lines.append(f' Poll publication with: el data upload complete {upload_id}')
331
344
  generated = getattr(error, 'generated_idempotency_key', None)
332
345
  # A definite refusal (permission, validation, not found) fails the same way again; offer the key only
333
346
  # when the outcome is unknown or retryable.
envloop/client.py CHANGED
@@ -33,10 +33,10 @@ class Client:
33
33
  raise RuntimeError(INTERACTIVE_TRAINING_REMOVED)
34
34
 
35
35
  @classmethod
36
- def remote(cls, api_url: str | None = None, *, timeout: float = 90, api_key: str | None = None, workspace_id: str | None = None, project_id: str | None = None, config: bool = True):
36
+ def remote(cls, api_url: str | None = None, *, timeout: float = 120, api_key: str | None = None, workspace_id: str | None = None, project_id: str | None = None, config: bool = True):
37
37
  from .http import HttpService
38
38
 
39
- # The default matches http.DEFAULT_TIMEOUT_SEC (longer than the hosted proxy's 60 s wait).
39
+ # The default matches http.DEFAULT_TIMEOUT_SEC (well beyond the hosted proxy's bounded long-polls).
40
40
  return cls(HttpService(api_url, timeout, api_key=api_key, workspace_id=workspace_id, project_id=project_id, config=config))
41
41
 
42
42
  @classmethod
envloop/http.py CHANGED
@@ -71,9 +71,10 @@ def retry_after_seconds(value: str | None) -> float | None:
71
71
  return None
72
72
 
73
73
 
74
- # The hosted API proxy waits up to 60 s for the platform. Wait longer by default so a slow answer, or the
74
+ # The hosted API proxy bounds its slow platform hops (a native Data publication answers 202 and is polled by
75
+ # repeating the request) and long-polls about 20 s. Wait well beyond that by default so a slow answer, or the
75
76
  # proxy's own gateway timeout, reaches the caller instead of a client-side timeout. Explicit values are kept.
76
- DEFAULT_TIMEOUT_SEC = 90.0
77
+ DEFAULT_TIMEOUT_SEC = 120.0
77
78
  # The proxy or edge stopped waiting while the platform was still working: the request may have been processed.
78
79
  GATEWAY_TIMEOUT_STATUSES = frozenset({504, 524})
79
80
 
@@ -127,6 +128,9 @@ def _text(value: Any, limit: int, secrets: tuple[str | None, ...] = ()) -> str |
127
128
  return (value[:limit - 1] + "\u2026" if len(value) > limit else value) or None
128
129
 
129
130
 
131
+ _DETAIL_TEXT = frozenset({"field", "loc", "name", "message", "msg", "error"})
132
+
133
+
130
134
  def _detail_lines(value: Any, secrets: tuple[str | None, ...]) -> list[str]:
131
135
  """Field-level validation detail from `fields`/`details`, as at most 10 short lines."""
132
136
  if isinstance(value, dict):
@@ -137,10 +141,13 @@ def _detail_lines(value: Any, secrets: tuple[str | None, ...]) -> list[str]:
137
141
  field = item.get("field") or item.get("loc") or item.get("name")
138
142
  field = ".".join(map(str, field)) if isinstance(field, list) else field
139
143
  message = item.get("message") or item.get("msg") or item.get("error")
140
- # A flat record such as {task, size_bytes, limit_bytes} reads as key=value pairs.
141
- item = f"{field}: {message}" if field and message else message or field or ", ".join(
142
- f"{key}={value}" for key, value in list(item.items())[:16]
143
- if isinstance(key, str) and isinstance(value, (str, int, float)) and not isinstance(value, bool))
144
+ # A flat record such as {task, size_bytes, limit_bytes} reads as key=value pairs; next to a field the
145
+ # same pairs locate it, e.g. `records (record_index=2): ...`.
146
+ pairs = ", ".join(f"{key}={value}" for key, value in list(item.items())[:16]
147
+ if isinstance(key, str) and key not in _DETAIL_TEXT
148
+ and isinstance(value, (str, int, float)) and not isinstance(value, bool))
149
+ located = f"{field} ({pairs})" if field and pairs else field
150
+ item = f"{located}: {message}" if field and message else message or located or pairs
144
151
  if line := _text(item, 200, secrets):
145
152
  lines.append(line)
146
153
  return lines
envloop/lifecycle_cli.py CHANGED
@@ -1,22 +1,69 @@
1
1
  """Project lifecycle commands nested under Console Settings."""
2
2
  import argparse
3
3
  import json
4
+ import sys
4
5
  from pathlib import Path
5
6
  from typing import Any
6
7
 
8
+ TIMEOUT_HELP = ('Seconds to wait (default 600); on timeout the command exits 1 with WAIT_TIMEOUT and prints the '
9
+ 'Operation, and cleanup continues on the server')
10
+ OPERATION_READ = ('Reading an Operation needs the Key permission Resource cleanup, under MANAGE (resources.read); without '
11
+ 'it the read returns ACCESS_DENIED (HTTP 403).')
12
+ OPERATION = ('An Operation is the persisted record of one cleanup request. el setting cleanup, el setting '
13
+ 'resource-scope cleanup, el job adapter delete and el checkpoint delete return one (operation_id), and '
14
+ 'a stopped Inference Job names its own in inference.cleanup_operation_id. Status is PENDING or RUNNING '
15
+ 'while cleanup works, RETRYING after a failure the server retries by itself, and SUCCEEDED when every '
16
+ 'resource is released; resources_deleted, retained and errors give the outcome per resource. '
17
+ 'FAILED, BLOCKED, RETRYABLE_FAILED, CANCELLED or SUCCEEDED with errors mean cleanup is incomplete: '
18
+ 'fix the named cause and run el setting operation retry OPERATION_ID. ' + OPERATION_READ)
19
+ DENIED_HINT = ('This Key cannot read cleanup Operations: it needs the Resource cleanup permission, under MANAGE '
20
+ '(resources.read). Without it, check the resource itself: el job get JOB_ID shows cleanup_confirmed, '
21
+ 'and el job adapter get ID returns 404 once the Adapter is deleted.')
22
+
7
23
 
8
24
  def wait_options(parser: argparse.ArgumentParser):
9
- parser.add_argument('--wait', action='store_true', help='Wait for the persisted cleanup Operation')
10
- parser.add_argument('--timeout-seconds', type=float, default=600)
25
+ parser.add_argument('--wait', action='store_true',
26
+ help='Then wait for the cleanup Operation to finish (see el setting operation wait --help). If '
27
+ 'this Key cannot read Operations, print the Operation and exit 0, since the request '
28
+ 'itself succeeded')
29
+ parser.add_argument('--timeout-seconds', type=float, default=600, help=TIMEOUT_HELP)
30
+
31
+
32
+ def wait_after_request(client: Any, result: Any, *, timeout: float, check: str) -> Any:
33
+ """``--wait`` after an accepted cleanup request (delete, cleanup, scope cleanup).
34
+
35
+ The request already succeeded. A Key may delete without being allowed to read Operations; a
36
+ denied read then reports the Operation and how to confirm the outcome instead of failing.
37
+ """
38
+ if not isinstance(result, dict) or result.get('status') == 'SUCCEEDED' and not result.get('errors'):
39
+ return result
40
+ from .http import RemoteError
41
+
42
+ try:
43
+ return client.operations.wait(result['operation_id'], timeout=timeout)
44
+ except RemoteError as error:
45
+ if error.status_code != 403:
46
+ raise
47
+ print(f"Cleanup accepted as Operation {result['operation_id']}, but this Key cannot read cleanup Operations "
48
+ f"(resources.read), so --wait stopped. {check}", file=sys.stderr)
49
+ return result
11
50
 
12
51
 
13
52
  def add_management_commands(settings: "argparse._SubParsersAction[argparse.ArgumentParser]"):
14
- operations = settings.add_parser('operation', help='Inspect or retry persisted cleanup').add_subparsers(dest='operation_action', required=True)
15
- for action in ('get', 'retry', 'wait'):
16
- command = operations.add_parser(action)
17
- command.add_argument('identifier', metavar='OPERATION_ID')
18
- if action == 'wait':
19
- command.add_argument('--timeout-seconds', type=float, default=600)
53
+ operations = settings.add_parser('operation', help='Inspect, wait for or retry a cleanup Operation',
54
+ description=OPERATION).add_subparsers(dest='operation_action', required=True)
55
+ get = operations.add_parser('get', help='Show a cleanup Operation once', description='Show the current state of a '
56
+ 'cleanup Operation without waiting. ' + OPERATION)
57
+ retry = operations.add_parser('retry', help='Retry an incomplete cleanup Operation', description=(
58
+ 'Start the remaining work of an incomplete cleanup Operation again; needs Resource cleanup edit '
59
+ 'permission, under MANAGE (resources.cleanup). ' + OPERATION))
60
+ wait = operations.add_parser('wait', help='Poll a cleanup Operation until it finishes', description=(
61
+ 'Read the Operation every 2 seconds until it finishes, then print it. Exit 0 when it is SUCCEEDED without '
62
+ 'errors, exit 1 with CLEANUP_INCOMPLETE when cleanup is incomplete, and exit 1 with WAIT_TIMEOUT after '
63
+ '--timeout-seconds (default 600) while cleanup continues on the server; run wait again later. ' + OPERATION))
64
+ for command in (get, retry, wait):
65
+ command.add_argument('identifier', metavar='OPERATION_ID', help='Operation ID (op_...)')
66
+ wait.add_argument('--timeout-seconds', type=float, default=600, help=TIMEOUT_HELP)
20
67
  cleanup = settings.add_parser('cleanup', help='Clean an explicit set of Project resource IDs')
21
68
  cleanup.add_argument('--file', type=Path, required=True,
22
69
  help='JSON array of {"kind": KIND, "id": ID} objects; KIND is job (a Train Job), endpoint, adapter '
@@ -40,8 +87,15 @@ def run_management(client: Any, args: argparse.Namespace):
40
87
  from .resources import _id
41
88
 
42
89
  if args.action == 'operation':
43
- return (client.operations.wait(args.identifier, timeout=args.timeout_seconds) if args.operation_action == 'wait'
44
- else getattr(client.operations, args.operation_action)(args.identifier))
90
+ from .http import RemoteError
91
+
92
+ try:
93
+ return (client.operations.wait(args.identifier, timeout=args.timeout_seconds) if args.operation_action == 'wait'
94
+ else getattr(client.operations, args.operation_action)(args.identifier))
95
+ except RemoteError as error:
96
+ if error.status_code == 403 and args.operation_action != 'retry' and not error.hint:
97
+ error.hint = DENIED_HINT
98
+ raise
45
99
  if args.action == 'resource-scope':
46
100
  if args.scope_action == 'create':
47
101
  client.temporary_resources(ttl_seconds=args.ttl_seconds)
@@ -52,6 +106,13 @@ def run_management(client: Any, args: argparse.Namespace):
52
106
  path = base + '/' + _id(args.identifier)
53
107
  result = (client._transport.request('POST', path + '/retain', {'resources': json.loads(args.file.read_text())})
54
108
  if args.scope_action == 'retain' else client._transport.request('DELETE' if args.scope_action == 'cleanup' else 'GET', path))
109
+ if args.scope_action != 'cleanup':
110
+ return result
111
+ check = f'Check with: el setting resource-scope get {args.identifier} (status CLEANED).'
55
112
  else:
56
113
  result = client.operations.cleanup(json.loads(args.file.read_text()), request_id=args.request_id)
57
- return client.operations.wait(result['operation_id'], timeout=args.timeout_seconds) if getattr(args, 'wait', False) else result
114
+ check = ('Check each resource: el job get JOB_ID (training.cleanup_confirmed true), el job adapter get ID '
115
+ '(404 = deleted), el checkpoint list (deleted Checkpoints are gone).')
116
+ if not getattr(args, 'wait', False):
117
+ return result
118
+ return wait_after_request(client, result, timeout=args.timeout_seconds, check=check)
@@ -32,8 +32,13 @@ def profile_payload(spec: Mapping[str, Any], secrets: Mapping[str, Any] | None =
32
32
  raise InvalidProfileSecrets()
33
33
  result = dict(spec)
34
34
  if secrets is not None:
35
- if (not isinstance(secrets, Mapping) or set(secrets) != {"model_api_key"}
36
- or not isinstance(secrets["model_api_key"], str)
35
+ if not isinstance(secrets, Mapping) or set(secrets) != {"model_api_key"}:
36
+ raise InvalidProfileSecrets()
37
+ if not _managed_model_connection(spec):
38
+ # The platform encrypts this key only for a managed params.model_connection and otherwise answers a bare
39
+ # INVALID_PROFILE. Other credentials are Secret parameters (`--secret MODEL_API_KEY=stdin`).
40
+ raise InvalidProfileSecrets("PROFILE_MODEL_KEY_UNSUPPORTED")
41
+ if (not isinstance(secrets["model_api_key"], str)
37
42
  or not secrets["model_api_key"].strip()
38
43
  or secrets["model_api_key"] != secrets["model_api_key"].strip()
39
44
  or secrets["model_api_key"] == "••••••••"
@@ -44,6 +49,12 @@ def profile_payload(spec: Mapping[str, Any], secrets: Mapping[str, Any] | None =
44
49
  return result
45
50
 
46
51
 
52
+ def _managed_model_connection(spec: Mapping[str, Any]) -> bool:
53
+ """Mirrors EnvPlatform profilePolicyView: v1 params or v2 spec.params; v3 Profiles have no model connection."""
54
+ params = _params(spec) if spec.get("schema_version") != "envloop.profile/v3" else None
55
+ return isinstance(params, Mapping) and isinstance(params.get("model_connection"), Mapping)
56
+
57
+
47
58
  def _params(spec: Mapping[str, Any]) -> Any:
48
59
  return spec.get("spec", {}).get("params") if spec.get("schema_version") == PROFILE_V2 else spec.get("params")
49
60
 
envloop/resource_cli.py CHANGED
@@ -1,10 +1,22 @@
1
1
  import argparse
2
2
  import sys
3
3
  from collections.abc import Sequence
4
+ from datetime import datetime, timedelta, timezone
4
5
  from typing import Any
5
6
 
6
7
  from .navigation_resources import billing_timestamp
7
8
 
9
+ USAGE_HELP = ('List recorded usage in a time window; without --start and --end, the last 7 days ending now (UTC). '
10
+ 'Example: el billing usage list --start 2026-11-01 --end 2026-11-05 --group-by day')
11
+ USAGE_DAYS = 7
12
+
13
+
14
+ def usage_window(start: str | None, end: str | None) -> tuple[str, str]:
15
+ """An omitted end is now (UTC, whole seconds); an omitted start is USAGE_DAYS before the end."""
16
+ end_at = datetime.fromisoformat(end) if end else datetime.now(timezone.utc).replace(microsecond=0)
17
+ start_at = datetime.fromisoformat(start) if start else end_at - timedelta(days=USAGE_DAYS)
18
+ return start_at.isoformat(), end_at.isoformat()
19
+
8
20
 
9
21
  def listing(commands: "argparse._SubParsersAction[argparse.ArgumentParser]", *, name: str = 'list', paged: bool = True, help: str = 'List visible resources') -> argparse.ArgumentParser:
10
22
  parser = commands.add_parser(name, help=help)
@@ -23,10 +35,13 @@ def add_resource_commands(groups: "argparse._SubParsersAction[argparse.ArgumentP
23
35
  billing = groups.add_parser('billing', help='Inspect Project billing and recorded usage').add_subparsers(dest='resource', required=True)
24
36
  for resource in ('account', 'usage', 'ledger', 'price'):
25
37
  commands = billing.add_parser(resource, help=f'Inspect billing {resource}').add_subparsers(dest='action', required=True)
26
- command = commands.add_parser('get', help='Show the billing account') if resource == 'account' else listing(commands, paged=False)
38
+ command = (commands.add_parser('get', help='Show the billing account') if resource == 'account'
39
+ else listing(commands, paged=False, help=USAGE_HELP) if resource == 'usage' else listing(commands, paged=False))
27
40
  if resource == 'usage':
28
- command.add_argument('--start', required=True, type=billing_timestamp, help='Start: YYYY-MM-DD (UTC) or ISO timestamp with timezone')
29
- command.add_argument('--end', required=True, type=billing_timestamp, help='Exclusive end: YYYY-MM-DD (UTC) or ISO timestamp with timezone')
41
+ command.add_argument('--start', type=billing_timestamp,
42
+ help='Start: YYYY-MM-DD (UTC) or ISO timestamp with timezone (default: 7 days before the end)')
43
+ command.add_argument('--end', type=billing_timestamp,
44
+ help='Exclusive end: YYYY-MM-DD (UTC) or ISO timestamp with timezone (default: now, UTC)')
30
45
  command.add_argument('--group-by', choices=['day', 'product', 'endpoint', 'sku'])
31
46
  if resource == 'ledger':
32
47
  command.add_argument('--limit', type=int, default=25)
@@ -194,7 +209,8 @@ def execute(args: argparse.Namespace, client: Any) -> Any:
194
209
  return client.dashboard.get()
195
210
  if group == 'billing':
196
211
  if args.resource == 'usage':
197
- return client.billing.usage(start=args.start, end=args.end, group_by=args.group_by)
212
+ start, end = usage_window(args.start, args.end)
213
+ return client.billing.usage(start=start, end=end, group_by=args.group_by)
198
214
  if args.resource == 'ledger':
199
215
  return client.billing.ledger(limit=args.limit)
200
216
  return getattr(client.billing, {'account': 'account', 'price': 'prices'}[args.resource])()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: envloop-cli
3
- Version: 1.30.0
3
+ Version: 1.32.0
4
4
  Summary: EnvLoop CLI and Python SDK for jobs, training, checkpoints and inference
5
5
  Project-URL: Homepage, https://envloop.ai
6
6
  Project-URL: Documentation, https://docs.envloop.ai
@@ -160,6 +160,20 @@ cleaning up temporary resources.
160
160
 
161
161
  ## Sandbox jobs
162
162
 
163
+ After `el auth login`, you may reuse an existing EnvPlatform Profile as an
164
+ optional preset. It uses the current login and project permissions. Submit its
165
+ published name and optional ANS input bindings or declared parameters:
166
+
167
+ ```bash
168
+ el job submit --type sandbox --profile team/report@1 --input report=ARTIFACT_URI --params Mode=Summary --max-cost-usd 3
169
+ ```
170
+
171
+ The platform resolves and freezes the Runner and inputs, and manages any model
172
+ service declared by the Profile. No local script, Dataset Task wrapper or Runner
173
+ argument is required. Use a published Artifact URI in place of `ARTIFACT_URI`.
174
+ `--profile` and `--spec` are mutually exclusive. Named Profile parameter names
175
+ retain their case and duplicates are rejected.
176
+
163
177
  With a matching platform and a published `envloop/base` ANS Runner, submit a
164
178
  Sandbox Job without a Dataset:
165
179
 
@@ -277,9 +291,9 @@ Availability requires matching platform support and approved content in your pro
277
291
 
278
292
  ## ANS data and verified downloads
279
293
 
280
- `client.data.download_directory(uri, destination)` and `el data download URI --output ./content`
294
+ `client.data.download_directory(uri, destination)` and `el data download DATA_ID|URI --output ./content`
281
295
  download a complete registered ANS object directory through EnvHub. Datasets require
282
- `split="lite"` / `--split lite`; the Dataset version and filenames are preserved. After API
296
+ `split="lite"` / `--split lite` (the error lists the declared splits); the Dataset version and filenames are preserved. After API
283
297
  authorization the SDK uses GET URLs valid for up to five minutes, verifies file size/SHA-256,
284
298
  and installs the directory atomically. Matching platform support is required.
285
299
 
@@ -291,7 +305,7 @@ el data get DATA_ID --json
291
305
  el data download DATA_ID --file FILE_ID --output ./dataset.tgz --resume --json
292
306
  ```
293
307
 
294
- Unified ANS CRUD supports Dataset, Runner, Recipe and HF model Checkpoint registrations through `el data` and `client.data`. Dataset/Runner/Recipe creation requires a native immutable `--ref`, `--manifest` and exact `--directory`. HF metadata registration uses `el data create --type checkpoint --model namespace/model --revision FULL_COMMIT`; SDK uses `create(kind="checkpoint", model=..., revision=...)`. HF weights are not downloaded, and artifact imports do not establish Model or Job checkpoint provenance.
308
+ Unified ANS CRUD supports Dataset, Runner, Recipe and HF model Checkpoint registrations through `el data` and `client.data`. Dataset/Runner/Recipe creation requires a native `--manifest` and exact `--directory`. For Dataset create/update/upload, `--ref` (SDK `ref`) is optional when `dataset.namespace`, `dataset.name` and `dataset.version` are present in the manifest; EnvHub derives the immutable Dataset URI. Other resource types and manifests without that identity still require an explicit ref. Explicit refs remain supported; the platform validates their consistency with the manifest. HF metadata registration uses `el data create --type checkpoint --model namespace/model --revision FULL_COMMIT`; SDK uses `create(kind="checkpoint", model=..., revision=...)`. HF weights are not downloaded, and artifact imports do not establish Model or Job checkpoint provenance. While native publication runs, `create`/`update` repeat the same idempotent request until ready (`--timeout`, default 3600 s); `--no-wait` / `wait=False` returns the pending `publishing` resource with resume instructions.
295
309
 
296
310
  `el runner register DIRECTORY --revision FULL_COMMIT [--source-ref main]` publishes a Runner package directory through the same Data API with the manifest built for you, then reads the catalog revision back. `el profile create|update|fork ... --secret NAME[=prompt|stdin|env:VAR|file:PATH]` stores write-only Secret parameters whose names follow the platform's credential rule or `secret_params`; values never come from the command line. `el setting model-access grant NAMESPACE/NAME --protocol anthropic [--revision FULL_COMMIT]` (project Admin) lets a published Runner receive the project's metered model key on Fly Trials; `list` and `revoke GRANT_ID` manage grants.
297
311
 
@@ -1,56 +1,57 @@
1
1
  envloop/__init__.py,sha256=tX06Gh2EmufRr0J_3YKtjDeNrJ30auR3y3BJ3N3FHJY,421
2
- envloop/_optional.py,sha256=d2Ebq9g0JTKjiq3fuGobG4XjXc6MCogZ5X7uXQDaqak,8981
2
+ envloop/_optional.py,sha256=rUHif94oqjneTHElsdRmzI58-v3TE80wSgrFXrkuhgU,9017
3
3
  envloop/auth_cli.py,sha256=Yjwy1eLyrKfGPOA2vx6q5ZyMyrCNuUh5Xkn7d9-4IvM,15681
4
4
  envloop/auth_login.py,sha256=uOqPHqgzi0Y5eDMiZJH-EI_HxY55F9bRr8CoBb8OHfk,7231
5
5
  envloop/auth_workspace.py,sha256=g92Dok4eSp6P-Du5qkwzZG4JDeSrdYTXJbn5WCzCFMo,14927
6
6
  envloop/cli.py,sha256=Vafivql1JBrlIrfJOD-XAw6AevQKIasmvDHmcazIzqo,15010
7
- envloop/cli_errors.py,sha256=tPqZFFjW-XMvIq4Vxzbn1D5LbIM6BMHKRkl4nKleeS8,31622
7
+ envloop/cli_errors.py,sha256=0bhA_1tJf3hXmqe0IZ8xguBzpVwPS1T4sdv4-uFVTjs,33353
8
8
  envloop/cli_output.py,sha256=UkcEMqxpzMUSYaxTQMJR1WQ8nqsoq-piPNyPrCMR5dQ,6025
9
- envloop/client.py,sha256=TdTUhHwtK0FL6xzIz4moaNdIPlC-TkisPvU4zNPnaTA,3270
9
+ envloop/client.py,sha256=OspRBxuKaJuQOomeYorrxWIrjlda-ROOZ58IqEF-Qks,3280
10
10
  envloop/config.py,sha256=1Wr2lNdNNZzsQDPNGsk-TsnEUvDqOtocy9TgUpmOZO0,22494
11
11
  envloop/downloads.py,sha256=ktL-hz9HWPGNuQX_N5RmLyt16qbooArljW9z80XYmTo,3253
12
- envloop/http.py,sha256=2mu5yIgQDESC0y2LvdE53d7fPfSzT0oXVjlY25qwGkY,16479
13
- envloop/lifecycle_cli.py,sha256=AiiNK7fueIw2Y5HP-OcIKMDUjIXZrUZiFASHfRNkk5Q,3349
12
+ envloop/http.py,sha256=sNUawBH_C0m0j028ZWekDPiJMsSQVq1-0QfhpTrP-fI,16925
13
+ envloop/lifecycle_cli.py,sha256=mTvu9ffXhO2HeIEI_yy-CvZSurDPiVjX_vfLYirZLA8,7618
14
14
  envloop/navigation_resources.py,sha256=3PeZiYtXHXPMwuCLRdw1mUnZDTDJUYthUhsiJkHtI_g,10378
15
- envloop/profile_secrets.py,sha256=5QpHRV_Gy1MxObR62SX4nNblqk7gWqQZNtzy6wZNV0s,6325
16
- envloop/resource_cli.py,sha256=JUMpptd3VvCas0D3cdS5p8_iHVCkiaiIqqGLeFdCnws,13371
15
+ envloop/profile_secrets.py,sha256=MgJbzoqW1byKqFja-3Cw2HvlIHLHwprJ5RyTHofKMB4,7071
16
+ envloop/resource_cli.py,sha256=HhoTcHiqJzvEJk7BH_FJ2vr2zS-DgIyk6xLQz3s1aQ8,14315
17
17
  envloop/resources.py,sha256=V5nDuM8QgE52V9slSj2ywmhZqwgMKFosm4o5naFaEJo,3025
18
18
  envloop/terminal.py,sha256=AtScg4nUo6wMQO7LNCnypUV9wWB62baBXO7YGpA3jV8,2771
19
19
  envloop/utils/__init__.py,sha256=huB3qPQuKNr3JxfH3Ys09YWFtHiDamCHFsBa4epANgQ,25
20
20
  envloop/utils/logging.py,sha256=rXN0qyxhfGEq4vWXxjwfaczPPZf_7atnOkkBTgNNRPc,1017
21
21
  envloop_data/__init__.py,sha256=nKDGmzFNAQv2mq16YijiI3Q-gDL_smNyZD-AQaqoz7Y,68
22
- envloop_data/cli.py,sha256=5J_pS5jf65gyaRpE2EV4jDfDUZ1oEsK0iHAmhJlk-oU,9023
22
+ envloop_data/cli.py,sha256=DzeVmDmcIyWkTk9sK44Nzrb2F6vauLFLixaZbBIbOqk,10350
23
23
  envloop_data/cli_output.py,sha256=3ZuAXJiXs1wVxIthHMpRgn-VVC4PatSUAWZDCgldrhQ,4414
24
- envloop_data/client.py,sha256=M1NxvQiiNWq3CByW7AehEOfpkfBrC7ysSDAPkeccCaA,12515
25
- envloop_data/data.py,sha256=VWmdQbOlXOaQZdPqcTQLk0Di0HeMSLARxAfntwh2RWo,27610
26
- envloop_data/data_cli.py,sha256=NtJ-Bpw2fnSOCWy3bsgdUMLKUc8z1wrB1NqiOvHMsSw,13623
27
- envloop_data/data_publications.py,sha256=_Z64X9CCHz1c2AhtcbRIQuROiJ2jTLw6dA3nn1PyHek,6885
28
- envloop_data/data_upload.py,sha256=b9hf-MwWHtrZW-9U9WyxJxX89SRsEHXCPcSQIy6SVMM,14270
29
- envloop_data/http.py,sha256=adbMFCUsS1YYanzdCoqM4HIgIOxjgXoHKOkxSwUuvW4,6726
24
+ envloop_data/client.py,sha256=BrmpwYmZU7am02HW2eGnDX20IVF25yuB5HxDwunZ0eY,14895
25
+ envloop_data/data.py,sha256=zwKkAHBWf9ciM16ZqnNSLiaQIAl6q3TcGYIb0L7DxwE,36934
26
+ envloop_data/data_cli.py,sha256=CCCWaDbyUS9Ph-G4kTXzL1NG2bgezikrtYBTSkzYodk,18731
27
+ envloop_data/data_publications.py,sha256=1sF6ySP9CSdcB0X2p7Plgv8KZnYQb7PaEpgVmGVwiUk,8801
28
+ envloop_data/data_upload.py,sha256=bosFfJnjXr1lkWNCCYYiaiMU-IxF_aUwBTnBaq1TpPo,15048
29
+ envloop_data/http.py,sha256=I3RiRMk90tbUO3GKmgbzTC7mBVLVabvDqNmoeArsGLk,7713
30
30
  envloop_data/navigation_resources.py,sha256=V3JtSXYqXk1e0ke1nEdBHcZtUHNqHu9mJd4BfN9y4zg,12553
31
- envloop_data/profile_updates.py,sha256=FB3Huf0AIlqg6CUC0TcrEeWCF5GH1Z6iJN5Wkq8KcYg,3126
32
- envloop_data/recipes.py,sha256=JH0bvM0LCH_iN4p4ONfTSF53eSHAVLUQNFLueOx07UA,1301
33
- envloop_data/resource_cli.py,sha256=E1CW0Toe_uw07WEV2B6ZkbUWc4w7Md5Hv7bboUGGxZI,7230
31
+ envloop_data/profile_updates.py,sha256=3NB2wtMtA7tmYXQavhZWKUUQCm1QUxnJLPLTq3Z0UZk,3315
32
+ envloop_data/recipes.py,sha256=wuZxC9TOQzmfY-_ZGCpOnA2JkQF3XtT1yk_6ZmH2qdA,1430
33
+ envloop_data/resource_cli.py,sha256=2dgF_2kdU67lSqmy6ECP1ZI4n7cMbn54F-QYaohWWnM,7431
34
34
  envloop_data/runner_packages.py,sha256=Xi50hZbdoew9DJ8iYQevMo2jv3qgR3iT50wtV04rFfQ,3424
35
35
  envloop_experiment/__init__.py,sha256=nKDGmzFNAQv2mq16YijiI3Q-gDL_smNyZD-AQaqoz7Y,68
36
- envloop_experiment/cli.py,sha256=Tc1irMierk-_6Yl8cyJc_xVPelE21X7bjacK8fDaJlM,31119
36
+ envloop_experiment/cli.py,sha256=lKr-YFAw5qcXAauLbXIYRQGal0TVIZrzEGWpOyW_gCU,33712
37
37
  envloop_experiment/cli_output.py,sha256=-FojsqOMIIQuOnfhk2AaqMtwUz5skoWvLeNASm8An6Y,2689
38
- envloop_experiment/client.py,sha256=VKKqI9IDazxaN7-coP48DvXcz6SqjZ8ScM4O6plBNWI,25122
38
+ envloop_experiment/client.py,sha256=OZlUE8Sr_qO0c_isA7S3golf0_Ifmp3GNxsNFsOPYaw,26899
39
39
  envloop_experiment/decision.py,sha256=HJTj-jSJJ5kcxQQzFXwrA9IICWXA6zSNBFL9EbbrxqI,918
40
40
  envloop_experiment/http.py,sha256=A_PHWVr7PV4eiP30lXmOITiljXf6GEIYGkJlr1KFz-Q,6110
41
- envloop_experiment/inference.py,sha256=74MZDs0lqqqNwgdvj58rs-D3emDj4iHv1W-copc5PYA,2134
41
+ envloop_experiment/inference.py,sha256=ctqghSXBBa8d6RFYosaeF4mcurVP32-j44v3kOwQiAI,4723
42
42
  envloop_experiment/job_cost.py,sha256=gZB69-pdsJM4wManw44AIS9T3ZtsxxQTqrJs-cHjwJU,2214
43
43
  envloop_experiment/job_logs.py,sha256=RLipbj89e5hQdBeXtszsxSYYw7By1hscwSTGFQzQ3Qw,1340
44
- envloop_experiment/job_spec_cli.py,sha256=qyt0hZMAVqOCoRSzEuO2mQ8f8ro5cLiY5eRdAWGQbOM,9753
44
+ envloop_experiment/job_spec_cli.py,sha256=IaQigLNpJQn5cvlEsn77lUVKoJK6JGBarztLV0mNn04,9998
45
+ envloop_experiment/named_profile.py,sha256=WPEeRE6sH1-ySGGEsMUg_1QAbfg1IIqCr8PhH6PgGsM,3074
45
46
  envloop_experiment/navigation_resources.py,sha256=xoI4VFmd0dzviKvzndwKAoWdfbaL_f50cnXRxPkfoo4,1832
46
- envloop_experiment/resource_cli.py,sha256=MCFWHl4iCNe1UiGyHcvMM67LOHQ7MZl3joFtftQwqLk,2083
47
+ envloop_experiment/resource_cli.py,sha256=A2QSQFVdbLAvjNcOotMiZdPjin07ZDM25jq9lJ6DZpE,2253
47
48
  envloop_experiment/resources.py,sha256=4guXzssv7XhYkn8ESH-79DIMWUyKDIg70uOa-KoNvp0,7236
48
- envloop_experiment/runtime_params.py,sha256=ITF6hDuhfdChnWo3e8NW27WxEoNoCuOTww-Hz60zqQU,3608
49
+ envloop_experiment/runtime_params.py,sha256=MBPGrDO5x_X_BM9K_LA8L-J4fNlt5FCZbNZJa9h4M8c,3728
49
50
  envloop_experiment/sandbox.py,sha256=sTpAWbcs2jAPfb7gILK4MTJSmcpSeZG3anFkLA5TgdQ,1274
50
- envloop_experiment/train.py,sha256=S0nkTjfbXJnDL1uxPeOIcfHF3Zxc3jqO6O2_UcNjcr0,5472
51
+ envloop_experiment/train.py,sha256=AbiDIKQlyjt2KwEuetMnrsUEEAl2By2-Ztqyw2oN0RY,5787
51
52
  envloop_experiment/train_log_cli.py,sha256=jCu7c0DGzy0La8tigJVDjuQHROaw6kfclU64QYsRVj0,6622
52
53
  envloop_experiment/train_metrics_cli.py,sha256=AXq5UPf_Xa4RCxAwZNvz8VZKghN1k3dhxbAXXxMmLlY,6522
53
- envloop_experiment/train_progress.py,sha256=XrF6g1XNtGReuIfFdfXTvD4XwvS-bDcFZNHzTCCfYa0,2546
54
+ envloop_experiment/train_progress.py,sha256=9YO6CkTc7-LCpUpY8juf6GPF58kCU2rxc4iZjPoRQ58,3508
54
55
  envloop_experiment/train_runner_cli.py,sha256=OiHv7Dp2VPoQVmFR0vgJoAd5Ni0uQvtCyNf5Lk4AFfc,3154
55
56
  envloop_experiment/training/__init__.py,sha256=IEQWbCHe-zZ2e7JQxOrFOdYlSQxMfOceCZUf_KeszBk,221
56
57
  envloop_rsi_loop/__init__.py,sha256=nKDGmzFNAQv2mq16YijiI3Q-gDL_smNyZD-AQaqoz7Y,68
@@ -58,7 +59,7 @@ envloop_rsi_loop/agent_runs.py,sha256=GrXSfnQ8MchA9i8UI3LWJiTninpI0PeTm0hgz2TJ0N
58
59
  envloop_rsi_loop/cli.py,sha256=Kqearg20Mvfyj62r2mibVdWEMo1NHjthgvS-Tl7SC-A,3047
59
60
  envloop_rsi_loop/cli_output.py,sha256=GxM4UiL4NzzSyjRrikai6ROW-1WPjFtwrIfpnE8GZ4U,3173
60
61
  envloop_rsi_loop/rsi_cli.py,sha256=e9XHeIPwMz1dZ6NhK3UIETCdy7LbIWgFosF1FnKVUQk,2580
61
- envloop_cli-1.30.0.dist-info/METADATA,sha256=ku-cMRnCnhzCW4sa4kW-wFyyhH__GtXzdUI6qTEHe7A,15810
62
- envloop_cli-1.30.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
63
- envloop_cli-1.30.0.dist-info/entry_points.txt,sha256=8aXOpgtVk4GndhChA4XNecShkb1w0xGHBHrKla78ofI,67
64
- envloop_cli-1.30.0.dist-info/RECORD,,
62
+ envloop_cli-1.32.0.dist-info/METADATA,sha256=6WikBRVVeh4brj-skuUDbsWHCdP-D_ZleWO6Wmy1nTw,17164
63
+ envloop_cli-1.32.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
64
+ envloop_cli-1.32.0.dist-info/entry_points.txt,sha256=8aXOpgtVk4GndhChA4XNecShkb1w0xGHBHrKla78ofI,67
65
+ envloop_cli-1.32.0.dist-info/RECORD,,
envloop_data/cli.py CHANGED
@@ -105,6 +105,15 @@ def add_commands(groups: "argparse._SubParsersAction[argparse.ArgumentParser]")
105
105
  fork.add_argument('name', metavar='NAME')
106
106
  fork.add_argument('version', metavar='VERSION')
107
107
  secret_option(fork)
108
+ for item in (put, update, fork):
109
+ item.add_argument('--visibility', choices=('private', 'public'),
110
+ help='Visibility metadata; fork defaults to private. Public requires reviewed public dependencies')
111
+ visibility = profiles.add_parser('set-visibility', help='Change visibility with an ACL revision check')
112
+ visibility.add_argument('name', metavar='NAME')
113
+ visibility.add_argument('version', metavar='VERSION')
114
+ visibility.add_argument('--visibility', choices=('private', 'public'), required=True)
115
+ visibility.add_argument('--expected-visibility', choices=('private', 'public'), required=True)
116
+ visibility.add_argument('--expected-acl-revision', type=int, required=True)
108
117
  get = profiles.add_parser("get")
109
118
  get.add_argument("name", metavar="NAME")
110
119
  get.add_argument("--version")
@@ -113,6 +122,7 @@ def add_commands(groups: "argparse._SubParsersAction[argparse.ArgumentParser]")
113
122
  listing.add_argument("--include-archived", action="store_true")
114
123
  listing.add_argument("--limit", type=int, default=50)
115
124
  listing.add_argument("--cursor")
125
+ listing.add_argument('--visibility', choices=('all','private','public'))
116
126
  listing.add_argument("--json", action="store_true", help="Output the complete response as JSON (default: table)")
117
127
  default = profiles.add_parser("set-default")
118
128
  default.add_argument("name", metavar="NAME")
@@ -127,6 +137,7 @@ def add_commands(groups: "argparse._SubParsersAction[argparse.ArgumentParser]")
127
137
 
128
138
  def execute_profile(args: argparse.Namespace, client: Any, cli: Any) -> Any:
129
139
  from envloop._optional import CommandExit
140
+ visibility_options: dict[str, Any] = {} if getattr(args, 'visibility', None) is None else {'visibility': args.visibility}
130
141
  if args.action in {"create", "update"}:
131
142
  from envloop_data.profile_updates import read_profile_patch, with_runner
132
143
 
@@ -143,14 +154,17 @@ def execute_profile(args: argparse.Namespace, client: Any, cli: Any) -> Any:
143
154
  secrets = {"model_api_key": sys.stdin.readline(4098).rstrip("\r\n")}
144
155
  if args.action == "update":
145
156
  result = client.profiles.update(args.name, args.version,
146
- patch=patch, from_version=args.from_version, secrets=secrets, secret_values=values)
157
+ patch=patch, from_version=args.from_version, secrets=secrets, secret_values=values, **visibility_options)
147
158
  else:
148
159
  result = client.profiles.import_spec(
149
- raw, name=args.name, version=args.version, secrets=secrets, runner=args.runner, secret_values=values
160
+ raw, name=args.name, version=args.version, secrets=secrets, runner=args.runner, secret_values=values, **visibility_options
150
161
  )
151
162
  elif args.action == 'fork':
152
163
  result = client.profiles.fork(args.source_name, args.source_version, name=args.name, version=args.version,
153
- secret_values=read_secret_values(args))
164
+ secret_values=read_secret_values(args), **visibility_options)
165
+ elif args.action == 'set-visibility':
166
+ result = client.profiles.set_visibility(args.name, args.version, visibility=args.visibility,
167
+ expected_visibility=args.expected_visibility, expected_acl_revision=args.expected_acl_revision)
154
168
  elif args.action == "get":
155
169
  result = client.profiles.get(args.name, args.version)
156
170
  elif args.action == "list":
@@ -159,6 +173,7 @@ def execute_profile(args: argparse.Namespace, client: Any, cli: Any) -> Any:
159
173
  include_archived=args.include_archived,
160
174
  limit=args.limit,
161
175
  cursor=args.cursor,
176
+ **({} if args.visibility is None else {'visibility': args.visibility}),
162
177
  )
163
178
  elif args.action == "set-default":
164
179
  result = client.profiles.set_default(