mostlyai 0.6.0__tar.gz → 0.6.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.
- {mostlyai-0.6.0 → mostlyai-0.6.2}/PKG-INFO +3 -3
- {mostlyai-0.6.0 → mostlyai-0.6.2}/README.md +2 -2
- mostlyai-0.6.2/mostlyai/__init__.py +18 -0
- mostlyai-0.6.2/mostlyai/client/__init__.py +14 -0
- {mostlyai-0.6.0 → mostlyai-0.6.2}/mostlyai/client/_base_utils.py +14 -0
- {mostlyai-0.6.0 → mostlyai-0.6.2}/mostlyai/client/_mostly_utils.py +14 -0
- {mostlyai-0.6.0 → mostlyai-0.6.2}/mostlyai/client/_naming_conventions.py +14 -0
- {mostlyai-0.6.0 → mostlyai-0.6.2}/mostlyai/client/api.py +34 -6
- {mostlyai-0.6.0 → mostlyai-0.6.2}/mostlyai/client/base.py +18 -0
- {mostlyai-0.6.0 → mostlyai-0.6.2}/mostlyai/client/connectors.py +21 -1
- {mostlyai-0.6.0 → mostlyai-0.6.2}/mostlyai/client/domain.py +884 -527
- {mostlyai-0.6.0 → mostlyai-0.6.2}/mostlyai/client/exceptions.py +14 -0
- {mostlyai-0.6.0 → mostlyai-0.6.2}/mostlyai/client/generators.py +14 -0
- {mostlyai-0.6.0 → mostlyai-0.6.2}/mostlyai/client/synthetic_datasets.py +14 -0
- {mostlyai-0.6.0 → mostlyai-0.6.2}/pyproject.toml +1 -1
- mostlyai-0.6.0/mostlyai/__init__.py +0 -4
- mostlyai-0.6.0/mostlyai/client/__init__.py +0 -0
- {mostlyai-0.6.0 → mostlyai-0.6.2}/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mostlyai
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: MOSTLY AI - Python Client
|
|
5
5
|
Home-page: https://app.mostly.ai/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -37,7 +37,7 @@ Description-Content-Type: text/markdown
|
|
|
37
37
|
|
|
38
38
|
[](https://mostly-ai.github.io/mostlyai-client/) [](https://pypi.org/project/mostlyai/)   
|
|
39
39
|
|
|
40
|
-
The official Python client for [MOSTLY AI](https://app.mostly.ai/), the #1 platform for high-fidelity
|
|
40
|
+
The official Python client for [MOSTLY AI](https://app.mostly.ai/), the #1 platform for high-fidelity privacy-safe **Synthetic Data**.
|
|
41
41
|
|
|
42
42
|
The client allows you to programmatically create, browse and manage the 3 key resources of the MOSTLY AI platform:
|
|
43
43
|
|
|
@@ -53,7 +53,7 @@ The client allows you to programmatically create, browse and manage the 3 key re
|
|
|
53
53
|
| Live probe the generator on demand | `df = mostly.probe(g, config)` | see [mostly.probe](https://mostly-ai.github.io/mostlyai-client/api_client/#mostlyai.client.api.MostlyAI.probe) |
|
|
54
54
|
| Connect to any data source within your org | `c = mostly.connect(config)` | see [mostly.connect](https://mostly-ai.github.io/mostlyai-client/api_client/#mostlyai.client.api.MostlyAI.connect) |
|
|
55
55
|
|
|
56
|
-
See also our [Platform Documentation](https://mostly.ai/docs) for detailed feature descriptions and further Python examples.
|
|
56
|
+
See our [Package Documentation](https://mostly-ai.github.io/mostlyai-client/) as well also our [Platform Documentation](https://mostly.ai/docs) for detailed feature descriptions and further Python examples.
|
|
57
57
|
|
|
58
58
|
## Installation
|
|
59
59
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://mostly-ai.github.io/mostlyai-client/) [](https://pypi.org/project/mostlyai/)   
|
|
4
4
|
|
|
5
|
-
The official Python client for [MOSTLY AI](https://app.mostly.ai/), the #1 platform for high-fidelity
|
|
5
|
+
The official Python client for [MOSTLY AI](https://app.mostly.ai/), the #1 platform for high-fidelity privacy-safe **Synthetic Data**.
|
|
6
6
|
|
|
7
7
|
The client allows you to programmatically create, browse and manage the 3 key resources of the MOSTLY AI platform:
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ The client allows you to programmatically create, browse and manage the 3 key re
|
|
|
18
18
|
| Live probe the generator on demand | `df = mostly.probe(g, config)` | see [mostly.probe](https://mostly-ai.github.io/mostlyai-client/api_client/#mostlyai.client.api.MostlyAI.probe) |
|
|
19
19
|
| Connect to any data source within your org | `c = mostly.connect(config)` | see [mostly.connect](https://mostly-ai.github.io/mostlyai-client/api_client/#mostlyai.client.api.MostlyAI.connect) |
|
|
20
20
|
|
|
21
|
-
See also our [Platform Documentation](https://mostly.ai/docs) for detailed feature descriptions and further Python examples.
|
|
21
|
+
See our [Package Documentation](https://mostly-ai.github.io/mostlyai-client/) as well also our [Platform Documentation](https://mostly.ai/docs) for detailed feature descriptions and further Python examples.
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Copyright 2024 MOSTLY AI
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from mostlyai.client.api import MostlyAI
|
|
16
|
+
|
|
17
|
+
__all__ = ["MostlyAI"]
|
|
18
|
+
__version__ = "0.6.2" # Do not set this manually. Use poetry version [params].
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Copyright 2024 MOSTLY AI
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 MOSTLY AI
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
1
15
|
import base64
|
|
2
16
|
import io
|
|
3
17
|
import warnings
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 MOSTLY AI
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
1
15
|
import time
|
|
2
16
|
from pathlib import Path
|
|
3
17
|
from typing import Callable, Union, Any, Optional
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 MOSTLY AI
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
1
15
|
import re
|
|
2
16
|
from typing import Callable
|
|
3
17
|
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 MOSTLY AI
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
1
15
|
from pathlib import Path
|
|
2
16
|
from typing import Any, Optional, Union, Literal
|
|
3
17
|
|
|
@@ -19,6 +33,7 @@ from mostlyai.client.domain import (
|
|
|
19
33
|
SourceTableConfig,
|
|
20
34
|
SyntheticDatasetConfig,
|
|
21
35
|
SyntheticProbeConfig,
|
|
36
|
+
AboutService,
|
|
22
37
|
)
|
|
23
38
|
from mostlyai.client.synthetic_datasets import (
|
|
24
39
|
_MostlySyntheticDatasetsClient,
|
|
@@ -85,12 +100,24 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
85
100
|
self.generators = _MostlyGeneratorsClient(**client_kwargs)
|
|
86
101
|
self.synthetic_datasets = _MostlySyntheticDatasetsClient(**client_kwargs)
|
|
87
102
|
self.synthetic_probes = _MostlySyntheticProbesClient(**client_kwargs)
|
|
103
|
+
try:
|
|
104
|
+
version = self.about().version
|
|
105
|
+
email = self.me().email
|
|
106
|
+
rich.print(
|
|
107
|
+
f"Connected to {self.base_url} ({version}) as [bold]{email}[/bold]"
|
|
108
|
+
)
|
|
109
|
+
except Exception as e:
|
|
110
|
+
rich.print(f"Failed to connect to {self.base_url}: {e}")
|
|
88
111
|
|
|
89
112
|
def __repr__(self) -> str:
|
|
90
113
|
api_key = "'***'" if self.api_key else "None"
|
|
91
114
|
return f"MostlyAI(base_url='{self.base_url}', api_key={api_key})"
|
|
92
115
|
|
|
93
|
-
def connect(
|
|
116
|
+
def connect(
|
|
117
|
+
self,
|
|
118
|
+
config: Union[ConnectorConfig, dict[str, Any]],
|
|
119
|
+
test_connection: Optional[bool] = True,
|
|
120
|
+
) -> Connector:
|
|
94
121
|
"""
|
|
95
122
|
Create a connector and optionally validate the connection before saving.
|
|
96
123
|
|
|
@@ -115,6 +142,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
115
142
|
|
|
116
143
|
Args:
|
|
117
144
|
config: Configuration for the connector. Can be either a ConnectorConfig object or an equivalent dictionary.
|
|
145
|
+
test_connection: Whether to validate the connection before saving.
|
|
118
146
|
|
|
119
147
|
The structures of the `config`, `secrets` and `ssl` parameters depend on the connector `type`:
|
|
120
148
|
|
|
@@ -236,7 +264,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
236
264
|
Returns:
|
|
237
265
|
Connector: The created connector.
|
|
238
266
|
"""
|
|
239
|
-
c = self.connectors.create(config)
|
|
267
|
+
c = self.connectors.create(config=config, test_connection=test_connection)
|
|
240
268
|
rich.print(
|
|
241
269
|
f"Created connector [link={self.base_url}/d/connectors/{c.id} blue underline]{c.id}[/]"
|
|
242
270
|
)
|
|
@@ -537,11 +565,11 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
537
565
|
```
|
|
538
566
|
|
|
539
567
|
Returns:
|
|
540
|
-
|
|
568
|
+
Information about the current user.
|
|
541
569
|
"""
|
|
542
570
|
return self.request(verb=GET, path=["users", "me"], response_type=CurrentUser)
|
|
543
571
|
|
|
544
|
-
def about(self) ->
|
|
572
|
+
def about(self) -> AboutService:
|
|
545
573
|
"""
|
|
546
574
|
Retrieve information about the platform.
|
|
547
575
|
|
|
@@ -554,9 +582,9 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
554
582
|
```
|
|
555
583
|
|
|
556
584
|
Returns:
|
|
557
|
-
|
|
585
|
+
Information about the platform.
|
|
558
586
|
"""
|
|
559
|
-
return self.request(verb=GET, path=["about"])
|
|
587
|
+
return self.request(verb=GET, path=["about"], response_type=AboutService)
|
|
560
588
|
|
|
561
589
|
def models(self, model_type: Union[str, ModelType]) -> list[str]:
|
|
562
590
|
"""
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 MOSTLY AI
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
1
15
|
import os
|
|
2
16
|
import sys
|
|
3
17
|
import warnings
|
|
@@ -121,6 +135,10 @@ class _MostlyBaseClient:
|
|
|
121
135
|
if isinstance(kwargs["json"], BaseModel):
|
|
122
136
|
kwargs["json"] = kwargs["json"].model_dump()
|
|
123
137
|
kwargs["json"] = map_snake_to_camel_case(kwargs["json"])
|
|
138
|
+
if "params" in kwargs and do_json_camel_case:
|
|
139
|
+
if isinstance(kwargs["params"], BaseModel):
|
|
140
|
+
kwargs["params"] = kwargs["params"].model_dump()
|
|
141
|
+
kwargs["params"] = map_snake_to_camel_case(kwargs["params"])
|
|
124
142
|
|
|
125
143
|
try:
|
|
126
144
|
with httpx.Client(timeout=self.timeout, verify=self.ssl_verify) as client:
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 MOSTLY AI
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
1
15
|
from typing import Any, Iterator, Optional, List, Dict, Union
|
|
2
16
|
|
|
3
17
|
from mostlyai.client.base import DELETE, GET, PATCH, POST, Paginator, _MostlyBaseClient
|
|
@@ -78,6 +92,7 @@ class _MostlyConnectorsClient(_MostlyBaseClient):
|
|
|
78
92
|
def create(
|
|
79
93
|
self,
|
|
80
94
|
config: Union[ConnectorConfig, dict[str, Any]],
|
|
95
|
+
test_connection: Optional[bool] = True,
|
|
81
96
|
) -> Connector:
|
|
82
97
|
"""
|
|
83
98
|
Create a connector and optionally validate the connection before saving.
|
|
@@ -86,12 +101,17 @@ class _MostlyConnectorsClient(_MostlyBaseClient):
|
|
|
86
101
|
|
|
87
102
|
Args:
|
|
88
103
|
config: Configuration for the connector.
|
|
104
|
+
test_connection: Whether to test the connection before saving the connector
|
|
89
105
|
|
|
90
106
|
Returns:
|
|
91
107
|
The created connector object.
|
|
92
108
|
"""
|
|
93
109
|
response = self.request(
|
|
94
|
-
verb=POST,
|
|
110
|
+
verb=POST,
|
|
111
|
+
path=[],
|
|
112
|
+
json=config,
|
|
113
|
+
params={"test_connection": test_connection},
|
|
114
|
+
response_type=Connector,
|
|
95
115
|
)
|
|
96
116
|
return response
|
|
97
117
|
|