airflow-dagsmith 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.
Files changed (112) hide show
  1. airflow_dagsmith-0.1.0/.github/FUNDING.yml +2 -0
  2. airflow_dagsmith-0.1.0/.github/workflows/ci.yml +44 -0
  3. airflow_dagsmith-0.1.0/.github/workflows/release.yml +55 -0
  4. airflow_dagsmith-0.1.0/.gitignore +30 -0
  5. airflow_dagsmith-0.1.0/LICENSE +202 -0
  6. airflow_dagsmith-0.1.0/PKG-INFO +147 -0
  7. airflow_dagsmith-0.1.0/README.md +120 -0
  8. airflow_dagsmith-0.1.0/frontend/index.html +12 -0
  9. airflow_dagsmith-0.1.0/frontend/package-lock.json +4279 -0
  10. airflow_dagsmith-0.1.0/frontend/package.json +42 -0
  11. airflow_dagsmith-0.1.0/frontend/public/icon-dark.svg +7 -0
  12. airflow_dagsmith-0.1.0/frontend/public/icon.svg +7 -0
  13. airflow_dagsmith-0.1.0/frontend/src/api/client.ts +153 -0
  14. airflow_dagsmith-0.1.0/frontend/src/api/types.ts +216 -0
  15. airflow_dagsmith-0.1.0/frontend/src/components/AuditPanel.tsx +80 -0
  16. airflow_dagsmith-0.1.0/frontend/src/components/Canvas.tsx +856 -0
  17. airflow_dagsmith-0.1.0/frontend/src/components/CodePanel.tsx +28 -0
  18. airflow_dagsmith-0.1.0/frontend/src/components/CronGeneratorModal.tsx +264 -0
  19. airflow_dagsmith-0.1.0/frontend/src/components/DagSettingsModal.tsx +286 -0
  20. airflow_dagsmith-0.1.0/frontend/src/components/DiffView.tsx +40 -0
  21. airflow_dagsmith-0.1.0/frontend/src/components/EdgeModal.tsx +85 -0
  22. airflow_dagsmith-0.1.0/frontend/src/components/EditorView.tsx +408 -0
  23. airflow_dagsmith-0.1.0/frontend/src/components/FileBrowser.tsx +242 -0
  24. airflow_dagsmith-0.1.0/frontend/src/components/HistoryPanel.tsx +99 -0
  25. airflow_dagsmith-0.1.0/frontend/src/components/Inspector.tsx +538 -0
  26. airflow_dagsmith-0.1.0/frontend/src/components/Modal.tsx +35 -0
  27. airflow_dagsmith-0.1.0/frontend/src/components/Palette.tsx +161 -0
  28. airflow_dagsmith-0.1.0/frontend/src/components/TeamsAdmin.tsx +427 -0
  29. airflow_dagsmith-0.1.0/frontend/src/components/blockIcons.tsx +110 -0
  30. airflow_dagsmith-0.1.0/frontend/src/components/editors.tsx +288 -0
  31. airflow_dagsmith-0.1.0/frontend/src/dev.tsx +11 -0
  32. airflow_dagsmith-0.1.0/frontend/src/lib/dict.test.ts +63 -0
  33. airflow_dagsmith-0.1.0/frontend/src/lib/dict.ts +71 -0
  34. airflow_dagsmith-0.1.0/frontend/src/main.tsx +25 -0
  35. airflow_dagsmith-0.1.0/frontend/src/pages/HomePage.tsx +121 -0
  36. airflow_dagsmith-0.1.0/frontend/src/state/store.test.ts +131 -0
  37. airflow_dagsmith-0.1.0/frontend/src/state/store.ts +727 -0
  38. airflow_dagsmith-0.1.0/frontend/src/types.ts +13 -0
  39. airflow_dagsmith-0.1.0/frontend/tsconfig.json +20 -0
  40. airflow_dagsmith-0.1.0/frontend/vite.config.ts +58 -0
  41. airflow_dagsmith-0.1.0/pyproject.toml +77 -0
  42. airflow_dagsmith-0.1.0/src/dagsmith/__init__.py +3 -0
  43. airflow_dagsmith-0.1.0/src/dagsmith/__main__.py +37 -0
  44. airflow_dagsmith-0.1.0/src/dagsmith/api/__init__.py +0 -0
  45. airflow_dagsmith-0.1.0/src/dagsmith/api/app.py +84 -0
  46. airflow_dagsmith-0.1.0/src/dagsmith/api/deps.py +14 -0
  47. airflow_dagsmith-0.1.0/src/dagsmith/api/errors.py +59 -0
  48. airflow_dagsmith-0.1.0/src/dagsmith/api/routes/__init__.py +0 -0
  49. airflow_dagsmith-0.1.0/src/dagsmith/api/routes/audit.py +14 -0
  50. airflow_dagsmith-0.1.0/src/dagsmith/api/routes/bundles.py +18 -0
  51. airflow_dagsmith-0.1.0/src/dagsmith/api/routes/catalog.py +32 -0
  52. airflow_dagsmith-0.1.0/src/dagsmith/api/routes/config.py +22 -0
  53. airflow_dagsmith-0.1.0/src/dagsmith/api/routes/drafts.py +286 -0
  54. airflow_dagsmith-0.1.0/src/dagsmith/api/routes/files.py +75 -0
  55. airflow_dagsmith-0.1.0/src/dagsmith/api/routes/graph.py +51 -0
  56. airflow_dagsmith-0.1.0/src/dagsmith/api/routes/health.py +14 -0
  57. airflow_dagsmith-0.1.0/src/dagsmith/api/routes/teams.py +138 -0
  58. airflow_dagsmith-0.1.0/src/dagsmith/api/routes/validate.py +15 -0
  59. airflow_dagsmith-0.1.0/src/dagsmith/api/schemas.py +194 -0
  60. airflow_dagsmith-0.1.0/src/dagsmith/api/security.py +114 -0
  61. airflow_dagsmith-0.1.0/src/dagsmith/config.py +73 -0
  62. airflow_dagsmith-0.1.0/src/dagsmith/core/__init__.py +0 -0
  63. airflow_dagsmith-0.1.0/src/dagsmith/core/audit.py +39 -0
  64. airflow_dagsmith-0.1.0/src/dagsmith/core/catalog.py +358 -0
  65. airflow_dagsmith-0.1.0/src/dagsmith/core/codegen.py +330 -0
  66. airflow_dagsmith-0.1.0/src/dagsmith/core/connections.py +47 -0
  67. airflow_dagsmith-0.1.0/src/dagsmith/core/db.py +182 -0
  68. airflow_dagsmith-0.1.0/src/dagsmith/core/drafts.py +318 -0
  69. airflow_dagsmith-0.1.0/src/dagsmith/core/gitops.py +138 -0
  70. airflow_dagsmith-0.1.0/src/dagsmith/core/migrate.py +35 -0
  71. airflow_dagsmith-0.1.0/src/dagsmith/core/model.py +90 -0
  72. airflow_dagsmith-0.1.0/src/dagsmith/core/parser.py +702 -0
  73. airflow_dagsmith-0.1.0/src/dagsmith/core/storage.py +146 -0
  74. airflow_dagsmith-0.1.0/src/dagsmith/core/teams.py +197 -0
  75. airflow_dagsmith-0.1.0/src/dagsmith/core/transform.py +639 -0
  76. airflow_dagsmith-0.1.0/src/dagsmith/core/validation.py +85 -0
  77. airflow_dagsmith-0.1.0/src/dagsmith/core/validation_worker.py +39 -0
  78. airflow_dagsmith-0.1.0/src/dagsmith/migrations/env.py +50 -0
  79. airflow_dagsmith-0.1.0/src/dagsmith/migrations/script.py.mako +25 -0
  80. airflow_dagsmith-0.1.0/src/dagsmith/migrations/versions/0001_initial_draft_tables.py +67 -0
  81. airflow_dagsmith-0.1.0/src/dagsmith/migrations/versions/0002_teams.py +51 -0
  82. airflow_dagsmith-0.1.0/src/dagsmith/migrations/versions/0003_team_git_target.py +31 -0
  83. airflow_dagsmith-0.1.0/src/dagsmith/migrations/versions/0004_file_team_override.py +38 -0
  84. airflow_dagsmith-0.1.0/src/dagsmith/plugin.py +49 -0
  85. airflow_dagsmith-0.1.0/src/dagsmith/static/.gitkeep +0 -0
  86. airflow_dagsmith-0.1.0/src/dagsmith/static/dagsmith.js +23 -0
  87. airflow_dagsmith-0.1.0/src/dagsmith/static/icon-dark.svg +7 -0
  88. airflow_dagsmith-0.1.0/src/dagsmith/static/icon.svg +7 -0
  89. airflow_dagsmith-0.1.0/tests/conftest.py +63 -0
  90. airflow_dagsmith-0.1.0/tests/corpus/t2_dag_decorator.py +25 -0
  91. airflow_dagsmith-0.1.0/tests/corpus/t2_opaque_operator.py +18 -0
  92. airflow_dagsmith-0.1.0/tests/corpus/t2_with_dag.py +25 -0
  93. airflow_dagsmith-0.1.0/tests/corpus/t3_dynamic_mapping.py +23 -0
  94. airflow_dagsmith-0.1.0/tests/corpus/t3_group_deps.py +16 -0
  95. airflow_dagsmith-0.1.0/tests/corpus/t3_loops_and_groups.py +25 -0
  96. airflow_dagsmith-0.1.0/tests/corpus/t3_multiple_dags.py +11 -0
  97. airflow_dagsmith-0.1.0/tests/test_catalog.py +177 -0
  98. airflow_dagsmith-0.1.0/tests/test_codegen.py +127 -0
  99. airflow_dagsmith-0.1.0/tests/test_config.py +24 -0
  100. airflow_dagsmith-0.1.0/tests/test_drafts_api.py +208 -0
  101. airflow_dagsmith-0.1.0/tests/test_edges_meta.py +158 -0
  102. airflow_dagsmith-0.1.0/tests/test_gitops_audit.py +85 -0
  103. airflow_dagsmith-0.1.0/tests/test_group_edges.py +102 -0
  104. airflow_dagsmith-0.1.0/tests/test_group_removal.py +98 -0
  105. airflow_dagsmith-0.1.0/tests/test_grouping.py +125 -0
  106. airflow_dagsmith-0.1.0/tests/test_health.py +20 -0
  107. airflow_dagsmith-0.1.0/tests/test_migrations.py +58 -0
  108. airflow_dagsmith-0.1.0/tests/test_roundtrip.py +218 -0
  109. airflow_dagsmith-0.1.0/tests/test_storage.py +76 -0
  110. airflow_dagsmith-0.1.0/tests/test_t3.py +102 -0
  111. airflow_dagsmith-0.1.0/tests/test_teams.py +348 -0
  112. airflow_dagsmith-0.1.0/tests/test_transform_imports.py +63 -0
@@ -0,0 +1,2 @@
1
+ # Shown as the "Sponsor" button on the public GitHub repository.
2
+ buy_me_a_coffee: byteway
@@ -0,0 +1,44 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ backend:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-python@v5
14
+ with:
15
+ python-version: "3.12"
16
+ - name: Install backend (without Airflow — unit tests run standalone)
17
+ run: |
18
+ python -m pip install --upgrade pip
19
+ pip install fastapi httpx pytest sqlalchemy alembic pydantic libcst ruff
20
+ pip install -e . --no-deps
21
+ - name: Ruff
22
+ run: ruff check src tests
23
+ - name: Pytest
24
+ run: pytest -q
25
+
26
+ frontend:
27
+ runs-on: ubuntu-latest
28
+ defaults:
29
+ run:
30
+ working-directory: frontend
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ - uses: actions/setup-node@v4
34
+ with:
35
+ node-version: "22"
36
+ cache: npm
37
+ cache-dependency-path: frontend/package-lock.json
38
+ - run: npm ci
39
+ - name: Typecheck
40
+ run: npm run lint
41
+ - name: Unit tests
42
+ run: npm test
43
+ - name: Build bundle
44
+ run: npm run build
@@ -0,0 +1,55 @@
1
+ name: Release to PyPI
2
+
3
+ # Publishes via PyPI Trusted Publishing (OIDC) — no API tokens stored anywhere.
4
+ # Triggered by pushing a version tag, e.g.: git tag v0.1.0 && git push --tags
5
+
6
+ on:
7
+ push:
8
+ tags: ["v*"]
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - uses: actions/setup-node@v4
17
+ with:
18
+ node-version: "22"
19
+ cache: npm
20
+ cache-dependency-path: frontend/package-lock.json
21
+ - name: Build the UI bundle
22
+ working-directory: frontend
23
+ run: |
24
+ npm ci
25
+ npm run build
26
+
27
+ - uses: actions/setup-python@v5
28
+ with:
29
+ python-version: "3.12"
30
+ - name: Build sdist + wheel
31
+ run: |
32
+ python -m pip install --upgrade build
33
+ python -m build
34
+ - name: Verify the wheel contains the UI bundle
35
+ run: |
36
+ python -m zipfile -l dist/*.whl | grep "dagsmith/static/dagsmith.js" \
37
+ || { echo "UI bundle missing from the wheel!"; exit 1; }
38
+
39
+ - uses: actions/upload-artifact@v4
40
+ with:
41
+ name: dist
42
+ path: dist/
43
+
44
+ publish:
45
+ needs: build
46
+ runs-on: ubuntu-latest
47
+ environment: pypi
48
+ permissions:
49
+ id-token: write # required for PyPI Trusted Publishing (OIDC)
50
+ steps:
51
+ - uses: actions/download-artifact@v4
52
+ with:
53
+ name: dist
54
+ path: dist/
55
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,30 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .venv/
6
+ dist/
7
+ build/
8
+ .pytest_cache/
9
+ .mypy_cache/
10
+ .ruff_cache/
11
+
12
+ # Frontend
13
+ frontend/node_modules/
14
+ frontend/dist/
15
+
16
+ # Built frontend bundle (committed only on release)
17
+ src/dagsmith/static/*
18
+ !src/dagsmith/static/.gitkeep
19
+
20
+ # Dev environment
21
+ dev/pgdata/
22
+ dev/logs/
23
+ # runtime sandbox: DagSmith deploys here and it is its own git repo
24
+ # (git-on-deploy testing); seed it from dev/seed-dags/
25
+ dev/dags/
26
+
27
+ # OS / editors
28
+ .DS_Store
29
+ .idea/
30
+ .vscode/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,147 @@
1
+ Metadata-Version: 2.4
2
+ Name: airflow-dagsmith
3
+ Version: 0.1.0
4
+ Summary: Visual block-based and code DAG editor inside the Apache Airflow 3 UI
5
+ Project-URL: Homepage, https://github.com/byteway-pl/DagSmith
6
+ Project-URL: Issues, https://github.com/byteway-pl/DagSmith/issues
7
+ Author: Adrian Galik
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Framework :: Apache Airflow
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Requires-Python: >=3.10
15
+ Requires-Dist: alembic>=1.13
16
+ Requires-Dist: apache-airflow>=3.1.0
17
+ Requires-Dist: libcst>=1.1
18
+ Requires-Dist: pydantic>=2.0
19
+ Requires-Dist: sqlalchemy>=1.4
20
+ Provides-Extra: dev
21
+ Requires-Dist: httpx>=0.27; extra == 'dev'
22
+ Requires-Dist: mypy>=1.10; extra == 'dev'
23
+ Requires-Dist: pytest>=8; extra == 'dev'
24
+ Requires-Dist: ruff>=0.6; extra == 'dev'
25
+ Requires-Dist: testcontainers[postgres]>=4; extra == 'dev'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # DagSmith
29
+
30
+ **A visual, block-based DAG editor for Apache Airflow 3 — right inside the Airflow UI.**
31
+
32
+ DagSmith is an Airflow plugin (Airflow ≥ 3.1) that adds a full DAG editor to the
33
+ Airflow web UI:
34
+
35
+ - 🧱 **Visual editor** — build DAGs from blocks: drag operators from a searchable
36
+ palette onto a canvas, connect them with dependency edges (tasks *and* TaskGroups),
37
+ configure parameters in typed forms (key:value editors for dicts, a rich-text editor
38
+ for HTML fields, connection pickers for `conn_id`s, a cron builder for schedules).
39
+ - ✍️ **Code editor** — edit the `.py` files in CodeMirror with syntax and import
40
+ validation before anything is deployed.
41
+ - 🔁 **Two-way sync, code is the source of truth** — canvas edits are applied to your
42
+ file as *minimal, surgical changes* (via [libcst](https://github.com/Instagram/LibCST));
43
+ comments and formatting you didn't touch stay byte-for-byte identical. Editing the
44
+ code updates the canvas. Dynamic constructs (loops, `.partial().expand()`) appear as
45
+ code-only blocks instead of breaking the parser.
46
+ - 🧰 **Auto-generated operator palette** — installed provider packages are introspected
47
+ (operators, sensors, their `__init__` signatures across the class hierarchy), so
48
+ hundreds of blocks with typed parameter forms appear without any manual definitions.
49
+ - 💾 **Draft → Deploy** — work-in-progress is saved as versioned drafts in the Airflow
50
+ metadata database (with autosave, history, diffs and restore). The live `.py` file
51
+ changes **only** when you hit Deploy, after validation, with a backup and conflict
52
+ detection. The scheduler never sees half-finished work.
53
+ - 👥 **Teams** — give each team a directory in a DAG bundle and a git repository:
54
+ members-only editing, per-DAG reassignment by admins, team-tagged DAGs, and a
55
+ *Commit & push* button (GitHub/GitLab) plus optional push-on-deploy.
56
+ - 🔒 **Safety by default** — deploy is disabled until explicitly enabled, all endpoints
57
+ are authorized through the Airflow Auth Manager, user code is only ever executed in
58
+ an isolated subprocess, every path is confined to the bundle root, and every deploy
59
+ is audit-logged.
60
+
61
+ ## Requirements
62
+
63
+ | Component | Version |
64
+ |---|---|
65
+ | Apache Airflow | **≥ 3.1** (uses the `react_apps` + `fastapi_apps` plugin APIs; no Airflow 2.x support) |
66
+ | Python | ≥ 3.10 |
67
+ | Metadata DB | PostgreSQL recommended (DagSmith stores drafts in its own `dagsmith_*` tables) |
68
+ | File access | to deploy, the Airflow api-server needs write access to the DAG bundle directory; working on drafts needs no file access at all |
69
+
70
+ ## Installation
71
+
72
+ ```bash
73
+ pip install airflow-dagsmith # in the environment running the Airflow api-server
74
+ ```
75
+
76
+ The plugin registers itself via the `airflow.plugins` entry point — don't copy anything
77
+ into `$AIRFLOW_HOME/plugins`. After restarting the api-server, **DagSmith** appears in
78
+ the Airflow navigation. Its `dagsmith_*` tables are created automatically on startup
79
+ (or run `python -m dagsmith db upgrade` manually).
80
+
81
+ ### Enabling deploy
82
+
83
+ For safety, writing `.py` files is **off by default** — without it DagSmith works in
84
+ read-and-draft mode. Enable it consciously:
85
+
86
+ ```ini
87
+ [dagsmith]
88
+ deploy_enabled = True
89
+ # optional hardening / team split:
90
+ # editors = data-platform-team # who can create and edit drafts
91
+ # deployers = admin # who can write .py files
92
+ # admins = admin # who manages teams
93
+ # git_commit = True # commit to the bundle checkout on deploy
94
+ ```
95
+
96
+ (or `AIRFLOW__DAGSMITH__DEPLOY_ENABLED=True` etc.)
97
+
98
+ > ⚠️ **Security note:** deploying DAGs from the UI is equivalent to executing arbitrary
99
+ > code in your Airflow environment — exactly like shipping a DAG file any other way.
100
+ > Enable `deploy_enabled` only with proper access control on the Airflow UI. Import
101
+ > validation executes the file's top level in an isolated, time-limited subprocess.
102
+
103
+ ## How it works
104
+
105
+ ```
106
+ Airflow UI ─▶ react_app "DagSmith" (React Flow canvas + CodeMirror)
107
+ │ REST /dagsmith/api/v1 (Airflow JWT)
108
+
109
+ FastAPI app inside the api-server
110
+ │ parse (libcst) / codegen / validation (subprocess)
111
+ ┌────────────┴────────────┐
112
+ Save / autosave Deploy (validated)
113
+ ▼ ▼
114
+ Airflow metadata DB .py files in the DAG bundle
115
+ (draft versions, (atomic write, backup,
116
+ canvas layout) conflict detection, git)
117
+ ```
118
+
119
+ Three tiers of support for existing code:
120
+
121
+ 1. **DAGs created in DagSmith** — full visual editing with remembered layout.
122
+ 2. **Typical hand-written DAGs** (`with DAG(...)`, `@dag`, `@task`, `>>`, `chain()`,
123
+ nested TaskGroups, edge `Label`s) — full visual editing without touching your
124
+ formatting.
125
+ 3. **Dynamic constructs** (task-generating loops, `.expand()`) — shown on the canvas as
126
+ read-only blocks, editable in the code view.
127
+
128
+ ## Development
129
+
130
+ ```bash
131
+ pip install -e ".[dev]"
132
+ pytest # backend (incl. byte-exact round-trip corpus)
133
+ cd frontend && npm install
134
+ npm run build # UMD bundle -> src/dagsmith/static/
135
+ npm test && npm run lint
136
+ ```
137
+
138
+ The frontend follows Airflow's AIP-68 react-plugin contract (single UMD bundle, host
139
+ provides React); everything ships inside the bundle — no CDNs.
140
+
141
+ ## Support the project
142
+
143
+ If DagSmith saves you time, you can [buy me a coffee](https://buymeacoffee.com/byteway) ☕
144
+
145
+ ## License
146
+
147
+ [Apache-2.0](LICENSE)
@@ -0,0 +1,120 @@
1
+ # DagSmith
2
+
3
+ **A visual, block-based DAG editor for Apache Airflow 3 — right inside the Airflow UI.**
4
+
5
+ DagSmith is an Airflow plugin (Airflow ≥ 3.1) that adds a full DAG editor to the
6
+ Airflow web UI:
7
+
8
+ - 🧱 **Visual editor** — build DAGs from blocks: drag operators from a searchable
9
+ palette onto a canvas, connect them with dependency edges (tasks *and* TaskGroups),
10
+ configure parameters in typed forms (key:value editors for dicts, a rich-text editor
11
+ for HTML fields, connection pickers for `conn_id`s, a cron builder for schedules).
12
+ - ✍️ **Code editor** — edit the `.py` files in CodeMirror with syntax and import
13
+ validation before anything is deployed.
14
+ - 🔁 **Two-way sync, code is the source of truth** — canvas edits are applied to your
15
+ file as *minimal, surgical changes* (via [libcst](https://github.com/Instagram/LibCST));
16
+ comments and formatting you didn't touch stay byte-for-byte identical. Editing the
17
+ code updates the canvas. Dynamic constructs (loops, `.partial().expand()`) appear as
18
+ code-only blocks instead of breaking the parser.
19
+ - 🧰 **Auto-generated operator palette** — installed provider packages are introspected
20
+ (operators, sensors, their `__init__` signatures across the class hierarchy), so
21
+ hundreds of blocks with typed parameter forms appear without any manual definitions.
22
+ - 💾 **Draft → Deploy** — work-in-progress is saved as versioned drafts in the Airflow
23
+ metadata database (with autosave, history, diffs and restore). The live `.py` file
24
+ changes **only** when you hit Deploy, after validation, with a backup and conflict
25
+ detection. The scheduler never sees half-finished work.
26
+ - 👥 **Teams** — give each team a directory in a DAG bundle and a git repository:
27
+ members-only editing, per-DAG reassignment by admins, team-tagged DAGs, and a
28
+ *Commit & push* button (GitHub/GitLab) plus optional push-on-deploy.
29
+ - 🔒 **Safety by default** — deploy is disabled until explicitly enabled, all endpoints
30
+ are authorized through the Airflow Auth Manager, user code is only ever executed in
31
+ an isolated subprocess, every path is confined to the bundle root, and every deploy
32
+ is audit-logged.
33
+
34
+ ## Requirements
35
+
36
+ | Component | Version |
37
+ |---|---|
38
+ | Apache Airflow | **≥ 3.1** (uses the `react_apps` + `fastapi_apps` plugin APIs; no Airflow 2.x support) |
39
+ | Python | ≥ 3.10 |
40
+ | Metadata DB | PostgreSQL recommended (DagSmith stores drafts in its own `dagsmith_*` tables) |
41
+ | File access | to deploy, the Airflow api-server needs write access to the DAG bundle directory; working on drafts needs no file access at all |
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ pip install airflow-dagsmith # in the environment running the Airflow api-server
47
+ ```
48
+
49
+ The plugin registers itself via the `airflow.plugins` entry point — don't copy anything
50
+ into `$AIRFLOW_HOME/plugins`. After restarting the api-server, **DagSmith** appears in
51
+ the Airflow navigation. Its `dagsmith_*` tables are created automatically on startup
52
+ (or run `python -m dagsmith db upgrade` manually).
53
+
54
+ ### Enabling deploy
55
+
56
+ For safety, writing `.py` files is **off by default** — without it DagSmith works in
57
+ read-and-draft mode. Enable it consciously:
58
+
59
+ ```ini
60
+ [dagsmith]
61
+ deploy_enabled = True
62
+ # optional hardening / team split:
63
+ # editors = data-platform-team # who can create and edit drafts
64
+ # deployers = admin # who can write .py files
65
+ # admins = admin # who manages teams
66
+ # git_commit = True # commit to the bundle checkout on deploy
67
+ ```
68
+
69
+ (or `AIRFLOW__DAGSMITH__DEPLOY_ENABLED=True` etc.)
70
+
71
+ > ⚠️ **Security note:** deploying DAGs from the UI is equivalent to executing arbitrary
72
+ > code in your Airflow environment — exactly like shipping a DAG file any other way.
73
+ > Enable `deploy_enabled` only with proper access control on the Airflow UI. Import
74
+ > validation executes the file's top level in an isolated, time-limited subprocess.
75
+
76
+ ## How it works
77
+
78
+ ```
79
+ Airflow UI ─▶ react_app "DagSmith" (React Flow canvas + CodeMirror)
80
+ │ REST /dagsmith/api/v1 (Airflow JWT)
81
+
82
+ FastAPI app inside the api-server
83
+ │ parse (libcst) / codegen / validation (subprocess)
84
+ ┌────────────┴────────────┐
85
+ Save / autosave Deploy (validated)
86
+ ▼ ▼
87
+ Airflow metadata DB .py files in the DAG bundle
88
+ (draft versions, (atomic write, backup,
89
+ canvas layout) conflict detection, git)
90
+ ```
91
+
92
+ Three tiers of support for existing code:
93
+
94
+ 1. **DAGs created in DagSmith** — full visual editing with remembered layout.
95
+ 2. **Typical hand-written DAGs** (`with DAG(...)`, `@dag`, `@task`, `>>`, `chain()`,
96
+ nested TaskGroups, edge `Label`s) — full visual editing without touching your
97
+ formatting.
98
+ 3. **Dynamic constructs** (task-generating loops, `.expand()`) — shown on the canvas as
99
+ read-only blocks, editable in the code view.
100
+
101
+ ## Development
102
+
103
+ ```bash
104
+ pip install -e ".[dev]"
105
+ pytest # backend (incl. byte-exact round-trip corpus)
106
+ cd frontend && npm install
107
+ npm run build # UMD bundle -> src/dagsmith/static/
108
+ npm test && npm run lint
109
+ ```
110
+
111
+ The frontend follows Airflow's AIP-68 react-plugin contract (single UMD bundle, host
112
+ provides React); everything ships inside the bundle — no CDNs.
113
+
114
+ ## Support the project
115
+
116
+ If DagSmith saves you time, you can [buy me a coffee](https://buymeacoffee.com/byteway) ☕
117
+
118
+ ## License
119
+
120
+ [Apache-2.0](LICENSE)
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>DagSmith (dev)</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+ <script type="module" src="/src/dev.tsx"></script>
11
+ </body>
12
+ </html>