multids 0.1.0__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.
multids-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Khaldoun Aljasem
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
multids-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,305 @@
1
+ Metadata-Version: 2.4
2
+ Name: multids
3
+ Version: 0.1.0
4
+ Summary: Async multi-data-source connectors (S3, OpenSearch, Athena, MySQL, SQL Server, local files) with AI hooks.
5
+ License-File: LICENSE
6
+ Author: Khaldoun Aljasem
7
+ Author-email: khaldoun.aljasem@gmail.com
8
+ Requires-Python: >=3.11,<4.0
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Provides-Extra: ai
18
+ Provides-Extra: opensearch
19
+ Provides-Extra: sqlserver
20
+ Requires-Dist: aioboto3 (>=10.0,<11.0)
21
+ Requires-Dist: aiofiles (>=23.1,<24.0)
22
+ Requires-Dist: asyncmy (>=0.2,<0.3)
23
+ Requires-Dist: httpx[http2] (>=0.24.0,<0.25.0) ; extra == "opensearch"
24
+ Requires-Dist: openai (>=1.0,<2.0) ; extra == "ai"
25
+ Requires-Dist: sqlalchemy (>=2.0,<3.0)
26
+ Project-URL: Documentation, https://aljasem-tech.github.io/multids/
27
+ Project-URL: Homepage, https://github.com/aljasem-tech/multids
28
+ Project-URL: Repository, https://github.com/aljasem-tech/multids
29
+ Description-Content-Type: text/markdown
30
+
31
+ # multids
32
+
33
+ <!-- Docs status badge: replace OWNER and REPO with your GitHub owner and repository name -->
34
+ [![Docs Status](https://github.com/aljasem-tech/multids/actions/workflows/docs.yml/badge.svg)](https://aljasem-tech.github.io/multids/)
35
+
36
+ Async multi-data-source connectors for S3, OpenSearch, Athena, MySQL, SQL Server and local files. Provides async
37
+ read/write primitives and pluggable AI hooks.
38
+
39
+ Quick start
40
+
41
+ 1. Create a virtualenv and install:
42
+
43
+ ```powershell
44
+ python -m venv .venv
45
+ .\.venv\Scripts\Activate.ps1
46
+ pip install -e .[ai]
47
+ ```
48
+
49
+ 2. See `examples/basic_usage.py` for a quick demonstration.
50
+
51
+ JSON Support
52
+ ------------
53
+
54
+ `LocalConnector` and `S3Connector` include helper methods for reading and writing JSON with automatic Unicode support (
55
+ no escaping of characters like `你好`).
56
+
57
+ ### Local JSON
58
+
59
+ ```python
60
+ from multids.connectors.local import LocalConnector
61
+
62
+ local = LocalConnector()
63
+ data = {"message": "Hello", "lang": "你好"}
64
+
65
+ # Write JSON (un-escaped unicode)
66
+ await local.write_json(data, "path/to/data.json")
67
+
68
+ # Read JSON
69
+ result = await local.read_json("path/to/data.json")
70
+ print(result)
71
+ ```
72
+
73
+ ### S3 JSON
74
+
75
+ ```python
76
+ from multids.connectors.s3 import S3Connector
77
+
78
+ s3 = S3Connector(aws_region="us-east-1")
79
+ data = {"status": "ok", "info": "مرحبا"}
80
+
81
+ # Upload JSON object
82
+ await s3.write_json(data, bucket="my-bucket", key="status.json")
83
+
84
+ # Download and parse JSON
85
+ result = await s3.read_json(bucket="my-bucket", key="status.json")
86
+ print(result)
87
+ ```
88
+
89
+ S3 multipart example
90
+
91
+ ```powershell
92
+ python examples/s3_multipart_example.py
93
+ ```
94
+
95
+ MySQL bulk insert example
96
+
97
+ ```powershell
98
+ python examples/mysql_bulk_example.py
99
+ ```
100
+
101
+ S3 upload behavior and options
102
+
103
+ - `min_multipart_upload_size` (default: 5 MiB): overall object size threshold before the connector switches from a
104
+ single `PUT` to a multipart upload. The connector buffers the incoming stream and only creates a multipart upload when
105
+ the accumulated bytes reach this threshold. This is useful when you're uploading many small JSON files — they will use
106
+ a single `put_object` unless you exceed the threshold.
107
+ - `part_size` (default: 8 MiB): size of each multipart part once multipart is created.
108
+ - `enforce_min_part_size` (default: False in this library): when enabled, the connector will enforce the AWS minimum
109
+ part size of 5 MiB for `part_size` (prevents creating parts smaller than AWS requires). For typical workloads of many
110
+ small files, the default `False` makes the connector flexible.
111
+ - `force_multipart` (write-time flag, default `False`): pass `force_multipart=True` to `S3Connector.write_stream(...)`to
112
+ force multipart upload even if the total size is below `min_multipart_upload_size`. Use this when you need multipart
113
+ semantics (e.g., resumable uploads across process restarts) for small objects.
114
+
115
+ Examples
116
+
117
+ - Force multipart for a small object (useful for resuming):
118
+
119
+ ```python
120
+ await s3.write_stream(my_small_stream(), bucket="b", key="k", force_multipart=True)
121
+ ```
122
+
123
+ - Normal (default) path: small objects use a single `put_object` and large objects use multipart as needed.
124
+
125
+ Resumable uploads & checkpoints
126
+
127
+ The S3 connector supports simple checkpointing to make multipart uploads resumable across process restarts. When you
128
+ provide a `checkpoint_path` to `write_stream`, the connector writes a small JSON file containing the upload metadata as
129
+ parts complete. If a failure or process stop occurs you can call `write_stream(..., resume=True, checkpoint_path=...)`
130
+ to attempt a resume.
131
+
132
+ Checkpoint format (JSON):
133
+
134
+ ```json
135
+ {
136
+ "bucket": "my-bucket",
137
+ "key": "path/to/object",
138
+ "upload_id": "<aws-upload-id>",
139
+ "parts": [
140
+ {
141
+ "PartNumber": 1,
142
+ "ETag": "...",
143
+ "size": 5242880
144
+ },
145
+ {
146
+ "PartNumber": 2,
147
+ "ETag": "...",
148
+ "size": 5242880
149
+ }
150
+ ]
151
+ }
152
+ ```
153
+
154
+ How it works:
155
+
156
+ - While uploading parts, the connector will save the checkpoint file (if `checkpoint_path` is provided) after each part
157
+ completes. The checkpoint includes the `upload_id` and the parts uploaded so far.
158
+ - If an upload is interrupted, re-running `write_stream` with `resume=True` and the same `checkpoint_path` will attempt
159
+ to list existing parts from S3 using the `upload_id` and continue uploading remaining parts. If listing parts fails,
160
+ the connector will fall back to the parts recorded in the checkpoint file.
161
+ - On successful completion the checkpoint file is removed.
162
+
163
+ Resume example (simplified):
164
+
165
+ ```python
166
+ async def upload_with_resume():
167
+ conn = S3Connector(part_size=5 * 1024 * 1024)
168
+ chk = "/tmp/uploads/my-object.chk"
169
+
170
+ async def small_stream():
171
+ # imagine this yields many small chunks and we want resumable semantics
172
+ for _ in range(100):
173
+ yield b"{" + b' ' * 1024 + b"}\n"
174
+
175
+ # First attempt: force multipart so we have a resumable upload
176
+ await conn.write_stream(
177
+ small_stream(),
178
+ bucket="my-bucket",
179
+ key="my-object.json",
180
+ checkpoint_path=chk,
181
+ force_multipart=True,
182
+ )
183
+
184
+ # If the process were interrupted before completion, re-run and resume:
185
+ await conn.write_stream(
186
+ small_stream(), bucket="my-bucket", key="my-object.json", checkpoint_path=chk, resume=True
187
+ )
188
+
189
+ await conn.close()
190
+
191
+
192
+ asyncio.run(upload_with_resume())
193
+ ```
194
+
195
+ SQL Server connector
196
+
197
+ The project includes an async `MSSQLConnector` implemented with `aioodbc` (ODBC). Notes:
198
+
199
+ - System requirement: install a SQL Server ODBC driver on your host (e.g. Microsoft ODBC Driver for SQL Server).
200
+ - Install the optional `sqlserver` extras to get the Python runtime dependency:
201
+
202
+ ```powershell
203
+ pip install -e .[sqlserver]
204
+ ```
205
+
206
+ Quick example (using a pool):
207
+
208
+ ```python
209
+ from multids.connectors.mssql import MSSQLConnector
210
+
211
+
212
+ async def example():
213
+ conn = MSSQLConnector()
214
+ # either set connection options on the connector and call connect_pool(), or
215
+ # configure a DSN and call connect_pool()
216
+ await conn.connect_pool()
217
+ rows = await conn.fetch_rows("SELECT id, name FROM users")
218
+ await conn.close()
219
+
220
+ ```
221
+
222
+ OpenSearch connector
223
+
224
+ `OpenSearchConnector` is an async, httpx-based helper for indexing and searching documents in OpenSearch/Elasticsearch.
225
+
226
+ Examples
227
+
228
+ ```python
229
+ from multids.connectors.opensearch import OpenSearchConnector
230
+
231
+ oc = OpenSearchConnector("http://localhost:9200", api_key="<api-key>")
232
+
233
+ # Index a single document
234
+ await oc.index_doc("my-index", {"name": "alice"})
235
+
236
+ # Bulk index (sync iterable)
237
+ docs = [{"id": 1, "name": "a"}, {"id": 2, "name": "b"}]
238
+ await oc.bulk_index("my-index", docs, chunk_size=100)
239
+
240
+ # Bulk index with id field + routing field
241
+ await oc.bulk_index("my-index", docs, chunk_size=100)
242
+
243
+ # Search / scroll
244
+ res = await oc.search("my-index", {"query": {"match_all": {}}}, size=10)
245
+ async for hit in oc.scroll("my-index", {"query": {"match_all": {}}}):
246
+ print(hit)
247
+
248
+ await oc.close()
249
+ ```
250
+
251
+ Advanced OpenSearch examples
252
+
253
+ Indexing with explicit IDs and routing:
254
+
255
+ ```python
256
+ docs = [
257
+ {"id": "user-1", "name": "alice", "org": "org1"},
258
+ {"id": "user-2", "name": "bob", "org": "org2"},
259
+ ]
260
+ await oc.bulk_index("my-index", docs, chunk_size=100)
261
+
262
+ # If you want to use a field as _id and also set routing based on another field:
263
+ await oc.bulk_index("my-index", docs, chunk_size=100)
264
+
265
+ # Or use build_bulk_ndjson directly with id_field/routing_field support
266
+ async for chunk in OpenSearchConnector.build_bulk_ndjson(docs, index="my-index", id_field="id", routing_field="org"):
267
+ await oc._request("POST", "/_bulk", content=chunk)
268
+ ```
269
+
270
+ Authentication examples
271
+
272
+ API key (preferred for service-to-service):
273
+
274
+ ```python
275
+ oc = OpenSearchConnector("https://es.example.com", api_key="BASE64_APIKEY")
276
+ await oc.index_doc("idx", {"name": "s1"})
277
+ ```
278
+
279
+ HTTP Basic (username/password):
280
+
281
+ ```python
282
+ oc = OpenSearchConnector("https://es.example.com", basic_auth=("user", "pass"))
283
+ await oc.search("idx", {"query": {"match_all": {}}})
284
+ ```
285
+
286
+ Installation note
287
+
288
+ If you only need the OpenSearch functionality (and want to avoid installing `httpx` by default), install the optional
289
+ extra:
290
+
291
+ ```powershell
292
+ pip install -e .[opensearch]
293
+ ```
294
+
295
+ Integration tests
296
+
297
+ We include an optional integration test suite which can run against a real OpenSearch instance. In CI, we start a local
298
+ OpenSearch service and run tests under `tests/integration/`. Locally you can run integration tests by setting
299
+ `OPENSEARCH_URL` to your instance and running:
300
+
301
+ ```pwsh
302
+ $env:OPENSEARCH_URL = 'http://localhost:9200'
303
+ pytest tests/integration -q
304
+ ```
305
+
@@ -0,0 +1,274 @@
1
+ # multids
2
+
3
+ <!-- Docs status badge: replace OWNER and REPO with your GitHub owner and repository name -->
4
+ [![Docs Status](https://github.com/aljasem-tech/multids/actions/workflows/docs.yml/badge.svg)](https://aljasem-tech.github.io/multids/)
5
+
6
+ Async multi-data-source connectors for S3, OpenSearch, Athena, MySQL, SQL Server and local files. Provides async
7
+ read/write primitives and pluggable AI hooks.
8
+
9
+ Quick start
10
+
11
+ 1. Create a virtualenv and install:
12
+
13
+ ```powershell
14
+ python -m venv .venv
15
+ .\.venv\Scripts\Activate.ps1
16
+ pip install -e .[ai]
17
+ ```
18
+
19
+ 2. See `examples/basic_usage.py` for a quick demonstration.
20
+
21
+ JSON Support
22
+ ------------
23
+
24
+ `LocalConnector` and `S3Connector` include helper methods for reading and writing JSON with automatic Unicode support (
25
+ no escaping of characters like `你好`).
26
+
27
+ ### Local JSON
28
+
29
+ ```python
30
+ from multids.connectors.local import LocalConnector
31
+
32
+ local = LocalConnector()
33
+ data = {"message": "Hello", "lang": "你好"}
34
+
35
+ # Write JSON (un-escaped unicode)
36
+ await local.write_json(data, "path/to/data.json")
37
+
38
+ # Read JSON
39
+ result = await local.read_json("path/to/data.json")
40
+ print(result)
41
+ ```
42
+
43
+ ### S3 JSON
44
+
45
+ ```python
46
+ from multids.connectors.s3 import S3Connector
47
+
48
+ s3 = S3Connector(aws_region="us-east-1")
49
+ data = {"status": "ok", "info": "مرحبا"}
50
+
51
+ # Upload JSON object
52
+ await s3.write_json(data, bucket="my-bucket", key="status.json")
53
+
54
+ # Download and parse JSON
55
+ result = await s3.read_json(bucket="my-bucket", key="status.json")
56
+ print(result)
57
+ ```
58
+
59
+ S3 multipart example
60
+
61
+ ```powershell
62
+ python examples/s3_multipart_example.py
63
+ ```
64
+
65
+ MySQL bulk insert example
66
+
67
+ ```powershell
68
+ python examples/mysql_bulk_example.py
69
+ ```
70
+
71
+ S3 upload behavior and options
72
+
73
+ - `min_multipart_upload_size` (default: 5 MiB): overall object size threshold before the connector switches from a
74
+ single `PUT` to a multipart upload. The connector buffers the incoming stream and only creates a multipart upload when
75
+ the accumulated bytes reach this threshold. This is useful when you're uploading many small JSON files — they will use
76
+ a single `put_object` unless you exceed the threshold.
77
+ - `part_size` (default: 8 MiB): size of each multipart part once multipart is created.
78
+ - `enforce_min_part_size` (default: False in this library): when enabled, the connector will enforce the AWS minimum
79
+ part size of 5 MiB for `part_size` (prevents creating parts smaller than AWS requires). For typical workloads of many
80
+ small files, the default `False` makes the connector flexible.
81
+ - `force_multipart` (write-time flag, default `False`): pass `force_multipart=True` to `S3Connector.write_stream(...)`to
82
+ force multipart upload even if the total size is below `min_multipart_upload_size`. Use this when you need multipart
83
+ semantics (e.g., resumable uploads across process restarts) for small objects.
84
+
85
+ Examples
86
+
87
+ - Force multipart for a small object (useful for resuming):
88
+
89
+ ```python
90
+ await s3.write_stream(my_small_stream(), bucket="b", key="k", force_multipart=True)
91
+ ```
92
+
93
+ - Normal (default) path: small objects use a single `put_object` and large objects use multipart as needed.
94
+
95
+ Resumable uploads & checkpoints
96
+
97
+ The S3 connector supports simple checkpointing to make multipart uploads resumable across process restarts. When you
98
+ provide a `checkpoint_path` to `write_stream`, the connector writes a small JSON file containing the upload metadata as
99
+ parts complete. If a failure or process stop occurs you can call `write_stream(..., resume=True, checkpoint_path=...)`
100
+ to attempt a resume.
101
+
102
+ Checkpoint format (JSON):
103
+
104
+ ```json
105
+ {
106
+ "bucket": "my-bucket",
107
+ "key": "path/to/object",
108
+ "upload_id": "<aws-upload-id>",
109
+ "parts": [
110
+ {
111
+ "PartNumber": 1,
112
+ "ETag": "...",
113
+ "size": 5242880
114
+ },
115
+ {
116
+ "PartNumber": 2,
117
+ "ETag": "...",
118
+ "size": 5242880
119
+ }
120
+ ]
121
+ }
122
+ ```
123
+
124
+ How it works:
125
+
126
+ - While uploading parts, the connector will save the checkpoint file (if `checkpoint_path` is provided) after each part
127
+ completes. The checkpoint includes the `upload_id` and the parts uploaded so far.
128
+ - If an upload is interrupted, re-running `write_stream` with `resume=True` and the same `checkpoint_path` will attempt
129
+ to list existing parts from S3 using the `upload_id` and continue uploading remaining parts. If listing parts fails,
130
+ the connector will fall back to the parts recorded in the checkpoint file.
131
+ - On successful completion the checkpoint file is removed.
132
+
133
+ Resume example (simplified):
134
+
135
+ ```python
136
+ async def upload_with_resume():
137
+ conn = S3Connector(part_size=5 * 1024 * 1024)
138
+ chk = "/tmp/uploads/my-object.chk"
139
+
140
+ async def small_stream():
141
+ # imagine this yields many small chunks and we want resumable semantics
142
+ for _ in range(100):
143
+ yield b"{" + b' ' * 1024 + b"}\n"
144
+
145
+ # First attempt: force multipart so we have a resumable upload
146
+ await conn.write_stream(
147
+ small_stream(),
148
+ bucket="my-bucket",
149
+ key="my-object.json",
150
+ checkpoint_path=chk,
151
+ force_multipart=True,
152
+ )
153
+
154
+ # If the process were interrupted before completion, re-run and resume:
155
+ await conn.write_stream(
156
+ small_stream(), bucket="my-bucket", key="my-object.json", checkpoint_path=chk, resume=True
157
+ )
158
+
159
+ await conn.close()
160
+
161
+
162
+ asyncio.run(upload_with_resume())
163
+ ```
164
+
165
+ SQL Server connector
166
+
167
+ The project includes an async `MSSQLConnector` implemented with `aioodbc` (ODBC). Notes:
168
+
169
+ - System requirement: install a SQL Server ODBC driver on your host (e.g. Microsoft ODBC Driver for SQL Server).
170
+ - Install the optional `sqlserver` extras to get the Python runtime dependency:
171
+
172
+ ```powershell
173
+ pip install -e .[sqlserver]
174
+ ```
175
+
176
+ Quick example (using a pool):
177
+
178
+ ```python
179
+ from multids.connectors.mssql import MSSQLConnector
180
+
181
+
182
+ async def example():
183
+ conn = MSSQLConnector()
184
+ # either set connection options on the connector and call connect_pool(), or
185
+ # configure a DSN and call connect_pool()
186
+ await conn.connect_pool()
187
+ rows = await conn.fetch_rows("SELECT id, name FROM users")
188
+ await conn.close()
189
+
190
+ ```
191
+
192
+ OpenSearch connector
193
+
194
+ `OpenSearchConnector` is an async, httpx-based helper for indexing and searching documents in OpenSearch/Elasticsearch.
195
+
196
+ Examples
197
+
198
+ ```python
199
+ from multids.connectors.opensearch import OpenSearchConnector
200
+
201
+ oc = OpenSearchConnector("http://localhost:9200", api_key="<api-key>")
202
+
203
+ # Index a single document
204
+ await oc.index_doc("my-index", {"name": "alice"})
205
+
206
+ # Bulk index (sync iterable)
207
+ docs = [{"id": 1, "name": "a"}, {"id": 2, "name": "b"}]
208
+ await oc.bulk_index("my-index", docs, chunk_size=100)
209
+
210
+ # Bulk index with id field + routing field
211
+ await oc.bulk_index("my-index", docs, chunk_size=100)
212
+
213
+ # Search / scroll
214
+ res = await oc.search("my-index", {"query": {"match_all": {}}}, size=10)
215
+ async for hit in oc.scroll("my-index", {"query": {"match_all": {}}}):
216
+ print(hit)
217
+
218
+ await oc.close()
219
+ ```
220
+
221
+ Advanced OpenSearch examples
222
+
223
+ Indexing with explicit IDs and routing:
224
+
225
+ ```python
226
+ docs = [
227
+ {"id": "user-1", "name": "alice", "org": "org1"},
228
+ {"id": "user-2", "name": "bob", "org": "org2"},
229
+ ]
230
+ await oc.bulk_index("my-index", docs, chunk_size=100)
231
+
232
+ # If you want to use a field as _id and also set routing based on another field:
233
+ await oc.bulk_index("my-index", docs, chunk_size=100)
234
+
235
+ # Or use build_bulk_ndjson directly with id_field/routing_field support
236
+ async for chunk in OpenSearchConnector.build_bulk_ndjson(docs, index="my-index", id_field="id", routing_field="org"):
237
+ await oc._request("POST", "/_bulk", content=chunk)
238
+ ```
239
+
240
+ Authentication examples
241
+
242
+ API key (preferred for service-to-service):
243
+
244
+ ```python
245
+ oc = OpenSearchConnector("https://es.example.com", api_key="BASE64_APIKEY")
246
+ await oc.index_doc("idx", {"name": "s1"})
247
+ ```
248
+
249
+ HTTP Basic (username/password):
250
+
251
+ ```python
252
+ oc = OpenSearchConnector("https://es.example.com", basic_auth=("user", "pass"))
253
+ await oc.search("idx", {"query": {"match_all": {}}})
254
+ ```
255
+
256
+ Installation note
257
+
258
+ If you only need the OpenSearch functionality (and want to avoid installing `httpx` by default), install the optional
259
+ extra:
260
+
261
+ ```powershell
262
+ pip install -e .[opensearch]
263
+ ```
264
+
265
+ Integration tests
266
+
267
+ We include an optional integration test suite which can run against a real OpenSearch instance. In CI, we start a local
268
+ OpenSearch service and run tests under `tests/integration/`. Locally you can run integration tests by setting
269
+ `OPENSEARCH_URL` to your instance and running:
270
+
271
+ ```pwsh
272
+ $env:OPENSEARCH_URL = 'http://localhost:9200'
273
+ pytest tests/integration -q
274
+ ```
@@ -0,0 +1,57 @@
1
+ [tool.poetry]
2
+ name = "multids"
3
+ version = "0.1.0"
4
+ description = "Async multi-data-source connectors (S3, OpenSearch, Athena, MySQL, SQL Server, local files) with AI hooks."
5
+ authors = ["Khaldoun Aljasem <khaldoun.aljasem@gmail.com>"]
6
+ readme = "README.md"
7
+ repository = "https://github.com/aljasem-tech/multids"
8
+ homepage = "https://github.com/aljasem-tech/multids"
9
+ documentation = "https://aljasem-tech.github.io/multids/"
10
+ classifiers = [
11
+ "Development Status :: 4 - Beta",
12
+ "Intended Audience :: Developers",
13
+ "License :: OSI Approved :: MIT License",
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ ]
18
+ packages = [
19
+ { include = "multids", from = "src" }
20
+ ]
21
+
22
+ [tool.poetry.dependencies]
23
+ python = "^3.11"
24
+ aioboto3 = "^10.0"
25
+ sqlalchemy = "^2.0"
26
+ asyncmy = "^0.2"
27
+ aiofiles = "^23.1"
28
+ openai = { version = "^1.0", optional = true }
29
+ httpx = { version = "^0.24.0", extras = ["http2"], optional = true }
30
+
31
+ [tool.poetry.extras]
32
+ ai = ["openai"]
33
+ sqlserver = ["aioodbc"]
34
+ opensearch = ["httpx"]
35
+
36
+ [tool.poetry.group.dev.dependencies]
37
+ pytest = "^7.4"
38
+ pytest-asyncio = "^0.19"
39
+ black = "^24.1"
40
+ ruff = "^0.12"
41
+ isort = "^5.12"
42
+ pre-commit = "^4.4"
43
+
44
+ [build-system]
45
+ requires = ["poetry-core>=1.5.0"]
46
+ build-backend = "poetry.core.masonry.api"
47
+
48
+ [tool.black]
49
+ line-length = 119
50
+
51
+ [tool.ruff]
52
+ line-length = 119
53
+ select = ["E", "F", "W", "C90", "N"]
54
+
55
+ [tool.isort]
56
+ profile = "black"
57
+ line_length = 119
@@ -0,0 +1,6 @@
1
+ """multids package"""
2
+
3
+ __all__ = ["interfaces", "connectors", "ai"]
4
+ __version__ = "0.1.0"
5
+
6
+ from . import interfaces # re-exported for convenience
@@ -0,0 +1,18 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any, Dict, Protocol
4
+
5
+
6
+ class AIClientInterface(Protocol):
7
+ async def generate(self, prompt: str, **kwargs: Any) -> Dict[str, Any]:
8
+ """Generate a response for the given prompt."""
9
+
10
+
11
+ class OpenAIClient:
12
+ def __init__(self, client):
13
+ # client: an `openai` async-compatible client or wrapper
14
+ self._client = client
15
+
16
+ async def generate(self, prompt: str, **kwargs: Any) -> Dict[str, Any]:
17
+ # Implementation will depend on the chosen AI provider.
18
+ return await self._client.create(prompt=prompt, **kwargs)