chalkpy 2.98.1__py3-none-any.whl → 2.98.2__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.
- chalk/_version.py +1 -1
- chalk/client/client_impl.py +38 -67
- chalk/client/models.py +0 -2
- {chalkpy-2.98.1.dist-info → chalkpy-2.98.2.dist-info}/METADATA +1 -1
- {chalkpy-2.98.1.dist-info → chalkpy-2.98.2.dist-info}/RECORD +8 -8
- {chalkpy-2.98.1.dist-info → chalkpy-2.98.2.dist-info}/WHEEL +0 -0
- {chalkpy-2.98.1.dist-info → chalkpy-2.98.2.dist-info}/entry_points.txt +0 -0
- {chalkpy-2.98.1.dist-info → chalkpy-2.98.2.dist-info}/top_level.txt +0 -0
chalk/_version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2.98.
|
|
1
|
+
__version__ = "2.98.2"
|
chalk/client/client_impl.py
CHANGED
|
@@ -1033,10 +1033,6 @@ class ChalkAPIClientImpl(ChalkClient):
|
|
|
1033
1033
|
self._branch: str | None = branch
|
|
1034
1034
|
self._skip_token_cache: bool = _skip_cache
|
|
1035
1035
|
self._api_server: str | None = api_server
|
|
1036
|
-
self._env_id_to_engine_url_map: Mapping[str, str] | None = None
|
|
1037
|
-
self._env_id_to_env_name_map: Mapping[str, str] | None = None
|
|
1038
|
-
self._env_name_to_env_id_map: Mapping[str, str] | None = None
|
|
1039
|
-
self._access_token: str | None = None
|
|
1040
1036
|
|
|
1041
1037
|
self._default_headers = {
|
|
1042
1038
|
"Accept": "application/json",
|
|
@@ -1047,7 +1043,7 @@ class ChalkAPIClientImpl(ChalkClient):
|
|
|
1047
1043
|
if additional_headers:
|
|
1048
1044
|
self._default_headers.update(additional_headers)
|
|
1049
1045
|
|
|
1050
|
-
self._primary_environment
|
|
1046
|
+
self._primary_environment = environment
|
|
1051
1047
|
|
|
1052
1048
|
self.__class__.latest_client = self
|
|
1053
1049
|
if notebook.is_notebook():
|
|
@@ -1120,16 +1116,11 @@ class ChalkAPIClientImpl(ChalkClient):
|
|
|
1120
1116
|
creds = ExchangeCredentialsResponse(**response_json)
|
|
1121
1117
|
except ValidationError:
|
|
1122
1118
|
raise HTTPError(response=resp)
|
|
1123
|
-
self._access_token = creds.access_token
|
|
1124
1119
|
self._default_headers["Authorization"] = f"Bearer {creds.access_token}"
|
|
1125
1120
|
# FIXME: We should NOT be using the X-Chalk-Client-Id for anything, as it is NOT authenticated
|
|
1126
1121
|
self._default_headers["X-Chalk-Client-Id"] = self._client_id
|
|
1127
1122
|
if self._primary_environment is None:
|
|
1128
1123
|
self._primary_environment = creds.primary_environment
|
|
1129
|
-
self._env_id_to_engine_url_map = creds.engines
|
|
1130
|
-
self._env_id_to_env_name_map = creds.environment_id_to_name
|
|
1131
|
-
if self._env_id_to_env_name_map is not None:
|
|
1132
|
-
self._env_name_to_env_id_map = {v: k for k, v in self._env_id_to_env_name_map.items()}
|
|
1133
1124
|
|
|
1134
1125
|
def _get_headers(
|
|
1135
1126
|
self,
|
|
@@ -1392,48 +1383,6 @@ https://docs.chalk.ai/docs/debugging-queries#resolver-replay
|
|
|
1392
1383
|
method=method, headers=headers, url=url, json=json_body, data=data, timeout=timeout_value
|
|
1393
1384
|
)
|
|
1394
1385
|
|
|
1395
|
-
def _get_engine_host(self, environment_override: Optional[str]) -> str | None:
|
|
1396
|
-
"""
|
|
1397
|
-
Returns the host to use for data-plane requests to the engine. May fall back to
|
|
1398
|
-
the metadata plane api server host if no engine host can be determined.
|
|
1399
|
-
:param environment_override: Optional user-provided environment name or id.
|
|
1400
|
-
:return: Host for direct engine (data-plane) requests
|
|
1401
|
-
"""
|
|
1402
|
-
|
|
1403
|
-
# always respect user-provided query_server override
|
|
1404
|
-
if self._query_server is not None:
|
|
1405
|
-
return self._query_server
|
|
1406
|
-
|
|
1407
|
-
# if we have no environment information, we likely have not done creds exchange yet.
|
|
1408
|
-
# there's no way to determine an engine host here, so just fall back to api server
|
|
1409
|
-
env_id_or_name: str | None = environment_override or self._primary_environment
|
|
1410
|
-
if env_id_or_name is None:
|
|
1411
|
-
return self._api_server
|
|
1412
|
-
|
|
1413
|
-
# get the correct engine url given a valid env id or env name
|
|
1414
|
-
if self._env_id_to_engine_url_map is not None:
|
|
1415
|
-
if env_id_or_name in self._env_id_to_engine_url_map:
|
|
1416
|
-
return self._env_id_to_engine_url_map[env_id_or_name]
|
|
1417
|
-
elif self._env_name_to_env_id_map is not None and env_id_or_name in self._env_name_to_env_id_map:
|
|
1418
|
-
env_id = self._env_name_to_env_id_map[env_id_or_name]
|
|
1419
|
-
return self._env_id_to_engine_url_map.get(env_id, self._api_server)
|
|
1420
|
-
|
|
1421
|
-
# env name or id is invalid, or we failed to auth, so fall back to api server
|
|
1422
|
-
return self._api_server
|
|
1423
|
-
|
|
1424
|
-
def _get_request_host(self, metadata_request: bool, environment_override: Optional[str]) -> str | None:
|
|
1425
|
-
"""
|
|
1426
|
-
Returns the hostname to use for any requests made by the Chalk Client, whether they are
|
|
1427
|
-
metadata-plane-only requests or data-plane requests (to the engine).
|
|
1428
|
-
:param metadata_request: Is this a metadata-plane-only request? If so, we always use the API server.
|
|
1429
|
-
:param environment_override: Optional user-provided environment name or id.
|
|
1430
|
-
:return: Host to use for any request made by the Chalk Client
|
|
1431
|
-
"""
|
|
1432
|
-
if metadata_request:
|
|
1433
|
-
return self._api_server
|
|
1434
|
-
else:
|
|
1435
|
-
return self._get_engine_host(environment_override)
|
|
1436
|
-
|
|
1437
1386
|
def _request(
|
|
1438
1387
|
self,
|
|
1439
1388
|
method: str,
|
|
@@ -1450,20 +1399,25 @@ https://docs.chalk.ai/docs/debugging-queries#resolver-replay
|
|
|
1450
1399
|
timeout: float | None | ellipsis = ...,
|
|
1451
1400
|
connect_timeout: float | None | ellipsis = ...,
|
|
1452
1401
|
) -> T | requests.Response:
|
|
1453
|
-
# If we don't have an access token, we cannot make a request.
|
|
1454
|
-
# Always fetch an access token if we do not have one before making a request.
|
|
1455
|
-
# If we fetched an access token during this call and we get 401/403 on this request,
|
|
1456
|
-
# then do not retry the credential exchange again.
|
|
1457
1402
|
allow_credential_exchange: bool = True
|
|
1458
|
-
|
|
1403
|
+
|
|
1404
|
+
if metadata_request or self._query_server is None:
|
|
1405
|
+
host = self._api_server
|
|
1406
|
+
else:
|
|
1407
|
+
host = self._query_server
|
|
1408
|
+
|
|
1409
|
+
if host is None:
|
|
1410
|
+
# We definitively need to exchange credentials to get a host
|
|
1459
1411
|
self._exchange_credentials()
|
|
1460
1412
|
allow_credential_exchange = False
|
|
1461
1413
|
|
|
1462
|
-
|
|
1414
|
+
# After exchanging credentials, the api server is never none
|
|
1415
|
+
assert self._api_server is not None
|
|
1463
1416
|
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1417
|
+
if metadata_request or self._query_server is None:
|
|
1418
|
+
host = self._api_server
|
|
1419
|
+
else:
|
|
1420
|
+
host = self._query_server
|
|
1467
1421
|
|
|
1468
1422
|
r = self._do_request_inner(
|
|
1469
1423
|
method=method,
|
|
@@ -1484,11 +1438,14 @@ https://docs.chalk.ai/docs/debugging-queries#resolver-replay
|
|
|
1484
1438
|
# It is possible that credentials expired, or that we changed permissions since we last
|
|
1485
1439
|
# got a token. Exchange them and try again
|
|
1486
1440
|
self._exchange_credentials()
|
|
1487
|
-
host = self._get_request_host(metadata_request, environment_override)
|
|
1488
1441
|
|
|
1489
|
-
# After exchanging credentials, the api server is never null
|
|
1490
|
-
|
|
1491
|
-
|
|
1442
|
+
# After exchanging credentials, the api server is never null
|
|
1443
|
+
assert self._api_server is not None
|
|
1444
|
+
|
|
1445
|
+
if metadata_request or self._query_server is None:
|
|
1446
|
+
host = self._api_server
|
|
1447
|
+
else:
|
|
1448
|
+
host = self._query_server
|
|
1492
1449
|
|
|
1493
1450
|
r = self._do_request_inner(
|
|
1494
1451
|
method=method,
|
|
@@ -4030,8 +3987,9 @@ https://docs.chalk.ai/cli/apply
|
|
|
4030
3987
|
environment_override=context.environment,
|
|
4031
3988
|
preview_deployment_id=preview_deployment_id,
|
|
4032
3989
|
branch=branch,
|
|
4033
|
-
#
|
|
4034
|
-
|
|
3990
|
+
# If using multiple computers, then we must route through the metadata server
|
|
3991
|
+
# So we can actually spin up multiple pods
|
|
3992
|
+
metadata_request=request.use_multiple_computers,
|
|
4035
3993
|
)
|
|
4036
3994
|
return response
|
|
4037
3995
|
|
|
@@ -4107,6 +4065,19 @@ https://docs.chalk.ai/cli/apply
|
|
|
4107
4065
|
branch=None,
|
|
4108
4066
|
)
|
|
4109
4067
|
|
|
4068
|
+
def _get_query_inputs(
|
|
4069
|
+
self, job_id: uuid.UUID, environment: Optional[EnvironmentId], branch: Optional[BranchId]
|
|
4070
|
+
) -> GetOfflineQueryJobResponse:
|
|
4071
|
+
return self._request(
|
|
4072
|
+
method="GET",
|
|
4073
|
+
uri=f"/v2/offline_query_inputs/{job_id}",
|
|
4074
|
+
response=GetOfflineQueryJobResponse,
|
|
4075
|
+
environment_override=environment,
|
|
4076
|
+
json=None,
|
|
4077
|
+
preview_deployment_id=None,
|
|
4078
|
+
branch=branch,
|
|
4079
|
+
)
|
|
4080
|
+
|
|
4110
4081
|
def _get_dataset_from_name_or_id(
|
|
4111
4082
|
self,
|
|
4112
4083
|
*,
|
chalk/client/models.py
CHANGED
|
@@ -454,8 +454,6 @@ class ExchangeCredentialsResponse(BaseModel):
|
|
|
454
454
|
api_server: str
|
|
455
455
|
primary_environment: Optional[str] = None
|
|
456
456
|
engines: Optional[Mapping[str, str]] = None
|
|
457
|
-
grpc_engines: Optional[Mapping[str, str]] = None
|
|
458
|
-
environment_id_to_name: Optional[Mapping[str, str]] = None
|
|
459
457
|
|
|
460
458
|
|
|
461
459
|
class OfflineQueryInput(BaseModel):
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
chalk/__init__.py,sha256=vKsx9-cl5kImlVWGHVRYO6bweBm79NAzGs3l36u71wM,2657
|
|
2
|
-
chalk/_version.py,sha256=
|
|
2
|
+
chalk/_version.py,sha256=7Cc2OCS4iZEpzdq7iHwkSLQA8S6psTq-SKpiAAtUbG0,23
|
|
3
3
|
chalk/cli.py,sha256=ckqqfOI-A2mT23-rnZzDMmblYj-2x1VBX8ebHlIEn9A,5873
|
|
4
4
|
chalk/importer.py,sha256=m4lMn1lSYj_euDq8CS7LYTBnek9JOcjGJf9-82dJHbA,64441
|
|
5
5
|
chalk/prompts.py,sha256=2H9UomLAamdfRTNUdKs9i3VTpiossuyRhntqsAXUhhg,16117
|
|
@@ -616,10 +616,10 @@ chalk/client/client.py,sha256=DcRJltVqWy_B3Qvbnjz3qOECT9TZ7KD0eovds2CNRIw,104746
|
|
|
616
616
|
chalk/client/client_async.py,sha256=YmuExumlDkenlGc8ROtmPjUE2m6nQUZisUDvJmwTRdk,51546
|
|
617
617
|
chalk/client/client_async_impl.py,sha256=ZphhgTB49JBWHCGXe-dI0wWWKc9zPcOczy02q_gFy50,6925
|
|
618
618
|
chalk/client/client_grpc.py,sha256=z1WeFWjmKKCU8dK7fdvWEOsCUlBi-v_2-HijC2_oIVs,108854
|
|
619
|
-
chalk/client/client_impl.py,sha256=
|
|
619
|
+
chalk/client/client_impl.py,sha256=m2-dovRppOchuEwt2LlKJAv0LBW5obs9ztuJeDhuqY0,213660
|
|
620
620
|
chalk/client/dataset.py,sha256=LneWwaAOHCjtj7gaJjsSeVNruj-QJ51hjRi62zrFNVE,77561
|
|
621
621
|
chalk/client/exc.py,sha256=kZJ80YbSeSRDmTLTh240j_eRdJFZBa7IaDsNSRoDroU,4145
|
|
622
|
-
chalk/client/models.py,sha256=
|
|
622
|
+
chalk/client/models.py,sha256=TWiRHDMP_9NUqlCAGaw2RI2UlFI5ED1BCBM1rZRK72k,67482
|
|
623
623
|
chalk/client/response.py,sha256=m8sQCOj7YVv3mZSZMIC1rIMzFMQ9rfMdBRLg5NRmOOE,53257
|
|
624
624
|
chalk/client/_internal_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
625
625
|
chalk/client/_internal_models/check.py,sha256=3Xfo4Ws4rvwjeVg0-5-kejfRfRBJeqHmnRhW-WEz784,917
|
|
@@ -827,8 +827,8 @@ chalk/utils/tracing.py,sha256=NiiM-9dbuJhSCv6R1npR1uYNKWlkqTR6Ygm0Voi2NrY,13078
|
|
|
827
827
|
chalk/utils/weak_set_by_identity.py,sha256=VmikA_laYwFeOphCwXJIuyOIkrdlQe0bSzaXq7onoQw,953
|
|
828
828
|
chalk/utils/pydanticutil/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
829
829
|
chalk/utils/pydanticutil/pydantic_compat.py,sha256=O575lLYJ5GvZC4HMzR9yATxf9XwjC6NrDUXbNwZidlE,3031
|
|
830
|
-
chalkpy-2.98.
|
|
831
|
-
chalkpy-2.98.
|
|
832
|
-
chalkpy-2.98.
|
|
833
|
-
chalkpy-2.98.
|
|
834
|
-
chalkpy-2.98.
|
|
830
|
+
chalkpy-2.98.2.dist-info/METADATA,sha256=iROjKSQYMlH8Dfat6xKGCMx7ymmRV7SvKhEK_yGolb8,27754
|
|
831
|
+
chalkpy-2.98.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
832
|
+
chalkpy-2.98.2.dist-info/entry_points.txt,sha256=Vg23sd8icwq-morJrljVFr-kQnMbm95rZfZj5wsZGis,42
|
|
833
|
+
chalkpy-2.98.2.dist-info/top_level.txt,sha256=1Q6_19IGYfNxSw50W8tYKEJ2t5HKQ3W9Wiw4ia5yg2c,6
|
|
834
|
+
chalkpy-2.98.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|