mostlyai 4.0.3__tar.gz → 4.0.5__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 (84) hide show
  1. {mostlyai-4.0.3 → mostlyai-4.0.5}/PKG-INFO +31 -27
  2. {mostlyai-4.0.3 → mostlyai-4.0.5}/README.md +29 -26
  3. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/__init__.py +1 -1
  4. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/util/common.py +1 -1
  5. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/generators.py +1 -1
  6. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/storage.py +9 -2
  7. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/client/_utils.py +3 -1
  8. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/client/api.py +5 -0
  9. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/client/base.py +12 -1
  10. {mostlyai-4.0.3 → mostlyai-4.0.5}/pyproject.toml +2 -1
  11. {mostlyai-4.0.3 → mostlyai-4.0.5}/.gitignore +0 -0
  12. {mostlyai-4.0.3 → mostlyai-4.0.5}/LICENSE +0 -0
  13. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/__init__.py +0 -0
  14. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/auto_detect.py +0 -0
  15. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/base.py +0 -0
  16. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/context.py +0 -0
  17. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/conversions.py +0 -0
  18. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/db/__init__.py +0 -0
  19. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/db/base.py +0 -0
  20. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/db/bigquery.py +0 -0
  21. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/db/databricks.py +0 -0
  22. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/db/hive.py +0 -0
  23. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/db/mssql.py +0 -0
  24. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/db/mysql.py +0 -0
  25. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/db/oracle.py +0 -0
  26. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/db/postgresql.py +0 -0
  27. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/db/snowflake.py +0 -0
  28. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/db/sqlite.py +0 -0
  29. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
  30. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/dtype.py +0 -0
  31. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/exceptions.py +0 -0
  32. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/__init__.py +0 -0
  33. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/base.py +0 -0
  34. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
  35. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/container/aws.py +0 -0
  36. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/container/azure.py +0 -0
  37. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
  38. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
  39. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/container/minio.py +0 -0
  40. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
  41. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/table/csv.py +0 -0
  42. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/table/feather.py +0 -0
  43. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/table/json.py +0 -0
  44. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
  45. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/file/utils.py +0 -0
  46. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/language_model.py +0 -0
  47. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/metadata_objects.py +0 -0
  48. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/non_context.py +0 -0
  49. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/progress_callback.py +0 -0
  50. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/pull.py +0 -0
  51. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/pull_context.py +0 -0
  52. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/pull_utils.py +0 -0
  53. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/push.py +0 -0
  54. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/util/__init__.py +0 -0
  55. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_data/util/kerberos.py +0 -0
  56. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/__init__.py +0 -0
  57. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/cli.py +0 -0
  58. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/connectors.py +0 -0
  59. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/__init__.py +0 -0
  60. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/jobs.py +0 -0
  61. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/plan.py +0 -0
  62. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +0 -0
  63. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/step_create_data_report.py +0 -0
  64. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/step_create_model_report.py +0 -0
  65. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/step_deliver_data.py +0 -0
  66. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/step_encode_training_data.py +0 -0
  67. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/step_finalize_generation.py +0 -0
  68. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
  69. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/step_generate_data.py +0 -0
  70. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
  71. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/step_pull_training_data.py +0 -0
  72. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/execution/step_train_model.py +0 -0
  73. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/progress.py +0 -0
  74. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/routes.py +0 -0
  75. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/server.py +0 -0
  76. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/_local/synthetic_datasets.py +0 -0
  77. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/client/__init__.py +0 -0
  78. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/client/_base_utils.py +0 -0
  79. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/client/_naming_conventions.py +0 -0
  80. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/client/connectors.py +0 -0
  81. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/client/exceptions.py +0 -0
  82. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/client/generators.py +0 -0
  83. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/client/synthetic_datasets.py +0 -0
  84. {mostlyai-4.0.3 → mostlyai-4.0.5}/mostlyai/sdk/domain.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyai
3
- Version: 4.0.3
3
+ Version: 4.0.5
4
4
  Summary: Synthetic Data SDK
5
5
  Project-URL: homepage, https://app.mostly.ai/
6
6
  Project-URL: repository, https://github.com/mostly-ai/mostlyai
@@ -30,6 +30,7 @@ Requires-Dist: cloudpathlib[azure,gs,s3]<0.18,>=0.17.0
30
30
  Requires-Dist: cryptography<44,>=43.0.1
31
31
  Requires-Dist: environs<10,>=9.5.0
32
32
  Requires-Dist: fastparquet<2024,>=2023.4.0
33
+ Requires-Dist: filelock>=3.16.1
33
34
  Requires-Dist: gcsfs<2024,>=2023.1.0
34
35
  Requires-Dist: gputil<2,>=1.4.0
35
36
  Requires-Dist: greenlet<4,>=3.1.1
@@ -99,13 +100,13 @@ Description-Content-Type: text/markdown
99
100
 
100
101
  # Synthetic Data SDK ✨
101
102
 
102
- [![Documentation](https://img.shields.io/badge/docs-latest-green)](https://mostly-ai.github.io/mostlyai/) [![stats](https://pepy.tech/badge/mostlyai)](https://pypi.org/project/mostlyai/) ![license](https://img.shields.io/github/license/mostly-ai/mostlyai) ![GitHub Release](https://img.shields.io/github/v/release/mostly-ai/mostlyai) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mostlyai)
103
+ [![Documentation](https://img.shields.io/badge/docs-latest-green)](https://mostly-ai.github.io/mostlyai/) [![PyPI Downloads](https://static.pepy.tech/badge/mostlyai)](https://pepy.tech/projects/mostlyai) ![license](https://img.shields.io/github/license/mostly-ai/mostlyai) ![GitHub Release](https://img.shields.io/github/v/release/mostly-ai/mostlyai) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mostlyai) [![GitHub stars](https://img.shields.io/github/stars/mostly-ai/mostlyai?style=social)](https://github.com/mostly-ai/mostlyai)
103
104
 
104
105
  [SDK Documentation](https://mostly-ai.github.io/mostlyai/) | [Platform Documentation](https://mostly.ai/docs) | [Usage Examples](https://mostly-ai.github.io/mostlyai/usage/)
105
106
 
106
- The official SDK of [MOSTLY AI](https://app.mostly.ai/), a Python toolkit for high-fidelity, privacy-safe **Synthetic Data**.
107
+ The Synthetic Data SDK is a Python toolkit for high-fidelity, privacy-safe **Synthetic Data**.
107
108
 
108
- - **Client mode** connects to a remote MOSTLY AI platform for training & generating synthetic data there.
109
+ - **Client mode** connects to a remote [MOSTLY AI platform](https://app.mostly.ai/) for training & generating synthetic data there.
109
110
  - **Local mode** trains and generates synthetic data locally on your own compute resources.
110
111
  - Generators, that were trained locally, can be easily imported to a platform for further sharing.
111
112
 
@@ -150,41 +151,44 @@ E.g.
150
151
  pip install -U 'mostlyai[local, databricks, snowflake]'
151
152
  ```
152
153
 
153
- ## Quick Start
154
+ ## Quick Start [![Run on Colab](https://img.shields.io/badge/Open%20in-Colab-blue?logo=google-colab)](https://colab.research.google.com/github/mostly-ai/mostlyai/blob/main/docs/tutorials/getting-started/getting-started.ipynb)
154
155
 
155
- For client mode, initialize with `base_url` and `api_key` obtained from your [account settings page](https://app.mostly.ai/settings/api-keys). For local mode, initialize the client simply with `local=True`.
156
+ Generate your first samples based on your own trained generator with a few lines of code. For local mode, initialize the SDK with `local=True`. For client mode, initialize the SDK with `base_url` and `api_key` obtained from your [account settings page](https://app.mostly.ai/settings/api-keys).
156
157
 
157
158
  ```python
158
159
  import pandas as pd
159
160
  from mostlyai.sdk import MostlyAI
160
161
 
161
162
  # load original data
162
- repo_url = 'https://github.com/mostly-ai/public-demo-data'
163
- df_original = pd.read_csv(f'{repo_url}/raw/dev/census/census.csv.gz')
163
+ repo_url = "https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev"
164
+ df_original = pd.read_csv(f"{repo_url}/census/census.csv.gz").sample(n=5_000)
164
165
 
165
166
  # initialize the SDK in local or client mode
166
- mostly = MostlyAI(local=True)
167
- # mostly = MostlyAI(base_url='https://app.mostly.ai', api_key='YOUR_API_KEY')
167
+ mostly = MostlyAI(local=True) # local mode
168
+ # mostly = MostlyAI(base_url='xxx', api_key='xxx') # client mode
168
169
 
169
170
  # train a synthetic data generator
170
- g = mostly.train(config={
171
- 'name': 'US Census Income', # name of the generator
172
- 'tables': [{ # provide list of table(s)
173
- 'name': 'census', # name of the table
174
- 'data': df_original, # the original data as pd.DataFrame
175
- 'tabular_model_configuration': { # tabular model configuration (optional)
176
- 'max_training_time': 1, # - limit training time (in minutes)
177
- # model, max_epochs,,.. # further model configurations (optional)
178
- 'differential_privacy': { # differential privacy configuration (optional)
179
- 'max_epsilon': 5.0, # - max epsilon value, used as stopping criterion
180
- 'delta': 1e-5, # - delta value
181
- }
182
- },
183
- # columns, keys, compute,.. # further table configurations (optional)
184
- }]
171
+ g = mostly.train(
172
+ config={
173
+ "name": "US Census Income",
174
+ "tables": [
175
+ {
176
+ "name": "census",
177
+ "data": df_original,
178
+ "tabular_model_configuration": { # tabular model configuration (optional)
179
+ "max_training_time": 1, # - limit training time (in minutes)
180
+ # model, max_epochs,,.. # further model configurations (optional)
181
+ # 'differential_privacy': { # differential privacy configuration (optional)
182
+ # 'max_epsilon': 5.0, # - max epsilon value, used as stopping criterion
183
+ # 'delta': 1e-5, # - delta value
184
+ # }
185
+ },
186
+ # columns, keys, compute,.. # further table configurations (optional)
187
+ }
188
+ ],
185
189
  },
186
- start=True, # start training immediately (default: True)
187
- wait=True, # wait for completion (default: True)
190
+ start=True, # start training immediately (default: True)
191
+ wait=True, # wait for completion (default: True)
188
192
  )
189
193
  ```
190
194
 
@@ -1,13 +1,13 @@
1
1
 
2
2
  # Synthetic Data SDK ✨
3
3
 
4
- [![Documentation](https://img.shields.io/badge/docs-latest-green)](https://mostly-ai.github.io/mostlyai/) [![stats](https://pepy.tech/badge/mostlyai)](https://pypi.org/project/mostlyai/) ![license](https://img.shields.io/github/license/mostly-ai/mostlyai) ![GitHub Release](https://img.shields.io/github/v/release/mostly-ai/mostlyai) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mostlyai)
4
+ [![Documentation](https://img.shields.io/badge/docs-latest-green)](https://mostly-ai.github.io/mostlyai/) [![PyPI Downloads](https://static.pepy.tech/badge/mostlyai)](https://pepy.tech/projects/mostlyai) ![license](https://img.shields.io/github/license/mostly-ai/mostlyai) ![GitHub Release](https://img.shields.io/github/v/release/mostly-ai/mostlyai) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mostlyai) [![GitHub stars](https://img.shields.io/github/stars/mostly-ai/mostlyai?style=social)](https://github.com/mostly-ai/mostlyai)
5
5
 
6
6
  [SDK Documentation](https://mostly-ai.github.io/mostlyai/) | [Platform Documentation](https://mostly.ai/docs) | [Usage Examples](https://mostly-ai.github.io/mostlyai/usage/)
7
7
 
8
- The official SDK of [MOSTLY AI](https://app.mostly.ai/), a Python toolkit for high-fidelity, privacy-safe **Synthetic Data**.
8
+ The Synthetic Data SDK is a Python toolkit for high-fidelity, privacy-safe **Synthetic Data**.
9
9
 
10
- - **Client mode** connects to a remote MOSTLY AI platform for training & generating synthetic data there.
10
+ - **Client mode** connects to a remote [MOSTLY AI platform](https://app.mostly.ai/) for training & generating synthetic data there.
11
11
  - **Local mode** trains and generates synthetic data locally on your own compute resources.
12
12
  - Generators, that were trained locally, can be easily imported to a platform for further sharing.
13
13
 
@@ -52,41 +52,44 @@ E.g.
52
52
  pip install -U 'mostlyai[local, databricks, snowflake]'
53
53
  ```
54
54
 
55
- ## Quick Start
55
+ ## Quick Start [![Run on Colab](https://img.shields.io/badge/Open%20in-Colab-blue?logo=google-colab)](https://colab.research.google.com/github/mostly-ai/mostlyai/blob/main/docs/tutorials/getting-started/getting-started.ipynb)
56
56
 
57
- For client mode, initialize with `base_url` and `api_key` obtained from your [account settings page](https://app.mostly.ai/settings/api-keys). For local mode, initialize the client simply with `local=True`.
57
+ Generate your first samples based on your own trained generator with a few lines of code. For local mode, initialize the SDK with `local=True`. For client mode, initialize the SDK with `base_url` and `api_key` obtained from your [account settings page](https://app.mostly.ai/settings/api-keys).
58
58
 
59
59
  ```python
60
60
  import pandas as pd
61
61
  from mostlyai.sdk import MostlyAI
62
62
 
63
63
  # load original data
64
- repo_url = 'https://github.com/mostly-ai/public-demo-data'
65
- df_original = pd.read_csv(f'{repo_url}/raw/dev/census/census.csv.gz')
64
+ repo_url = "https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev"
65
+ df_original = pd.read_csv(f"{repo_url}/census/census.csv.gz").sample(n=5_000)
66
66
 
67
67
  # initialize the SDK in local or client mode
68
- mostly = MostlyAI(local=True)
69
- # mostly = MostlyAI(base_url='https://app.mostly.ai', api_key='YOUR_API_KEY')
68
+ mostly = MostlyAI(local=True) # local mode
69
+ # mostly = MostlyAI(base_url='xxx', api_key='xxx') # client mode
70
70
 
71
71
  # train a synthetic data generator
72
- g = mostly.train(config={
73
- 'name': 'US Census Income', # name of the generator
74
- 'tables': [{ # provide list of table(s)
75
- 'name': 'census', # name of the table
76
- 'data': df_original, # the original data as pd.DataFrame
77
- 'tabular_model_configuration': { # tabular model configuration (optional)
78
- 'max_training_time': 1, # - limit training time (in minutes)
79
- # model, max_epochs,,.. # further model configurations (optional)
80
- 'differential_privacy': { # differential privacy configuration (optional)
81
- 'max_epsilon': 5.0, # - max epsilon value, used as stopping criterion
82
- 'delta': 1e-5, # - delta value
83
- }
84
- },
85
- # columns, keys, compute,.. # further table configurations (optional)
86
- }]
72
+ g = mostly.train(
73
+ config={
74
+ "name": "US Census Income",
75
+ "tables": [
76
+ {
77
+ "name": "census",
78
+ "data": df_original,
79
+ "tabular_model_configuration": { # tabular model configuration (optional)
80
+ "max_training_time": 1, # - limit training time (in minutes)
81
+ # model, max_epochs,,.. # further model configurations (optional)
82
+ # 'differential_privacy': { # differential privacy configuration (optional)
83
+ # 'max_epsilon': 5.0, # - max epsilon value, used as stopping criterion
84
+ # 'delta': 1e-5, # - delta value
85
+ # }
86
+ },
87
+ # columns, keys, compute,.. # further table configurations (optional)
88
+ }
89
+ ],
87
90
  },
88
- start=True, # start training immediately (default: True)
89
- wait=True, # wait for completion (default: True)
91
+ start=True, # start training immediately (default: True)
92
+ wait=True, # wait for completion (default: True)
90
93
  )
91
94
  ```
92
95
 
@@ -15,4 +15,4 @@
15
15
  from mostlyai.sdk.client.api import MostlyAI
16
16
 
17
17
  __all__ = ["MostlyAI"]
18
- __version__ = "4.0.3" # Do not set this manually. Use poetry version [params].
18
+ __version__ = "4.0.5" # Do not set this manually. Use poetry version [params].
@@ -70,7 +70,7 @@ def create_key(passphrase: str) -> bytes:
70
70
 
71
71
  def get_passphrase() -> str:
72
72
  if _ENV_PASSPHRASE not in os.environ:
73
- _LOG.warning(f"Environment variable `{_ENV_PASSPHRASE}` is not set. Using default passphrase.")
73
+ _LOG.info(f"Environment variable `{_ENV_PASSPHRASE}` is not set. Using default passphrase.")
74
74
  passphrase = os.getenv(_ENV_PASSPHRASE, "mostly-secret")
75
75
  return passphrase
76
76
 
@@ -67,7 +67,7 @@ def create_generator(home_dir: Path, config: GeneratorConfig) -> Generator:
67
67
  "training_status": ProgressStatus.new,
68
68
  "tables": [
69
69
  {
70
- **{k: v for k, v in t.model_dump().items() if k not in ["source_connector_id"]},
70
+ **{k: v for k, v in t.model_dump().items() if k not in ["source_connector_id", "data"]},
71
71
  "source_connector_id": t.source_connector_id,
72
72
  }
73
73
  for t in (config.tables or [])
@@ -18,6 +18,7 @@ import zipfile
18
18
  from io import BytesIO
19
19
 
20
20
  from pydantic import BaseModel
21
+ from filelock import FileLock
21
22
  from mostlyai.sdk.domain import Generator, JobProgress, Connector, SyntheticDataset
22
23
 
23
24
 
@@ -45,7 +46,10 @@ def write_connector_to_json(connector_dir: Path, connector: Connector) -> None:
45
46
 
46
47
  def read_job_progress_from_json(resource_dir: Path) -> JobProgress:
47
48
  progress_file = resource_dir / "job_progress.json"
48
- return JobProgress(**json.loads(progress_file.read_text()))
49
+ lock_file = progress_file.with_suffix(".lock")
50
+ lock = FileLock(lock_file)
51
+ with lock:
52
+ return JobProgress(**json.loads(progress_file.read_text()))
49
53
 
50
54
 
51
55
  def write_job_progress_to_json(resource_dir: Path, job_progress: JobProgress) -> None:
@@ -86,4 +90,7 @@ def write_to_json(file_path: Path, obj: BaseModel) -> None:
86
90
  # serialize with camelCase aliases for platform compatibility
87
91
  by_alias=True,
88
92
  )
89
- file_path.write_text(json_str)
93
+ lock_file = file_path.with_suffix(".lock")
94
+ lock = FileLock(lock_file)
95
+ with lock:
96
+ file_path.write_text(json_str)
@@ -175,7 +175,9 @@ def harmonize_sd_config(
175
175
  size = size if size is not None else {}
176
176
  seed = seed if seed is not None else {}
177
177
 
178
- if isinstance(generator, Generator | GeneratorListItem):
178
+ if isinstance(generator, GeneratorListItem):
179
+ generator = get_generator(generator.id)
180
+ if isinstance(generator, Generator):
179
181
  generator_id = str(generator.id)
180
182
  elif generator is not None:
181
183
  generator_id = str(generator)
@@ -104,6 +104,11 @@ class MostlyAI(_MostlyBaseClient):
104
104
  ssl_verify: bool = True,
105
105
  quiet: bool = False,
106
106
  ):
107
+ import warnings
108
+
109
+ # suppress deprecation warnings, also those stemming from external libs
110
+ warnings.filterwarnings("ignore", category=DeprecationWarning)
111
+
107
112
  if quiet:
108
113
  rich.get_console().quiet = True
109
114
  if local:
@@ -12,6 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  import enum
15
+ import logging
15
16
  import os
16
17
  import sys
17
18
  import warnings
@@ -27,7 +28,7 @@ from typing import (
27
28
 
28
29
  import httpx
29
30
  import rich
30
- from pydantic import BaseModel, ConfigDict, Field
31
+ from pydantic import BaseModel, ConfigDict, Field, model_validator
31
32
  from rich.console import Console
32
33
 
33
34
  from mostlyai.sdk.client.exceptions import APIError, APIStatusError
@@ -36,6 +37,8 @@ from mostlyai.sdk.client._naming_conventions import (
36
37
  map_camel_to_snake_case,
37
38
  )
38
39
 
40
+ _LOG = logging.getLogger(__name__)
41
+
39
42
  GET = "GET"
40
43
  POST = "POST"
41
44
  PATCH = "PATCH"
@@ -242,6 +245,14 @@ class CustomBaseModel(BaseModel):
242
245
  extra_key_values: Annotated[dict | None, Field(exclude=True, repr=False)] = None
243
246
  model_config = ConfigDict(protected_namespaces=(), populate_by_name=True)
244
247
 
248
+ @model_validator(mode="before")
249
+ def __warn_extra_fields__(cls, values):
250
+ extra_fields = values.keys() - cls.model_fields.keys() - {v.alias for v in cls.model_fields.values()}
251
+ if extra_fields:
252
+ _LOG.warning(f"ignoring unrecognized fields for {cls.__name__}: {', '.join(extra_fields)}")
253
+
254
+ return values
255
+
245
256
  def _repr_html_(self):
246
257
  # Use rich.print to create a rich representation of the model
247
258
  console = Console()
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mostlyai"
3
- version = "4.0.3"
3
+ version = "4.0.5"
4
4
  description = "Synthetic Data SDK"
5
5
  authors = [{ name = "MOSTLY AI", email = "dev@mostly.ai" }]
6
6
  requires-python = ">=3.10"
@@ -57,6 +57,7 @@ dependencies = [
57
57
  "smart-open[gcs, s3, azure]>=6.3.0,<7",
58
58
  "azure-storage-blob>=12.16.0,<13",
59
59
  "adlfs>=2023.4.0,<2024",
60
+ "filelock>=3.16.1",
60
61
  ]
61
62
 
62
63
  [project.optional-dependencies]
File without changes
File without changes