ol-datastar 0.0.19__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 (56) hide show
  1. ol_datastar-0.0.19/MANIFEST.in +11 -0
  2. ol_datastar-0.0.19/PKG-INFO +631 -0
  3. ol_datastar-0.0.19/datastar/__init__.py +52 -0
  4. ol_datastar-0.0.19/datastar/_defaults.py +6 -0
  5. ol_datastar-0.0.19/datastar/_version.py +3 -0
  6. ol_datastar-0.0.19/datastar/connection.py +229 -0
  7. ol_datastar-0.0.19/datastar/connection_registry.py +20 -0
  8. ol_datastar-0.0.19/datastar/connections/__init__.py +15 -0
  9. ol_datastar-0.0.19/datastar/connections/delimited_connection.py +53 -0
  10. ol_datastar-0.0.19/datastar/connections/excel_connection.py +56 -0
  11. ol_datastar-0.0.19/datastar/connections/frog_model_connection.py +44 -0
  12. ol_datastar-0.0.19/datastar/connections/opti_connection.py +48 -0
  13. ol_datastar-0.0.19/datastar/connections/sandbox_connection.py +183 -0
  14. ol_datastar-0.0.19/datastar/datastar_api.py +625 -0
  15. ol_datastar-0.0.19/datastar/frog_platform.py +67 -0
  16. ol_datastar-0.0.19/datastar/macro.py +504 -0
  17. ol_datastar-0.0.19/datastar/project.py +182 -0
  18. ol_datastar-0.0.19/datastar/py.typed +1 -0
  19. ol_datastar-0.0.19/datastar/task.py +344 -0
  20. ol_datastar-0.0.19/datastar/task_registry.py +23 -0
  21. ol_datastar-0.0.19/datastar/tasks/__init__.py +13 -0
  22. ol_datastar-0.0.19/datastar/tasks/task_export.py +201 -0
  23. ol_datastar-0.0.19/datastar/tasks/task_import.py +179 -0
  24. ol_datastar-0.0.19/datastar/tasks/task_run_python.py +72 -0
  25. ol_datastar-0.0.19/datastar/tasks/task_run_sql.py +84 -0
  26. ol_datastar-0.0.19/datastar/tasks/task_start.py +41 -0
  27. ol_datastar-0.0.19/docs/README +34 -0
  28. ol_datastar-0.0.19/docs/datastar.md +603 -0
  29. ol_datastar-0.0.19/docs/datastar.pdf +0 -0
  30. ol_datastar-0.0.19/docs/datastar_lib.jpg +0 -0
  31. ol_datastar-0.0.19/docs/examples/work_with_connections.py +82 -0
  32. ol_datastar-0.0.19/docs/examples/work_with_macros.py +90 -0
  33. ol_datastar-0.0.19/docs/examples/work_with_projects.py +51 -0
  34. ol_datastar-0.0.19/docs/examples/work_with_sandbox.py +30 -0
  35. ol_datastar-0.0.19/docs/examples/work_with_tasks.py +83 -0
  36. ol_datastar-0.0.19/docs/tooltip.png +0 -0
  37. ol_datastar-0.0.19/ol_datastar.egg-info/PKG-INFO +631 -0
  38. ol_datastar-0.0.19/ol_datastar.egg-info/SOURCES.txt +54 -0
  39. ol_datastar-0.0.19/ol_datastar.egg-info/dependency_links.txt +1 -0
  40. ol_datastar-0.0.19/ol_datastar.egg-info/requires.txt +6 -0
  41. ol_datastar-0.0.19/ol_datastar.egg-info/top_level.txt +1 -0
  42. ol_datastar-0.0.19/pyproject.toml +7 -0
  43. ol_datastar-0.0.19/setup.cfg +4 -0
  44. ol_datastar-0.0.19/setup.py +79 -0
  45. ol_datastar-0.0.19/tests/test_connection_public.py +96 -0
  46. ol_datastar-0.0.19/tests/test_fields_pass_through.py +104 -0
  47. ol_datastar-0.0.19/tests/test_get_connection.py +92 -0
  48. ol_datastar-0.0.19/tests/test_macro_add_tasks.py +74 -0
  49. ol_datastar-0.0.19/tests/test_macro_clone.py +276 -0
  50. ol_datastar-0.0.19/tests/test_macro_export.py +122 -0
  51. ol_datastar-0.0.19/tests/test_macro_public.py +227 -0
  52. ol_datastar-0.0.19/tests/test_project_public.py +102 -0
  53. ol_datastar-0.0.19/tests/test_task_json_contract.py +157 -0
  54. ol_datastar-0.0.19/tests/test_task_public.py +188 -0
  55. ol_datastar-0.0.19/tests/test_task_read.py +45 -0
  56. ol_datastar-0.0.19/tests/test_task_roundtrip.py +145 -0
@@ -0,0 +1,11 @@
1
+ include docs/README
2
+ include docs/datastar.md
3
+ include docs/datastar.pdf
4
+ include docs/datastar_lib.jpg
5
+ include docs/tooltip.png
6
+
7
+ include docs/examples/work_with_connections.py
8
+ include docs/examples/work_with_sandbox.py
9
+ include docs/examples/work_with_macros.py
10
+ include docs/examples/work_with_projects.py
11
+ include docs/examples/work_with_tasks.py
@@ -0,0 +1,631 @@
1
+ Metadata-Version: 2.4
2
+ Name: ol_datastar
3
+ Version: 0.0.19
4
+ Summary: Helpful utilities for working with Datastar projects
5
+ Home-page: https://cosmicfrog.com
6
+ Author: Optilogic
7
+ License: MIT
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.11
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: optilogic>=2.13.0
14
+ Requires-Dist: PyJWT>=2.8.0
15
+ Requires-Dist: requests>=2.31.0
16
+ Requires-Dist: pandas>=2.0.0
17
+ Requires-Dist: SQLAlchemy>=2.0.0
18
+ Requires-Dist: psycopg2-binary>=2.9.9
19
+ Dynamic: author
20
+ Dynamic: classifier
21
+ Dynamic: description
22
+ Dynamic: description-content-type
23
+ Dynamic: home-page
24
+ Dynamic: license
25
+ Dynamic: requires-dist
26
+ Dynamic: requires-python
27
+ Dynamic: summary
28
+
29
+ # Datastar Python Library
30
+
31
+ ![Datastar Python Library](datastar_lib.jpg)
32
+
33
+ <style>
34
+ /* Prevent code samples from being split across PDF pages */
35
+ pre, code {
36
+ page-break-inside: avoid;
37
+ }
38
+ </style>
39
+
40
+ <div style="page-break-after: always;"></div>
41
+
42
+ ## Table of Contents
43
+
44
+ - [Description](#description)
45
+ - [Use cases](#use-cases)
46
+ - [Installation](#installation)
47
+ - [Authentication](#authentication)
48
+ - [Running on the Optilogic platform](#running-on-the-optilogic-platform)
49
+ - [Working on the desktop](#working-on-the-desktop)
50
+ - [Working with the library](#working-with-the-library)
51
+ - [Projects](#projects)
52
+ - [Macros](#macros)
53
+ - [Tasks](#tasks)
54
+ - [Joining tasks together](#joining-tasks-together)
55
+ - [Task types](#task-types)
56
+ - [Connections](#connections)
57
+ - [Sandbox access with pandas](#sandbox-access-with-pandas)
58
+ - [Example end‑to‑end flow](#example-end-to-end-flow)
59
+
60
+ <div style="page-break-after: always;"></div>
61
+
62
+ ## Description
63
+
64
+ This library provides helper functions for working with projects and data in Optilogic Datastar.
65
+
66
+ The following documentation explains how to authenticate, connect to Datastar projects, and use high‑level helpers for macros, tasks, and connections to build your own workflows with minimal boilerplate.
67
+
68
+ <div style="page-break-after: always;"></div>
69
+
70
+ ## Use cases
71
+
72
+ The purpose of the library is to simplify creating and managing Datastar projects, defining macros composed of tasks, and moving data between sources and destinations. Typical objectives include:
73
+
74
+ - Connect to your own data sources.
75
+ - Build macros programmatically with import/export, SQL, and Python tasks.
76
+ - Chain tasks, then run and monitor macro executions.
77
+ - Read from and write to the project sandbox using pandas.
78
+
79
+ Some simple code examples show the python interface:
80
+
81
+ ### Connect to an existing project by name:
82
+
83
+ ```python
84
+ from datastar import *
85
+ from datastar import Task
86
+
87
+ project = Project.connect_to("My Existing Project")
88
+ ```
89
+
90
+ ### List your projects:
91
+
92
+ ```python
93
+ from datastar import *
94
+
95
+ project_names = Project.get_projects()
96
+ print(project_names)
97
+ ```
98
+
99
+ ### Create a new project:
100
+
101
+ ```python
102
+ from datastar import *
103
+
104
+ project = Project.create("My New Project", description="Example project")
105
+ ```
106
+
107
+ <div style="page-break-after: always;"></div>
108
+
109
+ ## Installation
110
+
111
+ Install via pip:
112
+
113
+ ```bash
114
+ pip install ol-datastar
115
+ ```
116
+
117
+ Import the high‑level interfaces:
118
+
119
+ ```python
120
+ from datastar import *
121
+ ```
122
+
123
+ ### Authentication
124
+
125
+ Datastar requires an App Key for API access.
126
+
127
+ ### Running on the Optilogic platform
128
+
129
+ When your code runs on the Optilogic platform, your credentials are auto‑detected. Simply import and use the library:
130
+
131
+ ```python
132
+ from datastar import *
133
+
134
+ project = Project.connect_to("My Existing Project")
135
+ ```
136
+
137
+ ### Working on the desktop
138
+
139
+ When running locally, place your App Key in a file named `app.key` in the same directory as your script. The library reads this file automatically:
140
+
141
+ 1. Create an App Key in the UI: https://optilogic.app/#/user-account?tab=appkey
142
+ 2. Copy the key and paste it into a file called `app.key` next to your script.
143
+ 3. Run your script as normal.
144
+
145
+ ```text
146
+ my_script.py
147
+ app.key
148
+ ```
149
+
150
+ > Warning: Keep App Keys secure. Do not commit `app.key` to source control or share it publicly.
151
+
152
+ <div style="page-break-after: always;"></div>
153
+
154
+ ### Working with the library
155
+
156
+ The library aims to be concise and discoverable. Most editors show tooltips for arguments and return types:
157
+
158
+ ![Tooltips where editor supported](tooltip.png)
159
+
160
+ ## Projects
161
+
162
+ Projects are the top‑level container for your macros and connections.
163
+
164
+ List all accessible projects:
165
+
166
+ ```python
167
+ from datastar import *
168
+
169
+ names = Project.get_projects()
170
+ print(names)
171
+ ```
172
+
173
+ Connect to an existing project by name:
174
+
175
+ ```python
176
+ from datastar import *
177
+
178
+ project = Project.connect_to("My Existing Project")
179
+ ```
180
+
181
+ Create a new project (optionally with a description):
182
+
183
+ ```python
184
+ from datastar import *
185
+
186
+ project = Project.create("My New Project", description="Example project")
187
+ ```
188
+ <div style="page-break-after: always;"></div>
189
+
190
+ Rename and update a project:
191
+
192
+ ```python
193
+ from datastar import *
194
+
195
+ project = Project.connect_to("My Existing Project")
196
+ project.name = "Updated name"
197
+ project.description = "Updated description"
198
+ project.save()
199
+ ```
200
+
201
+ Delete a project:
202
+
203
+ ```python
204
+ from datastar import *
205
+
206
+ project = Project.connect_to("My Existing Project")
207
+ project.delete()
208
+ ```
209
+
210
+ ## Macros
211
+
212
+ Macros are workflows composed of ordered tasks.
213
+
214
+ Add a new macro to a project:
215
+
216
+ ```python
217
+ from datastar import *
218
+
219
+ project = project.connect_to("My project")
220
+
221
+ macro = project.add_macro(name="load_and_process", description="ETL pipeline")
222
+
223
+ ```
224
+
225
+ Get a list of macro names in a project:
226
+
227
+ ```python
228
+ from datastar import *
229
+
230
+ project = project.connect_to("My project")
231
+ macro_names = project.get_macros()
232
+ print(macro_names)
233
+ ```
234
+ <div style="page-break-after: always;"></div>
235
+
236
+ Get an existing macro in a project:
237
+
238
+ ```python
239
+ from datastar import *
240
+
241
+ project = project.connect_to("My project")
242
+ macro = project.get_macro("load_and_process")
243
+ ```
244
+
245
+ Delete a macro, from a project:
246
+
247
+ ```python
248
+ from datastar import *
249
+
250
+ project = project.connect_to("My project")
251
+
252
+ project.delete_macro("old_macro")
253
+ ```
254
+
255
+ Delete a macro (alternative, from macro):
256
+
257
+ ```python
258
+ from datastar import *
259
+
260
+ project = project.connect_to("My project")
261
+ macro = project.get_macro("load_and_process")
262
+ macro.delete()
263
+ ```
264
+
265
+ Change macro name or description
266
+
267
+ ```python
268
+ from datastar import *
269
+
270
+ project = project.connect_to("My project")
271
+ macro = project.get_macro("load_and_process")
272
+ macro.name = "pipeline"
273
+ macro.description = "Daily ETL"
274
+ macro.save()
275
+ ```
276
+
277
+ <div style="page-break-after: always;"></div>
278
+
279
+ ### Copying tasks between macros
280
+
281
+ You can copy an existing task either within the same macro or into a different macro. Use `macro.add_task(existing_task, ...)`:
282
+
283
+ ```python
284
+ from datastar import *
285
+
286
+ project = Project.connect_to("My project")
287
+ macro = project.get_macro("load_and_process")
288
+
289
+ # Suppose sql_task is an existing task in this macro
290
+ sql_task = macro.add_run_sql_task(
291
+ name="cleanup",
292
+ connection=project.get_sandbox(),
293
+ query="DELETE FROM t WHERE id IS NULL",
294
+ )
295
+
296
+ # 1) Copy the task within the same macro
297
+ # The library creates a new task with name suffixed by "(copy)"
298
+ sql_task_copy_same = macro.add_task(sql_task)
299
+
300
+ # 2) Copy the task into a different macro in the same project
301
+ target_macro = project.add_macro("copy_target")
302
+ sql_task_copy_other = target_macro.add_task(sql_task)
303
+
304
+ # Optional: control joining behavior
305
+ # - auto_join=True chains after the last task added to the target macro
306
+ # - or specify previous_task to connect explicitly
307
+ start_task = target_macro.get_task(Task.START_NAME)
308
+ explicit_copy = target_macro.add_task(sql_task, auto_join=False, previous_task=start_task)
309
+ ```
310
+
311
+ Notes:
312
+ - The original task is never modified; a new task is created in the target macro.
313
+ - When copying within the same macro, the new task name is automatically suffixed with "(copy)" to avoid collisions.
314
+
315
+ ### Cloning macros
316
+
317
+ Clone an entire macro (all non‑Start tasks and their dependencies) either within the same project or into a different project using `macro.clone(...)`:
318
+
319
+ ```python
320
+ from datastar import *
321
+
322
+ project = Project.connect_to("My project")
323
+ macro = project.get_macro("load_and_process")
324
+
325
+ # 1) Clone within the same project
326
+ # The new macro name defaults to "<name> (copy)"
327
+ macro_clone_same = macro.clone()
328
+
329
+ # 2) Clone into a new project
330
+ dest_project = Project.create("Clone Target Project")
331
+ macro_clone_other = macro.clone(project=dest_project)
332
+
333
+ # Optional parameters allow overriding name/description
334
+ macro_custom = macro.clone(name="pipeline_clone", description="Cloned with custom name")
335
+ ```
336
+
337
+ Notes:
338
+ - Each destination macro has its own Start task; Start is not duplicated.
339
+ - Task configurations are copied, and dependencies are recreated between the copied tasks.
340
+
341
+ Run a macro:
342
+
343
+ ```python
344
+ from datastar import *
345
+
346
+ # ... project and macro setup here
347
+ macro.run(parameters={})
348
+ ```
349
+
350
+ Wait for a macro to complete:
351
+
352
+ ```python
353
+ from datastar import *
354
+
355
+ # ... project and macro setup here
356
+ macro.run(parameters={})
357
+ macro.wait_for_done(verbose=True)
358
+ ```
359
+
360
+ Note that the verbose parameter controls whether updates are printed.
361
+
362
+ ## Tasks
363
+
364
+ Tasks within macros describe the actions that will be performed.
365
+
366
+ Initially a macro has only a start node, and tasks created by the user are generally connected to this in a chain or graph.
367
+
368
+ ### Joining tasks together
369
+
370
+ By default when the library adds a task it will be joined onto the last task added to the macro (or 'Start' if is the first Task to be added).
371
+
372
+ This behaviour can be overridden.
373
+
374
+ When creating a task, use `auto_join=False` and pass the `previous_task` parameter.
375
+
376
+ If no previous task is supplied, then the task will not be connected.
377
+
378
+ Tasks can be connected and disconnected from their predecessor using `task.add_dependency(previous_task_name)` and `task.remove_dependency(previous_task_name)`.
379
+
380
+ To get a list of task predecessors:
381
+
382
+ ```python
383
+ deps = sql_task.get_dependencies()
384
+ print(deps)
385
+ ```
386
+
387
+ Add multiple tasks at once:
388
+
389
+ Chain tasks in order:
390
+
391
+ ![Chain of tasks](chain.png)
392
+
393
+ ```python
394
+ macro.add_tasks([t1, t2, t3])
395
+ ```
396
+
397
+ Fan‑out from a single predecessor:
398
+
399
+ ![Fan‑out of tasks](fan.png)
400
+
401
+ ```python
402
+ macro.add_tasks([tA, tB, tC], previous_task=some_task)
403
+ ```
404
+ <div style="page-break-after: always;"></div>
405
+
406
+ ### Task types
407
+
408
+ **ImportTask** — Use an ImportTask to load data into the project environment.
409
+
410
+ ```python
411
+ from datastar import *
412
+
413
+ macro = project.add_macro(name="load_and_process")
414
+ src = DelimitedConnection(path="/My Files/Datastar/Customers.csv", delimiter=",")
415
+ dst = project.get_sandbox() # special in‑project sandbox connection
416
+
417
+ import_task = macro.add_import_task(
418
+ name="import_customers",
419
+ source_connection=src,
420
+ destination_connection=dst,
421
+ destination_table="customers_raw",
422
+ destination_table_type="new", # "new" or "existing"
423
+ destination_table_action="replace", # "replace" or "append"
424
+ condition="", # optional WHERE filter
425
+ mappings=[("source_col", "dest_col")], # optional column mappings
426
+ )
427
+ ```
428
+
429
+ **RunSQLTask** — Use a RunSQL task to execute SQL against a connection (e.g., sandbox).
430
+
431
+ ```python
432
+ sql_task = macro.add_run_sql_task(
433
+ name="cleanup",
434
+ connection=dst,
435
+ query="DELETE FROM customers_raw WHERE city = 'London'",
436
+ )
437
+ ```
438
+
439
+ **RunPythonTask** — Use a RunPythonTask to execute a Python file available to the platform.
440
+
441
+ ```python
442
+ py_task = macro.add_run_python_task(
443
+ name="python_step",
444
+ filename="my_script.py",
445
+ directory_path="/My Files/Python coding",
446
+ )
447
+ ```
448
+
449
+ **ExportTask** — Use an ExportTask to write data out to an external destination.
450
+
451
+ ```python
452
+ export_task = macro.add_export_task(
453
+ name="export_results",
454
+ source_connection=dst,
455
+ source_table="customers_raw",
456
+ file_name="Customers.csv",
457
+ )
458
+ ```
459
+
460
+ ### Connections
461
+
462
+ Connections define sources/destinations for tasks and allow you to connect to different kinds of data sources.
463
+
464
+ Note: For `DelimitedConnection` and `ExcelConnection`, `path` refers to a path accessible to the platform (e.g., under “My Files”).
465
+
466
+ **DelimitedConnection** - Use a DelimitedConnection for CSV files or other delimited file types.
467
+ ```python
468
+ from datastar import *
469
+
470
+ csv = DelimitedConnection(
471
+ path="/My Files/Datastar/Customers.csv",
472
+ delimiter=",",
473
+ )
474
+ ```
475
+
476
+ **ExcelConnection** - Use an ExcelConnection to access .xls and .xlsx files.
477
+ ```python
478
+ from datastar import *
479
+
480
+ xl = ExcelConnection(
481
+ path="/My Files/Datastar/Workbook.xlsx", # path to file on Optilogic workspace
482
+ sheet_name="Sheet1", # optional
483
+ workbook_password=None, # optional, can be supplied if password required.
484
+ )
485
+ ```
486
+
487
+ **FrogModelConnection** - Use a FrogModelConnection to access data in a Cosmic Frog model.
488
+ ```python
489
+ from datastar import *
490
+
491
+ frog = FrogModelConnection(
492
+ model_name="My Frog Model" # or use storage_id="..."
493
+ )
494
+ ```
495
+
496
+ Rename a connection:
497
+
498
+ ```python
499
+ csv.rename("My CSV Source")
500
+ ```
501
+
502
+ Delete a connection:
503
+
504
+ ```python
505
+ csv.delete()
506
+ ```
507
+
508
+ <div style="page-break-after: always;"></div>
509
+
510
+ ### Sandbox access with pandas
511
+
512
+ The Sandbox connection exposes convenient helpers for direct table I/O using pandas. This is useful for quick inspection and ad‑hoc data loads independent of macros.
513
+
514
+ ```python
515
+ import pandas as pd
516
+
517
+ sandbox = project.get_sandbox()
518
+
519
+ # Read a table
520
+ df = sandbox.read_table("customers_raw")
521
+
522
+ # Write a DataFrame
523
+ sandbox.write_table(df, "customers_raw")
524
+ ```
525
+
526
+ Behind the scenes this uses SQLAlchemy with credentials provided by your App Key.
527
+
528
+ ## Example end‑to‑end flow
529
+
530
+ ```python
531
+ from datastar import *
532
+
533
+ project = Project.create("Datastar Demo")
534
+ macro = project.add_macro(name="pipeline")
535
+
536
+ src = DelimitedConnection(path="/My Files/Datastar/Customers.csv")
537
+ dst = project.get_sandbox()
538
+
539
+ macro.add_import_task(
540
+ name="import_customers",
541
+ source_connection=src,
542
+ destination_connection=dst,
543
+ destination_table="customers_raw",
544
+ )
545
+
546
+ macro.add_run_sql_task(
547
+ name="dedupe",
548
+ connection=dst,
549
+ query="""
550
+ CREATE TABLE IF NOT EXISTS customers AS
551
+ SELECT DISTINCT * FROM customers_raw;
552
+ """,
553
+ )
554
+
555
+ macro.run()
556
+ macro.wait_for_done(verbose=True)
557
+ ```
558
+
559
+ ---
560
+
561
+ Happy building! For additional help, contact support or see Optilogic resources at https://www.optilogic.com/.
562
+
563
+ ## API Summary
564
+
565
+ ### Project
566
+
567
+ Properties
568
+ - name — Display name of the project.
569
+ - description — Human‑readable description for the project.
570
+
571
+ Methods
572
+ - get_projects() — List project names you can access.
573
+ - create(name, description) — Create a new project.
574
+ - connect_to(name) — Connect to an existing project by name.
575
+ - save() — Persist name/description changes.
576
+ - delete() — Remove the project.
577
+ - get_macros() — List macro names in the project.
578
+ - add_macro(name, description) — Create and add a macro.
579
+ - get_macro(name) — Get a macro by name.
580
+ - delete_macro(name) — Delete a macro by name.
581
+ - get_sandbox() — Get the project’s Sandbox connection.
582
+
583
+ ### Macro
584
+
585
+ Properties
586
+ - project — The owning project.
587
+ - name — Display name of the macro.
588
+ - description — Human‑readable description for the macro.
589
+
590
+ Methods
591
+ - save() — Persist name/description changes.
592
+ - delete() — Remove the macro from the project.
593
+ - get_task(name) — Get a task by name.
594
+ - get_tasks(type_filter) — List task names, optionally by type.
595
+ - delete_task(name) — Delete a task by name.
596
+ - add_task(task, auto_join, previous_task) — Add a pre‑built task to the macro (copy tasks within/across macros; same‑macro copies get a "(copy)" suffix).
597
+ - add_tasks(tasks, auto_join, previous_task) — Add multiple tasks; chains by default, or makes all depend on `previous_task` when provided.
598
+ - add_import_task(...) — Create and add an Import task.
599
+ - add_export_task(...) — Create and add an Export task.
600
+ - add_run_sql_task(...) — Create and add a Run SQL task.
601
+ - add_run_python_task(...) — Create and add a Run Python task.
602
+ - clone(project=None, name=None, description=None) — Clone the macro (tasks+dependencies) within the same or into another project.
603
+ - run(parameters) — Execute the macro.
604
+ - get_run_status() — Get status of the current run; returns "no_current_run" if none.
605
+ - wait_for_done(verbose, max_seconds) — Wait until the current run completes; optionally time out after `max_seconds`.
606
+ - cancel() — Cancel the current run; no-op if none.
607
+
608
+ ### Connection
609
+
610
+ Properties
611
+ - name — Display name of the connection.
612
+ - description — Human‑readable description for the connection.
613
+
614
+ Methods
615
+ - get_connections(connector_type) — List connection names, optionally by type.
616
+ - save() — Persist connection changes.
617
+ - delete() — Remove the connection.
618
+
619
+ ### Task
620
+
621
+ Properties
622
+ - macro — The owning macro.
623
+ - name — Display name of the task.
624
+ - description — Human‑readable description for the task.
625
+
626
+ Methods
627
+ - save(auto_join, previous_task) — Create or update the task.
628
+ - delete() — Remove the task from the macro.
629
+ - add_dependency(previous_task_name) — Connect this task after another.
630
+ - remove_dependency(previous_task_name) — Disconnect from a previous task.
631
+ - get_dependencies() — List names of predecessor tasks.
@@ -0,0 +1,52 @@
1
+ from .connection import Connection
2
+ from .project import Project
3
+ from .macro import Macro
4
+ from .task import Task
5
+
6
+ # Re-export convenient subpackages
7
+ from . import connections as connections
8
+ from . import tasks as tasks
9
+
10
+ # Also expose common connection subclasses at top-level for convenience
11
+ from .connections import (
12
+ DelimitedConnection,
13
+ ExcelConnection,
14
+ FrogModelConnection,
15
+ OptiConnection,
16
+ SandboxConnection,
17
+ )
18
+
19
+ # Also expose task subclasses at top-level for convenience
20
+ from .tasks import (
21
+ ExportTask,
22
+ ImportTask,
23
+ RunPythonTask,
24
+ RunSQLTask,
25
+ )
26
+
27
+ # Single source of truth for version
28
+ from ._version import __version__
29
+
30
+ # Public API of the package
31
+ __all__ = [
32
+ "Project",
33
+ "Macro",
34
+ "Task",
35
+ "Connection",
36
+ # Subpackages
37
+ "connections",
38
+ "tasks",
39
+ # Connection subclasses
40
+ "DelimitedConnection",
41
+ "ExcelConnection",
42
+ "FrogModelConnection",
43
+ "OptiConnection",
44
+ "SandboxConnection",
45
+ # Task subclasses
46
+ "ExportTask",
47
+ "ImportTask",
48
+ "RunPythonTask",
49
+ "RunSQLTask",
50
+ # Version
51
+ "__version__",
52
+ ]
@@ -0,0 +1,6 @@
1
+ """Shared default values for Optilogic Datastar library models."""
2
+
3
+ DEFAULT_DESCRIPTION = "Created by the Optilogic Datastar library"
4
+
5
+ # Special task names
6
+ START_TASK_NAME = "Start"
@@ -0,0 +1,3 @@
1
+ """Package version (single source of truth)."""
2
+
3
+ __version__ = "0.0.19"