craft-ai-sdk 0.62.2rc1__tar.gz → 0.62.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.
Files changed (32) hide show
  1. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/PKG-INFO +1 -1
  2. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/__init__.py +1 -1
  3. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/core/endpoints.py +3 -1
  4. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/core/pipeline_metrics.py +4 -2
  5. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/core/pipelines.py +1 -0
  6. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/io.py +2 -0
  7. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/sdk.py +7 -6
  8. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/shared/authentication.py +4 -1
  9. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/shared/request_response_handler.py +5 -4
  10. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/shared/warnings.py +4 -1
  11. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/utils/file_utils.py +1 -1
  12. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/documentation.pdf +0 -0
  13. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/pyproject.toml +2 -1
  14. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/LICENSE +0 -0
  15. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/README.md +0 -0
  16. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/constants.py +0 -0
  17. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/core/data_store.py +0 -0
  18. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/core/deployments.py +0 -0
  19. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/core/environment_variables.py +0 -0
  20. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/core/pipeline_executions.py +0 -0
  21. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/core/resource_metrics.py +0 -0
  22. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/core/steps.py +0 -0
  23. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/core/users.py +0 -0
  24. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/core/vector_database.py +0 -0
  25. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/exceptions.py +0 -0
  26. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/shared/environments.py +0 -0
  27. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/shared/execution_context.py +0 -0
  28. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/shared/helpers.py +0 -0
  29. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/shared/logger.py +0 -0
  30. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/utils/__init__.py +0 -0
  31. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/utils/datetime_utils.py +0 -0
  32. {craft_ai_sdk-0.62.2rc1 → craft_ai_sdk-0.62.3}/craft_ai_sdk/utils/dict_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: craft-ai-sdk
3
- Version: 0.62.2rc1
3
+ Version: 0.62.3
4
4
  Summary: Craft AI MLOps platform SDK
5
5
  License: Apache-2.0
6
6
  Author: Craft AI
@@ -13,4 +13,4 @@ from .io import ( # noqa: F401
13
13
  )
14
14
  from .sdk import CraftAiSdk # noqa: F401
15
15
 
16
- __version__ = "0.62.2rc1"
16
+ __version__ = "0.62.3"
@@ -23,7 +23,7 @@ def trigger_endpoint(
23
23
  sdk: BaseCraftAiSdk,
24
24
  endpoint_name,
25
25
  endpoint_token,
26
- inputs={},
26
+ inputs=None,
27
27
  wait_for_completion=True,
28
28
  ):
29
29
  """Trigger an endpoint.
@@ -50,6 +50,8 @@ def trigger_endpoint(
50
50
  output names as keys and corresponding values as values. Note that this
51
51
  key is only returned if ``wait_for_completion`` is `True`.
52
52
  """
53
+ if inputs is None:
54
+ inputs = {}
53
55
  endpoint_url_path = _get_endpoint_url_path(sdk, endpoint_name)
54
56
 
55
57
  body = {}
@@ -23,7 +23,8 @@ def record_metric_value(sdk: BaseCraftAiSdk, name, value):
23
23
  if sdk.warn_on_metric_outside_of_step:
24
24
  warnings.warn(
25
25
  "You cannot send a metric outside a step code, the metric has not \
26
- been sent"
26
+ been sent",
27
+ stacklevel=2,
27
28
  )
28
29
  return False
29
30
  url = f"{sdk.base_environment_api_url}" f"/metrics/single-value/{name}"
@@ -51,7 +52,8 @@ def record_list_metric_values(sdk: BaseCraftAiSdk, name, values):
51
52
  if sdk.warn_on_metric_outside_of_step:
52
53
  warnings.warn(
53
54
  "You cannot send a metric outside a step code, the metric has not \
54
- been sent"
55
+ been sent",
56
+ stacklevel=2,
55
57
  )
56
58
  return False
57
59
 
@@ -190,6 +190,7 @@ def create_pipeline(
190
190
  "Providing the step name as a positional argument is deprecated and will "
191
191
  "be removed in a future version. Please use the step_name keyword argument instead.", # noqa: E501
192
192
  FutureWarning,
193
+ stacklevel=2,
193
194
  )
194
195
  return _create_pipeline_with_step(sdk, pipeline_name, function_path)
195
196
 
@@ -155,6 +155,7 @@ class InputSource:
155
155
  "Providing the step_input_name argument is deprecated and will "
156
156
  "be removed in a future version. Please use the pipeline_input_name keyword argument instead.", # noqa: E501
157
157
  FutureWarning,
158
+ stacklevel=2,
158
159
  )
159
160
  self.pipeline_input_name = pipeline_input_name
160
161
  self.endpoint_input_name = endpoint_input_name
@@ -243,6 +244,7 @@ class OutputDestination:
243
244
  "Providing the 'step_output_name' argument is deprecated and will "
244
245
  "be removed in a future version. Please use the 'pipeline_output_name' keyword argument instead.", # noqa: E501
245
246
  FutureWarning,
247
+ stacklevel=2,
246
248
  )
247
249
  self.pipeline_output_name = pipeline_output_name
248
250
  self.endpoint_output_name = endpoint_output_name
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  import sys
3
3
  import time
4
+ from typing import Any
4
5
  import warnings
5
6
  from abc import ABC, abstractmethod
6
7
  from datetime import timedelta
@@ -24,23 +25,23 @@ class BaseCraftAiSdk(ABC):
24
25
  _version: str
25
26
 
26
27
  @abstractmethod
27
- def _get(self, url, params=None, **kwargs):
28
+ def _get(self, url: str, params=None, **kwargs) -> Any:
28
29
  pass
29
30
 
30
31
  @abstractmethod
31
- def _post(self, url, data=None, params=None, files=None, **kwargs):
32
+ def _post(self, url: str, data=None, params=None, files=None, **kwargs) -> Any:
32
33
  pass
33
34
 
34
35
  @abstractmethod
35
- def _put(self, url, data=None, params=None, files=None, **kwargs):
36
+ def _put(self, url: str, data=None, params=None, files=None, **kwargs) -> Any:
36
37
  pass
37
38
 
38
39
  @abstractmethod
39
- def _patch(self, url, data=None, params=None, files=None, **kwargs):
40
+ def _patch(self, url: str, data=None, params=None, files=None, **kwargs) -> Any:
40
41
  pass
41
42
 
42
43
  @abstractmethod
43
- def _delete(self, url, **kwargs):
44
+ def _delete(self, url: str, **kwargs) -> Any:
44
45
  pass
45
46
 
46
47
 
@@ -136,7 +137,7 @@ class CraftAiSdk(BaseCraftAiSdk):
136
137
  os.environ.get("CRAFT_AI__MULTIPART_PART_SIZE__B", str(38 * 256 * 1024))
137
138
  )
138
139
  _access_token_margin = timedelta(seconds=30)
139
- _version = "0.62.2rc1" # Would be better to share it somewhere
140
+ _version = "0.62.3" # Would be better to share it somewhere
140
141
 
141
142
  def __init__(
142
143
  self,
@@ -1,8 +1,11 @@
1
1
  import functools
2
2
  from datetime import datetime
3
+ from typing import Callable
3
4
 
5
+ from requests import Response
4
6
 
5
- def use_authentication(action_func):
7
+
8
+ def use_authentication(action_func: Callable[..., Response]) -> Callable[..., Response]:
6
9
  @functools.wraps(action_func)
7
10
  def wrapper(sdk, *args, headers=None, **kwargs):
8
11
  actual_headers = None
@@ -1,3 +1,4 @@
1
+ from typing import Any, Callable
1
2
  import xml.etree.ElementTree as ET
2
3
  from json import JSONDecodeError
3
4
 
@@ -7,7 +8,7 @@ from craft_ai_sdk.exceptions import SdkException
7
8
  from craft_ai_sdk.shared.execution_context import get_execution_id
8
9
 
9
10
 
10
- def handle_data_store_response(response):
11
+ def handle_data_store_response(response: Response):
11
12
  """Return the content of a response received from the datastore
12
13
  or parse the send error and raise it.
13
14
 
@@ -43,7 +44,7 @@ def handle_data_store_response(response):
43
44
  )
44
45
 
45
46
 
46
- def _parse_json_response(response):
47
+ def _parse_json_response(response: Response):
47
48
  if response.status_code == 204 or response.text == "OK":
48
49
  return
49
50
  try:
@@ -95,8 +96,8 @@ def handle_http_response(response: Response):
95
96
  _raise_craft_ai_error_from_response(response)
96
97
 
97
98
 
98
- def handle_http_request(request_func):
99
- def wrapper(*args, **kwargs):
99
+ def handle_http_request(request_func: Callable[..., Response]) -> Callable[..., Any]:
100
+ def wrapper(*args, **kwargs) -> Any:
100
101
  get_response = kwargs.pop("get_response", False)
101
102
  try:
102
103
  response = request_func(*args, **kwargs)
@@ -31,7 +31,7 @@ def _documentation_function_warning_decorator(
31
31
  def _get_wrapper(func, warning_message):
32
32
  @functools.wraps(func)
33
33
  def wrapper(*args, **kwargs):
34
- warnings.warn(warning_message, warning_category)
34
+ warnings.warn(warning_message, warning_category, stacklevel=2)
35
35
  return func(*args, **kwargs)
36
36
 
37
37
  doc_start, doc_separator, doc_end = func.__doc__.partition("\n\n")
@@ -111,11 +111,13 @@ def experimental_parameters(parameters):
111
111
  warnings.warn(
112
112
  parameters[key][value]["message"],
113
113
  FutureWarning,
114
+ stacklevel=2,
114
115
  )
115
116
  elif EXPERIMENTAL_VALUES.ALL in parameters[key]:
116
117
  warnings.warn(
117
118
  parameters[key][EXPERIMENTAL_VALUES.ALL]["message"],
118
119
  FutureWarning,
120
+ stacklevel=2,
119
121
  )
120
122
  elif EXPERIMENTAL_VALUES.STRING_CONTAINING in parameters[key]:
121
123
  if any(
@@ -129,6 +131,7 @@ def experimental_parameters(parameters):
129
131
  "message"
130
132
  ],
131
133
  FutureWarning,
134
+ stacklevel=2,
132
135
  )
133
136
  return func(*args, **kwargs)
134
137
 
@@ -37,7 +37,7 @@ def convert_size(size_in_bytes):
37
37
  Convert a size in bytes to a human readable string.
38
38
  """
39
39
  units = ["B", "KB", "MB", "GB", "TB"]
40
- for unit in units:
40
+ for unit in units: # noqa: B007
41
41
  if size_in_bytes < 1024.0:
42
42
  break
43
43
  size_in_bytes /= 1024.0
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "craft-ai-sdk"
3
- version = "0.62.2rc1"
3
+ version = "0.62.3"
4
4
  description = "Craft AI MLOps platform SDK"
5
5
  license = "Apache-2.0"
6
6
  authors = ["Craft AI <contact@craft.ai>"]
@@ -36,6 +36,7 @@ ipython = "^8.18.1"
36
36
  ipykernel = "^6.29.5"
37
37
  black = "^25.1.0"
38
38
  flake8 = "^7.1.2"
39
+ flake8-bugbear = "^24.12.12"
39
40
  pylint = "^3.3.4"
40
41
  python-dotenv = "^1.0.1"
41
42
  pytest = "^8.3.4"
File without changes