proxyml 0.2.1__tar.gz → 0.2.2__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: proxyml
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Python SDK for calling the ProxyML API
5
5
  Author-email: ProxyML <contact@proxyml.ai>
6
6
  License: Apache License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "proxyml"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "Python SDK for calling the ProxyML API"
9
9
  readme = "README.md"
10
10
  license = {file = "LICENSE"}
@@ -156,13 +156,13 @@ def delete(endpoint: str) -> requests.models.Response | _ErrorResponse:
156
156
  return _ErrorResponse()
157
157
 
158
158
 
159
- def put_schema(schema: dict, name: str = "default") -> Any:
159
+ def put_schema(schema: dict, name: str) -> Any:
160
160
  """
161
161
  Uploads a data schema.
162
162
 
163
163
  Args:
164
164
  schema (dict): data schema object
165
- name (str): optional name for the schema, defaults to "default".
165
+ name (str): name for the schema.
166
166
  Returns:
167
167
  API response JSON object, or None if the return code was not 200.
168
168
  """
@@ -178,7 +178,7 @@ def put_schema(schema: dict, name: str = "default") -> Any:
178
178
  return None
179
179
 
180
180
 
181
- def fetch_schema(name: str = "default") -> dict | None:
181
+ def fetch_schema(name: str) -> dict | None:
182
182
  """Retrieve a stored feature schema by name."""
183
183
  r = get(endpoint=f'/schema/{name}', params={})
184
184
  if r.status_code == 200:
@@ -242,7 +242,7 @@ def _cast_column(series: pd.Series, ftype: str) -> pd.Series:
242
242
  return series
243
243
 
244
244
 
245
- def synthesize_data(num_points: int = 100, sample: list | None = None, as_df: bool = True, schema_name: str = "default") -> Any:
245
+ def synthesize_data(num_points: int = 100, sample: list | None = None, as_df: bool = True, *, schema_name: str) -> Any:
246
246
  """
247
247
  Synthesizes data based on a data schema.
248
248
 
@@ -250,7 +250,7 @@ def synthesize_data(num_points: int = 100, sample: list | None = None, as_df: bo
250
250
  num_points (int): number of samples to synthesize, defaults to 100.
251
251
  sample (list): if specified, synthesized data will be a blend of samples generated from the schema and a number of perturbations around this sample. If not specified (default), all synthesized data is generated by sampling from the data schema.
252
252
  as_df (bool): if True (default), data are returned as a pandas DataFrame.
253
- schema_name (str): name of the data schema to use to generate the data, defaults to "default."
253
+ schema_name (str): name of the data schema to use to generate the data.
254
254
  Returns:
255
255
  JSON object representing the synthesized data if as_df=False, a pandas DataFrame if as_df=True, or None if an error occurred.
256
256
  """
@@ -280,7 +280,8 @@ def train_surrogate(
280
280
  feature_names: list[str] | None,
281
281
  task: str = 'auto',
282
282
  test_size: float = 0.2,
283
- schema_name: str = "default",
283
+ *,
284
+ schema_name: str,
284
285
  name: str | None = None,
285
286
  comments: str | None = None,
286
287
  ) -> Any:
@@ -293,7 +294,7 @@ def train_surrogate(
293
294
  feature_names (list): names of the features (columns) in the data.
294
295
  task (str): specifies the modeling task, one of "classification," "regression," or "auto" in which case ProxyML will attempt to automatically determine the modeling task.
295
296
  test_size (float): fraction of the data to set aside for test data, defaults to 0.2.
296
- schema_name (str): name of the data schema to use, defaults to "default."
297
+ schema_name (str): name of the data schema to use.
297
298
  name (str): an optional name for the surrogate.
298
299
  comments (str): an optional comment string for the surrogate.
299
300
  Returns:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: proxyml
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Python SDK for calling the ProxyML API
5
5
  Author-email: ProxyML <contact@proxyml.ai>
6
6
  License: Apache License
@@ -201,11 +201,11 @@ def _mock_response(status_code, json_body):
201
201
 
202
202
 
203
203
  @patch("proxyml.client.put")
204
- def test_put_schema_default(mock_put):
204
+ def test_put_schema_success(mock_put):
205
205
  mock_put.return_value = _mock_response(200, {"features": []})
206
- result = put_schema({"features": []})
206
+ result = put_schema({"features": []}, name="myschema")
207
207
  assert result == {"features": []}
208
- mock_put.assert_called_once_with(endpoint="/schema/default", payload={"features": []})
208
+ mock_put.assert_called_once_with(endpoint="/schema/myschema", payload={"features": []})
209
209
 
210
210
 
211
211
  @patch("proxyml.client.put")
@@ -218,7 +218,7 @@ def test_put_schema_named(mock_put):
218
218
  @patch("proxyml.client.put")
219
219
  def test_put_schema_failure(mock_put):
220
220
  mock_put.return_value = _mock_response(422, {"detail": "invalid"})
221
- result = put_schema({"features": []})
221
+ result = put_schema({"features": []}, name="myschema")
222
222
  assert result is None
223
223
 
224
224
 
@@ -227,11 +227,11 @@ def test_put_schema_failure(mock_put):
227
227
  # ---------------------------------------------------------------------------
228
228
 
229
229
  @patch("proxyml.client.get")
230
- def test_fetch_schema_default(mock_get):
230
+ def test_fetch_schema_success(mock_get):
231
231
  mock_get.return_value = _mock_response(200, {"features": [{"type": "continuous", "name": "age"}]})
232
- result = fetch_schema()
232
+ result = fetch_schema(name="myschema")
233
233
  assert result["features"][0]["name"] == "age"
234
- mock_get.assert_called_once_with(endpoint="/schema/default", params={})
234
+ mock_get.assert_called_once_with(endpoint="/schema/myschema", params={})
235
235
 
236
236
 
237
237
  @patch("proxyml.client.get")
@@ -309,12 +309,12 @@ def test_synthesize_data_no_sample(mock_post):
309
309
  "feature_names": ["f_cont", "f_cat"],
310
310
  "feature_types": ["continuous", "categorical"],
311
311
  })
312
- df = synthesize_data(num_points=2, sample=None)
312
+ df = synthesize_data(num_points=2, sample=None, schema_name="myschema")
313
313
  assert isinstance(df, pd.DataFrame)
314
314
  assert list(df.columns) == ["f_cont", "f_cat"]
315
315
  payload = mock_post.call_args.kwargs["payload"]
316
316
  assert payload["n"] == 2
317
- assert payload["schema_name"] == "default"
317
+ assert payload["schema_name"] == "myschema"
318
318
 
319
319
 
320
320
  @patch("proxyml.client.post")
@@ -330,7 +330,7 @@ def test_synthesize_data_named_schema(mock_post):
330
330
  @patch("proxyml.client.post")
331
331
  def test_synthesize_data_failure_returns_none(mock_post):
332
332
  mock_post.return_value = _mock_response(500, {})
333
- result = synthesize_data(num_points=10, sample=None)
333
+ result = synthesize_data(num_points=10, sample=None, schema_name="myschema")
334
334
  assert result is None
335
335
 
336
336
 
@@ -343,12 +343,12 @@ def test_train_surrogate_with_metadata(mock_post):
343
343
  })
344
344
  result = train_surrogate(
345
345
  samples=[[1.0, 2.0]], predictions=[3.0],
346
- feature_names=None, name="v1", comments="test run",
346
+ feature_names=None, schema_name="myschema", name="v1", comments="test run",
347
347
  )
348
348
  payload = mock_post.call_args.kwargs["payload"]
349
349
  assert payload["name"] == "v1"
350
350
  assert payload["comments"] == "test run"
351
- assert payload["schema_name"] == "default"
351
+ assert payload["schema_name"] == "myschema"
352
352
  assert result["version"] == "abc-123"
353
353
  assert result["trained_at"] == "2026-04-19T12:00:00"
354
354
 
@@ -364,7 +364,7 @@ def test_train_surrogate_named_schema(mock_post):
364
364
  @patch("proxyml.client.post")
365
365
  def test_train_surrogate_omits_none_metadata(mock_post):
366
366
  mock_post.return_value = _mock_response(200, {"version": "abc-123"})
367
- train_surrogate(samples=[[1.0]], predictions=[1.0], feature_names=None)
367
+ train_surrogate(samples=[[1.0]], predictions=[1.0], feature_names=None, schema_name="myschema")
368
368
  payload = mock_post.call_args.kwargs["payload"]
369
369
  assert "name" not in payload
370
370
  assert "comments" not in payload
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes