evalrouter 0.3.2__tar.gz → 0.3.3__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.
- {evalrouter-0.3.2 → evalrouter-0.3.3}/PKG-INFO +3 -1
- {evalrouter-0.3.2 → evalrouter-0.3.3}/README.md +2 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/pyproject.toml +1 -1
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/evalrouter_contracts/__init__.py +1 -1
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/__init__.py +1 -1
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/_account.py +87 -12
- {evalrouter-0.3.2 → evalrouter-0.3.3}/LICENSE +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/evalrouter_contracts/bundle.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/evalrouter_contracts/components.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/evalrouter_contracts/models.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/evalrouter_contracts/protocol.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/evalrouter_contracts/py.typed +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/evalrouter_contracts/templates.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/evalrouter_contracts/validation.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/__main__.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/_boundary.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/_guided.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/_helpers.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/_listing.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/_resources.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/_transport.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/cli.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/py.typed +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/render/__init__.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/render/_console.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/render/_theme.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/render/_widgets.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/render/live.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/render/picker.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/render/screens.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/render/tables.py +0 -0
- {evalrouter-0.3.2 → evalrouter-0.3.3}/src/kimpton_evalrouter/types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: evalrouter
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Typed Kimpton evaluation client and command-line interface
|
|
5
5
|
License-Expression: LicenseRef-Kimpton-EvalRouter-SDK
|
|
6
6
|
License-File: LICENSE
|
|
@@ -275,3 +275,5 @@ Replace the coverage placeholder with the entire returned object; do not guess
|
|
|
275
275
|
tasks, counts or seeds. Use the existing `quote`, `run`, `wait`, `results` and
|
|
276
276
|
`export` commands above. Qualification and evaluation have separate caps and
|
|
277
277
|
charges. A qualification pass does not submit an evaluation automatically.
|
|
278
|
+
|
|
279
|
+
After confirming the terminal code, sign in if asked and keep the browser open until your device is connected. If the browser says the code is invalid, press Enter in the waiting terminal for a fresh code (or restart evalrouter login). Your account and workspace are preserved.
|
|
@@ -260,3 +260,5 @@ Replace the coverage placeholder with the entire returned object; do not guess
|
|
|
260
260
|
tasks, counts or seeds. Use the existing `quote`, `run`, `wait`, `results` and
|
|
261
261
|
`export` commands above. Qualification and evaluation have separate caps and
|
|
262
262
|
charges. A qualification pass does not submit an evaluation automatically.
|
|
263
|
+
|
|
264
|
+
After confirming the terminal code, sign in if asked and keep the browser open until your device is connected. If the browser says the code is invalid, press Enter in the waiting terminal for a fresh code (or restart evalrouter login). Your account and workspace are preserved.
|
|
@@ -27,6 +27,7 @@ import getpass
|
|
|
27
27
|
import json
|
|
28
28
|
import os
|
|
29
29
|
import re
|
|
30
|
+
import select
|
|
30
31
|
import socket
|
|
31
32
|
import stat
|
|
32
33
|
import sys
|
|
@@ -604,6 +605,47 @@ def _tokens(value, now: float) -> dict:
|
|
|
604
605
|
}
|
|
605
606
|
|
|
606
607
|
|
|
608
|
+
class _RestartDeviceLogin(Exception):
|
|
609
|
+
"""The customer requested a new code; the pending request is abandoned."""
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
def _wait_for_login_restart(delay: float | None) -> bool:
|
|
613
|
+
"""Wait for Enter without a reader thread that could outlive login.
|
|
614
|
+
|
|
615
|
+
Called only with interactive stdin/stderr, never for pipes or --json.
|
|
616
|
+
A timeout preserves OAuth polling cadence; EOF cannot trigger a retry loop.
|
|
617
|
+
"""
|
|
618
|
+
if sys.platform == "win32":
|
|
619
|
+
import msvcrt
|
|
620
|
+
|
|
621
|
+
deadline = time.monotonic() + delay if delay is not None else None
|
|
622
|
+
while deadline is None or time.monotonic() < deadline:
|
|
623
|
+
if msvcrt.kbhit():
|
|
624
|
+
key = msvcrt.getwch()
|
|
625
|
+
if key in ("\r", "\n"):
|
|
626
|
+
return True
|
|
627
|
+
if key == "\x03":
|
|
628
|
+
raise KeyboardInterrupt
|
|
629
|
+
if key in ("\x00", "\xe0"):
|
|
630
|
+
msvcrt.getwch() # extended key, not an Enter request
|
|
631
|
+
remaining = max(0, deadline - time.monotonic()) if deadline is not None else 0.1
|
|
632
|
+
time.sleep(min(0.1, remaining))
|
|
633
|
+
return False
|
|
634
|
+
started = time.monotonic()
|
|
635
|
+
try:
|
|
636
|
+
ready, _, _ = select.select([sys.stdin], [], [], delay)
|
|
637
|
+
if not ready:
|
|
638
|
+
return False
|
|
639
|
+
if sys.stdin.readline():
|
|
640
|
+
return True
|
|
641
|
+
except (OSError, ValueError):
|
|
642
|
+
pass
|
|
643
|
+
# Closed/unsupported input must not shorten the provider's polling interval.
|
|
644
|
+
if delay is not None:
|
|
645
|
+
time.sleep(max(0, delay - (time.monotonic() - started)))
|
|
646
|
+
return False
|
|
647
|
+
|
|
648
|
+
|
|
607
649
|
def poll_for_tokens(
|
|
608
650
|
http: httpx.Client,
|
|
609
651
|
config: dict,
|
|
@@ -612,6 +654,7 @@ def poll_for_tokens(
|
|
|
612
654
|
sleep=time.sleep,
|
|
613
655
|
clock=time.monotonic,
|
|
614
656
|
wall=time.time,
|
|
657
|
+
wait_for_restart=None,
|
|
615
658
|
) -> dict:
|
|
616
659
|
"""Poll the token endpoint per RFC 8628, honoring slow_down and expiry."""
|
|
617
660
|
interval = device.get("interval")
|
|
@@ -620,7 +663,10 @@ def poll_for_tokens(
|
|
|
620
663
|
lifetime = float(lifetime) if isinstance(lifetime, (int, float)) and lifetime > 0 else 300
|
|
621
664
|
deadline = clock() + lifetime
|
|
622
665
|
while True:
|
|
623
|
-
|
|
666
|
+
if wait_for_restart is None:
|
|
667
|
+
sleep(interval)
|
|
668
|
+
elif wait_for_restart(interval):
|
|
669
|
+
raise _RestartDeviceLogin
|
|
624
670
|
if clock() >= deadline:
|
|
625
671
|
raise ClientError(
|
|
626
672
|
"login_expired", "The sign-in code expired. Run `evalrouter login` again."
|
|
@@ -1156,17 +1202,46 @@ def login(
|
|
|
1156
1202
|
)
|
|
1157
1203
|
store.update_server(base, login_advertised=True)
|
|
1158
1204
|
config = auth0_config(base, advertisement)
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1205
|
+
interactive = _interactive() and not getattr(args, "json", False)
|
|
1206
|
+
while True:
|
|
1207
|
+
device = start_device_authorization(http, config)
|
|
1208
|
+
target = connect_target(base, device)
|
|
1209
|
+
notice("Open this link to sign in or create an account:")
|
|
1210
|
+
notice(target)
|
|
1211
|
+
notice(f"Your terminal code: {device['user_code']}")
|
|
1212
|
+
notice(f"Approval continues at {urlsplit(config['issuer']).netloc}:")
|
|
1213
|
+
notice(" 1. Confirm your terminal code.")
|
|
1214
|
+
notice(" 2. Sign in if asked, even if the website already recognizes you.")
|
|
1215
|
+
notice(" 3. Keep the tab open until it says Device connected.")
|
|
1216
|
+
notice("Confirming the code alone does not finish sign-in.")
|
|
1217
|
+
if not getattr(args, "no_browser", False) and _interactive():
|
|
1218
|
+
with contextlib.suppress(Exception):
|
|
1219
|
+
if open_browser(target):
|
|
1220
|
+
notice("Opened your browser. Finish connecting there.")
|
|
1221
|
+
notice("Waiting for browser approval...")
|
|
1222
|
+
if interactive:
|
|
1223
|
+
notice("Closed the tab or see an invalid code? Press Enter for a new code.")
|
|
1224
|
+
notice("Press Ctrl+C to cancel.")
|
|
1225
|
+
else:
|
|
1226
|
+
notice("Invalid or expired code? Restart `evalrouter login` for a new link.")
|
|
1227
|
+
try:
|
|
1228
|
+
tokens = poll_for_tokens(
|
|
1229
|
+
http, config, device, sleep=sleep,
|
|
1230
|
+
wait_for_restart=_wait_for_login_restart if interactive else None,
|
|
1231
|
+
)
|
|
1232
|
+
break
|
|
1233
|
+
except _RestartDeviceLogin:
|
|
1234
|
+
notice("Starting a new request. Close the earlier tab and use the new link.")
|
|
1235
|
+
except ClientError as error:
|
|
1236
|
+
if error.code != "login_expired" or not interactive:
|
|
1237
|
+
raise
|
|
1238
|
+
notice("This code expired. Press Enter for a new code, or Ctrl+C to cancel.")
|
|
1239
|
+
if not _wait_for_login_restart(None):
|
|
1240
|
+
raise
|
|
1241
|
+
except KeyboardInterrupt:
|
|
1242
|
+
raise ClientError(
|
|
1243
|
+
"login_cancelled", "Sign-in cancelled. You can close the browser tab."
|
|
1244
|
+
) from None
|
|
1170
1245
|
finally:
|
|
1171
1246
|
if owned:
|
|
1172
1247
|
http.close()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|