mostlyai 0.3.0__tar.gz → 0.3.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.1
2
2
  Name: mostlyai
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: The official Python client for the MOSTLY AI platform.
5
5
  Home-page: https://app.mostly.ai/
6
6
  License: Proprietary
@@ -31,6 +31,8 @@ A Python wrapper for the MOSTLY AI platform (https://app.mostly.ai/).
31
31
  | Generate unlimited synthetic data on demand | `mostly.generate(g, size)` |
32
32
  | Prompt the generator for the data that you need | `mostly.generate(g, seed)` |
33
33
  | Connect to any data source within your org | `mostly.connect(config)` |
34
+ | Info about the current user | `mostly.me()` |
35
+
34
36
 
35
37
 
36
38
 
@@ -9,6 +9,8 @@ A Python wrapper for the MOSTLY AI platform (https://app.mostly.ai/).
9
9
  | Generate unlimited synthetic data on demand | `mostly.generate(g, size)` |
10
10
  | Prompt the generator for the data that you need | `mostly.generate(g, seed)` |
11
11
  | Connect to any data source within your org | `mostly.connect(config)` |
12
+ | Info about the current user | `mostly.me()` |
13
+
12
14
 
13
15
 
14
16
 
@@ -4,15 +4,15 @@ from typing import Any, Optional, Union
4
4
  import pandas as pd
5
5
  import rich
6
6
 
7
- from mostlyai.base import _MostlyBaseClient
7
+ from mostlyai.base import GET, _MostlyBaseClient
8
8
  from mostlyai.connectors import _MostlyConnectorsClient
9
9
  from mostlyai.generators import _MostlyGeneratorsClient
10
10
  from mostlyai.model import (
11
11
  Connector,
12
+ CurrentUser,
12
13
  Generator,
13
14
  PermissionLevel,
14
15
  ProgressStatus,
15
- SyntheticDataset,
16
16
  )
17
17
  from mostlyai.shares import _MostlySharesClient
18
18
  from mostlyai.synthetic_datasets import _MostlySyntheticDatasetsClient
@@ -30,6 +30,7 @@ class MostlyAI(_MostlyBaseClient):
30
30
  :param base_url: The base URL. If not provided, a default value is used.
31
31
  :param api_key: The API key for authenticating. If not provided, it would rely on env vars.
32
32
  :param timeout: Timeout for HTTPS requests in seconds.
33
+ :param ssl_verify: Whether to verify SSL certificates.
33
34
  """
34
35
 
35
36
  def __init__(
@@ -37,12 +38,16 @@ class MostlyAI(_MostlyBaseClient):
37
38
  base_url: Optional[str] = None,
38
39
  api_key: Optional[str] = None,
39
40
  timeout: float = 60.0,
41
+ ssl_verify: bool = True,
40
42
  ):
41
- super().__init__(base_url=base_url, api_key=api_key, timeout=timeout)
43
+ super().__init__(
44
+ base_url=base_url, api_key=api_key, timeout=timeout, ssl_verify=ssl_verify
45
+ )
42
46
  client_kwargs = {
43
47
  "base_url": self.base_url,
44
48
  "api_key": self.api_key,
45
49
  "timeout": self.timeout,
50
+ "ssl_verify": self.ssl_verify,
46
51
  }
47
52
  self.connectors = _MostlyConnectorsClient(**client_kwargs)
48
53
  self.generators = _MostlyGeneratorsClient(**client_kwargs)
@@ -88,6 +93,18 @@ class MostlyAI(_MostlyBaseClient):
88
93
  - secrets
89
94
  - accessToken: keyFile
90
95
  - location: schema.table
96
+ - HIVE
97
+ - config
98
+ - host: string
99
+ - port: integer, default: 10000
100
+ - username: string, optional
101
+ - kerberos_enabled: boolean, default: false
102
+ - kerberos_principal: string, optional
103
+ - kerberos_krb5_conf: string, optional
104
+ - secrets
105
+ - password: string, optional
106
+ - kerberos_keytab: base64-encoded string, optional
107
+ - location: database.table
91
108
  - MARIADB
92
109
  - config
93
110
  - host: string
@@ -246,12 +263,12 @@ class MostlyAI(_MostlyBaseClient):
246
263
  {
247
264
  "name": table,
248
265
  "configuration": {
249
- "sampleSize": size.get(table)
250
- if isinstance(size, dict)
251
- else size,
252
- "sampleSeedData": seed.get(table)
253
- if isinstance(seed, dict)
254
- else seed,
266
+ "sampleSize": (
267
+ size.get(table) if isinstance(size, dict) else size
268
+ ),
269
+ "sampleSeedData": (
270
+ seed.get(table) if isinstance(seed, dict) else seed
271
+ ),
255
272
  },
256
273
  }
257
274
  for table in subject_tables
@@ -321,3 +338,10 @@ class MostlyAI(_MostlyBaseClient):
321
338
  rich.print(
322
339
  f"Revoked access of resource [bold cyan]{resource.id}[/] for [bold]{user_email}[/]"
323
340
  )
341
+
342
+ def me(self) -> CurrentUser:
343
+ """
344
+ Retrieve current user info.
345
+ :return: info about the current user.
346
+ """
347
+ return self.request(verb=GET, path=["users", "me"], response_type=CurrentUser)
@@ -46,15 +46,19 @@ class _MostlyBaseClient:
46
46
  base_url: Optional[str] = None,
47
47
  api_key: Optional[str] = None,
48
48
  timeout: float = 60.0,
49
+ ssl_verify: bool = True,
49
50
  ):
50
51
  self.base_url = (
51
52
  base_url or os.getenv("MOSTLY_BASE_URL") or DEFAULT_BASE_URL
52
53
  ).rstrip("/")
53
54
  self.api_key = api_key or os.getenv("MOSTLY_API_KEY")
54
55
  self.timeout = timeout
56
+ self.ssl_verify = ssl_verify
55
57
  if not self.api_key:
56
- raise APIError("The API key must be either set by passing api_key to the client or by specifying a "
57
- "MOSTLY_API_KEY environment variable")
58
+ raise APIError(
59
+ "The API key must be either set by passing api_key to the client or by specifying a "
60
+ "MOSTLY_API_KEY environment variable"
61
+ )
58
62
 
59
63
  def headers(self):
60
64
  return {
@@ -102,7 +106,7 @@ class _MostlyBaseClient:
102
106
  )
103
107
 
104
108
  try:
105
- with httpx.Client(timeout=self.timeout) as client:
109
+ with httpx.Client(timeout=self.timeout, verify=self.ssl_verify) as client:
106
110
  response = client.request(method=verb, url=full_url, **kwargs)
107
111
  response.raise_for_status()
108
112
  except httpx.HTTPStatusError as exc:
@@ -1,6 +1,3 @@
1
- from typing import Union
2
- from uuid import UUID
3
-
4
1
  from mostlyai.base import DELETE, GET, POST, _MostlyBaseClient
5
2
  from mostlyai.model import (
6
3
  Connector,
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "mostlyai"
3
- version = "0.3.0"
3
+ version = "0.3.2"
4
4
  description = "The official Python client for the MOSTLY AI platform."
5
5
  homepage = "https://app.mostly.ai/"
6
6
  authors = ["MOSTLY AI <office@mostly.ai>"]
@@ -52,6 +52,7 @@ version_scheme = "pep440"
52
52
  version_provider = "poetry"
53
53
  update_changelog_on_bump = true
54
54
  major_version_zero = true
55
+
55
56
  [build-system]
56
57
  requires = ["poetry-core"]
57
58
  build-backend = "poetry.core.masonry.api"
File without changes
File without changes
File without changes
File without changes