modelith-dbt 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 (209) hide show
  1. modelith_dbt-0.1.0/.claude/launch.json +17 -0
  2. modelith_dbt-0.1.0/.gitignore +26 -0
  3. modelith_dbt-0.1.0/LICENSE +202 -0
  4. modelith_dbt-0.1.0/PKG-INFO +269 -0
  5. modelith_dbt-0.1.0/README.md +250 -0
  6. modelith_dbt-0.1.0/canvas/index.html +12 -0
  7. modelith_dbt-0.1.0/canvas/package-lock.json +2279 -0
  8. modelith_dbt-0.1.0/canvas/package.json +24 -0
  9. modelith_dbt-0.1.0/canvas/sme.html +12 -0
  10. modelith_dbt-0.1.0/canvas/src/App.tsx +413 -0
  11. modelith_dbt-0.1.0/canvas/src/EntityNode.tsx +82 -0
  12. modelith_dbt-0.1.0/canvas/src/Inspector.tsx +511 -0
  13. modelith_dbt-0.1.0/canvas/src/RelationshipEdge.tsx +125 -0
  14. modelith_dbt-0.1.0/canvas/src/SidePanel.tsx +369 -0
  15. modelith_dbt-0.1.0/canvas/src/TopBar.tsx +129 -0
  16. modelith_dbt-0.1.0/canvas/src/api.ts +85 -0
  17. modelith_dbt-0.1.0/canvas/src/layout.ts +52 -0
  18. modelith_dbt-0.1.0/canvas/src/main.tsx +10 -0
  19. modelith_dbt-0.1.0/canvas/src/modals.tsx +385 -0
  20. modelith_dbt-0.1.0/canvas/src/sme/ProposeDialog.tsx +135 -0
  21. modelith_dbt-0.1.0/canvas/src/sme/SmeApp.tsx +200 -0
  22. modelith_dbt-0.1.0/canvas/src/sme/TermCard.tsx +104 -0
  23. modelith_dbt-0.1.0/canvas/src/sme/TermEditor.tsx +269 -0
  24. modelith_dbt-0.1.0/canvas/src/sme/sme.css +136 -0
  25. modelith_dbt-0.1.0/canvas/src/sme.tsx +10 -0
  26. modelith_dbt-0.1.0/canvas/src/styles.css +352 -0
  27. modelith_dbt-0.1.0/canvas/src/types.ts +219 -0
  28. modelith_dbt-0.1.0/canvas/tsconfig.json +20 -0
  29. modelith_dbt-0.1.0/canvas/vite.config.ts +26 -0
  30. modelith_dbt-0.1.0/docs/adoption-guide.md +661 -0
  31. modelith_dbt-0.1.0/docs/assets/README.md +20 -0
  32. modelith_dbt-0.1.0/docs/assets/canvas.png +0 -0
  33. modelith_dbt-0.1.0/docs/assets/inspector.png +0 -0
  34. modelith_dbt-0.1.0/docs/assets/vscode-split.png +0 -0
  35. modelith_dbt-0.1.0/docs/collaboration-model.md +288 -0
  36. modelith_dbt-0.1.0/docs/dogfooding-ibor.md +89 -0
  37. modelith_dbt-0.1.0/docs/vscode-plan.md +92 -0
  38. modelith_dbt-0.1.0/modelith-collaboration-model.md +273 -0
  39. modelith_dbt-0.1.0/modelith-spec-v2.md +623 -0
  40. modelith_dbt-0.1.0/modelith-spec.md +576 -0
  41. modelith_dbt-0.1.0/ontologies/industry/fibo-subset/fibo-subset.ttl +247 -0
  42. modelith_dbt-0.1.0/packages/adapters/collibra/pyproject.toml +17 -0
  43. modelith_dbt-0.1.0/packages/adapters/collibra/src/mdl_adapter_collibra/__init__.py +8 -0
  44. modelith_dbt-0.1.0/packages/adapters/collibra/src/mdl_adapter_collibra/adapter.py +177 -0
  45. modelith_dbt-0.1.0/packages/adapters/collibra/tests/conftest.py +24 -0
  46. modelith_dbt-0.1.0/packages/adapters/collibra/tests/test_collibra.py +111 -0
  47. modelith_dbt-0.1.0/packages/cli/pyproject.toml +39 -0
  48. modelith_dbt-0.1.0/packages/cli/src/mdl_cli/__init__.py +1 -0
  49. modelith_dbt-0.1.0/packages/cli/src/mdl_cli/collab.py +291 -0
  50. modelith_dbt-0.1.0/packages/cli/src/mdl_cli/main.py +1190 -0
  51. modelith_dbt-0.1.0/packages/cli/src/mdl_cli/scaffold.py +108 -0
  52. modelith_dbt-0.1.0/packages/cli/tests/test_collab.py +90 -0
  53. modelith_dbt-0.1.0/packages/cli/tests/test_delete.py +76 -0
  54. modelith_dbt-0.1.0/packages/core/pyproject.toml +17 -0
  55. modelith_dbt-0.1.0/packages/core/src/mdl_core/__init__.py +51 -0
  56. modelith_dbt-0.1.0/packages/core/src/mdl_core/commands.py +532 -0
  57. modelith_dbt-0.1.0/packages/core/src/mdl_core/diagnostics.py +52 -0
  58. modelith_dbt-0.1.0/packages/core/src/mdl_core/fingerprint.py +40 -0
  59. modelith_dbt-0.1.0/packages/core/src/mdl_core/governance_import.py +78 -0
  60. modelith_dbt-0.1.0/packages/core/src/mdl_core/ids.py +63 -0
  61. modelith_dbt-0.1.0/packages/core/src/mdl_core/ir.py +450 -0
  62. modelith_dbt-0.1.0/packages/core/src/mdl_core/merge.py +185 -0
  63. modelith_dbt-0.1.0/packages/core/src/mdl_core/merge_driver.py +184 -0
  64. modelith_dbt-0.1.0/packages/core/src/mdl_core/naming.py +137 -0
  65. modelith_dbt-0.1.0/packages/core/src/mdl_core/patterns.py +26 -0
  66. modelith_dbt-0.1.0/packages/core/src/mdl_core/regions.py +154 -0
  67. modelith_dbt-0.1.0/packages/core/src/mdl_core/repo.py +147 -0
  68. modelith_dbt-0.1.0/packages/core/src/mdl_core/state.py +99 -0
  69. modelith_dbt-0.1.0/packages/core/src/mdl_core/validate.py +263 -0
  70. modelith_dbt-0.1.0/packages/core/src/mdl_core/yaml_io.py +50 -0
  71. modelith_dbt-0.1.0/packages/core/tests/conftest.py +23 -0
  72. modelith_dbt-0.1.0/packages/core/tests/model_builders.py +106 -0
  73. modelith_dbt-0.1.0/packages/core/tests/test_categories.py +57 -0
  74. modelith_dbt-0.1.0/packages/core/tests/test_code_sets.py +32 -0
  75. modelith_dbt-0.1.0/packages/core/tests/test_collaboration.py +164 -0
  76. modelith_dbt-0.1.0/packages/core/tests/test_governance_import.py +77 -0
  77. modelith_dbt-0.1.0/packages/core/tests/test_ids.py +31 -0
  78. modelith_dbt-0.1.0/packages/core/tests/test_key_groups.py +60 -0
  79. modelith_dbt-0.1.0/packages/core/tests/test_regions_merge.py +73 -0
  80. modelith_dbt-0.1.0/packages/core/tests/test_udp.py +38 -0
  81. modelith_dbt-0.1.0/packages/core/tests/test_validate.py +36 -0
  82. modelith_dbt-0.1.0/packages/core/tests/test_yaml_roundtrip.py +49 -0
  83. modelith_dbt-0.1.0/packages/emit-dbt/pyproject.toml +17 -0
  84. modelith_dbt-0.1.0/packages/emit-dbt/src/mdl_emit_dbt/__init__.py +31 -0
  85. modelith_dbt-0.1.0/packages/emit-dbt/src/mdl_emit_dbt/emitter.py +552 -0
  86. modelith_dbt-0.1.0/packages/emit-dbt/src/mdl_emit_dbt/macros.py +65 -0
  87. modelith_dbt-0.1.0/packages/emit-dbt/src/mdl_emit_dbt/platforms.py +258 -0
  88. modelith_dbt-0.1.0/packages/emit-dbt/tests/conftest.py +22 -0
  89. modelith_dbt-0.1.0/packages/emit-dbt/tests/test_category_emit.py +60 -0
  90. modelith_dbt-0.1.0/packages/emit-dbt/tests/test_corpus.py +78 -0
  91. modelith_dbt-0.1.0/packages/emit-dbt/tests/test_emitter.py +50 -0
  92. modelith_dbt-0.1.0/packages/emit-dbt/tests/test_enum_emit.py +61 -0
  93. modelith_dbt-0.1.0/packages/emit-dbt/tests/test_keygroup_emit.py +99 -0
  94. modelith_dbt-0.1.0/packages/emit-dbt/tests/test_platforms.py +86 -0
  95. modelith_dbt-0.1.0/packages/emit-dbt/tests/test_properties.py +126 -0
  96. modelith_dbt-0.1.0/packages/emit-dbt/tests/test_udp_emit.py +57 -0
  97. modelith_dbt-0.1.0/packages/emit-semantic/pyproject.toml +17 -0
  98. modelith_dbt-0.1.0/packages/emit-semantic/src/mdl_emit_semantic/__init__.py +29 -0
  99. modelith_dbt-0.1.0/packages/emit-semantic/src/mdl_emit_semantic/import_osi.py +103 -0
  100. modelith_dbt-0.1.0/packages/emit-semantic/src/mdl_emit_semantic/joinability.py +104 -0
  101. modelith_dbt-0.1.0/packages/emit-semantic/src/mdl_emit_semantic/metricflow.py +100 -0
  102. modelith_dbt-0.1.0/packages/emit-semantic/src/mdl_emit_semantic/osi/__init__.py +21 -0
  103. modelith_dbt-0.1.0/packages/emit-semantic/src/mdl_emit_semantic/osi/v0_1_1.py +240 -0
  104. modelith_dbt-0.1.0/packages/emit-semantic/tests/conftest.py +22 -0
  105. modelith_dbt-0.1.0/packages/emit-semantic/tests/test_metricflow_joinability.py +89 -0
  106. modelith_dbt-0.1.0/packages/emit-semantic/tests/test_osi.py +77 -0
  107. modelith_dbt-0.1.0/packages/governance/pyproject.toml +20 -0
  108. modelith_dbt-0.1.0/packages/governance/src/mdl_governance/__init__.py +52 -0
  109. modelith_dbt-0.1.0/packages/governance/src/mdl_governance/conformance.py +101 -0
  110. modelith_dbt-0.1.0/packages/governance/src/mdl_governance/graph.py +137 -0
  111. modelith_dbt-0.1.0/packages/governance/src/mdl_governance/lineage.py +65 -0
  112. modelith_dbt-0.1.0/packages/governance/src/mdl_governance/profile.py +173 -0
  113. modelith_dbt-0.1.0/packages/governance/src/mdl_governance/spi.py +122 -0
  114. modelith_dbt-0.1.0/packages/governance/tests/conftest.py +25 -0
  115. modelith_dbt-0.1.0/packages/governance/tests/test_conformance_profiles.py +73 -0
  116. modelith_dbt-0.1.0/packages/governance/tests/test_graph_mapping.py +45 -0
  117. modelith_dbt-0.1.0/packages/governance/tests/test_lineage.py +59 -0
  118. modelith_dbt-0.1.0/packages/lsp/pyproject.toml +26 -0
  119. modelith_dbt-0.1.0/packages/lsp/src/mdl_lsp/__init__.py +5 -0
  120. modelith_dbt-0.1.0/packages/lsp/src/mdl_lsp/commands.py +113 -0
  121. modelith_dbt-0.1.0/packages/lsp/src/mdl_lsp/features.py +423 -0
  122. modelith_dbt-0.1.0/packages/lsp/src/mdl_lsp/server.py +139 -0
  123. modelith_dbt-0.1.0/packages/lsp/src/mdl_lsp/workspace.py +168 -0
  124. modelith_dbt-0.1.0/packages/lsp/tests/conftest.py +53 -0
  125. modelith_dbt-0.1.0/packages/lsp/tests/test_features.py +173 -0
  126. modelith_dbt-0.1.0/packages/lsp/tests/test_server_smoke.py +87 -0
  127. modelith_dbt-0.1.0/packages/ontology/pyproject.toml +21 -0
  128. modelith_dbt-0.1.0/packages/ontology/src/mdl_ontology/__init__.py +29 -0
  129. modelith_dbt-0.1.0/packages/ontology/src/mdl_ontology/layers.py +254 -0
  130. modelith_dbt-0.1.0/packages/ontology/src/mdl_ontology/lock.py +57 -0
  131. modelith_dbt-0.1.0/packages/ontology/src/mdl_ontology/rdf_export.py +137 -0
  132. modelith_dbt-0.1.0/packages/ontology/src/mdl_ontology/registry.py +270 -0
  133. modelith_dbt-0.1.0/packages/ontology/tests/test_layers.py +122 -0
  134. modelith_dbt-0.1.0/packages/ontology/tests/test_rdf_registry.py +118 -0
  135. modelith_dbt-0.1.0/packages/reverse/pyproject.toml +20 -0
  136. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/__init__.py +33 -0
  137. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/drift.py +271 -0
  138. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/erwin.py +211 -0
  139. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/ledger.py +132 -0
  140. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/lifting.py +169 -0
  141. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/manifest.py +200 -0
  142. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/projection.py +122 -0
  143. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/reconcile.py +112 -0
  144. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/regions_strip.py +20 -0
  145. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/render.py +123 -0
  146. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/reverse.py +345 -0
  147. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/schema_reader.py +83 -0
  148. modelith_dbt-0.1.0/packages/reverse/src/mdl_reverse/writer.py +60 -0
  149. modelith_dbt-0.1.0/packages/reverse/tests/conftest.py +17 -0
  150. modelith_dbt-0.1.0/packages/reverse/tests/manifest_fixtures.py +56 -0
  151. modelith_dbt-0.1.0/packages/reverse/tests/test_acceptance.py +71 -0
  152. modelith_dbt-0.1.0/packages/reverse/tests/test_apply_accepted_rels.py +83 -0
  153. modelith_dbt-0.1.0/packages/reverse/tests/test_catalog_merge.py +78 -0
  154. modelith_dbt-0.1.0/packages/reverse/tests/test_drift.py +132 -0
  155. modelith_dbt-0.1.0/packages/reverse/tests/test_erwin.py +73 -0
  156. modelith_dbt-0.1.0/packages/reverse/tests/test_ledger.py +62 -0
  157. modelith_dbt-0.1.0/packages/reverse/tests/test_lifting.py +60 -0
  158. modelith_dbt-0.1.0/packages/reverse/tests/test_reconcile.py +66 -0
  159. modelith_dbt-0.1.0/packages/reverse/tests/test_reverse_roundtrip.py +118 -0
  160. modelith_dbt-0.1.0/packages/server/pyproject.toml +26 -0
  161. modelith_dbt-0.1.0/packages/server/src/mdl_server/__init__.py +10 -0
  162. modelith_dbt-0.1.0/packages/server/src/mdl_server/app.py +193 -0
  163. modelith_dbt-0.1.0/packages/server/src/mdl_server/commands.py +13 -0
  164. modelith_dbt-0.1.0/packages/server/src/mdl_server/git_api.py +241 -0
  165. modelith_dbt-0.1.0/packages/server/src/mdl_server/glossary_api.py +124 -0
  166. modelith_dbt-0.1.0/packages/server/src/mdl_server/ontology_api.py +180 -0
  167. modelith_dbt-0.1.0/packages/server/src/mdl_server/projection.py +199 -0
  168. modelith_dbt-0.1.0/packages/server/src/mdl_server/static/assets/api-DzBdH2Xe.js +40 -0
  169. modelith_dbt-0.1.0/packages/server/src/mdl_server/static/assets/main-BK8BUP3j.js +23 -0
  170. modelith_dbt-0.1.0/packages/server/src/mdl_server/static/assets/main-D8ywi1-L.css +1 -0
  171. modelith_dbt-0.1.0/packages/server/src/mdl_server/static/assets/sme-C4-YfiO4.js +4 -0
  172. modelith_dbt-0.1.0/packages/server/src/mdl_server/static/assets/sme-CzQ2Ct56.css +1 -0
  173. modelith_dbt-0.1.0/packages/server/src/mdl_server/static/index.html +14 -0
  174. modelith_dbt-0.1.0/packages/server/src/mdl_server/static/sme.html +14 -0
  175. modelith_dbt-0.1.0/packages/server/tests/conftest.py +23 -0
  176. modelith_dbt-0.1.0/packages/server/tests/test_api.py +52 -0
  177. modelith_dbt-0.1.0/packages/server/tests/test_commands.py +251 -0
  178. modelith_dbt-0.1.0/packages/server/tests/test_glossary_api.py +90 -0
  179. modelith_dbt-0.1.0/packages/server/tests/test_glossary_source_of_truth.py +89 -0
  180. modelith_dbt-0.1.0/packages/server/tests/test_ontology_api.py +85 -0
  181. modelith_dbt-0.1.0/packages/server/tests/test_propose.py +107 -0
  182. modelith_dbt-0.1.0/profiles/ci/mdl-classify.yml +52 -0
  183. modelith_dbt-0.1.0/profiles/ci/mdl-drift.yml +42 -0
  184. modelith_dbt-0.1.0/profiles/ci/mdl-gov-sync.yml +36 -0
  185. modelith_dbt-0.1.0/profiles/ci/mdl-validate.yml +25 -0
  186. modelith_dbt-0.1.0/profiles/devcontainer/devcontainer.json +27 -0
  187. modelith_dbt-0.1.0/profiles/governance/collibra-glossary.yaml +29 -0
  188. modelith_dbt-0.1.0/profiles/governance/collibra-oob.yaml +46 -0
  189. modelith_dbt-0.1.0/profiles/governance/dbt-analytics.yaml +47 -0
  190. modelith_dbt-0.1.0/profiles/governance/minimal.yaml +24 -0
  191. modelith_dbt-0.1.0/pyproject.toml +94 -0
  192. modelith_dbt-0.1.0/uv.lock +1153 -0
  193. modelith_dbt-0.1.0/vscode/.vscode/launch.json +24 -0
  194. modelith_dbt-0.1.0/vscode/.vscode/tasks.json +11 -0
  195. modelith_dbt-0.1.0/vscode/.vscodeignore +7 -0
  196. modelith_dbt-0.1.0/vscode/CHANGELOG.md +16 -0
  197. modelith_dbt-0.1.0/vscode/PUBLISHING.md +99 -0
  198. modelith_dbt-0.1.0/vscode/README.md +57 -0
  199. modelith_dbt-0.1.0/vscode/esbuild.mjs +14 -0
  200. modelith_dbt-0.1.0/vscode/icon.png +0 -0
  201. modelith_dbt-0.1.0/vscode/icon.svg +12 -0
  202. modelith_dbt-0.1.0/vscode/package-lock.json +607 -0
  203. modelith_dbt-0.1.0/vscode/package.json +193 -0
  204. modelith_dbt-0.1.0/vscode/src/canvasPanel.ts +166 -0
  205. modelith_dbt-0.1.0/vscode/src/extension.ts +327 -0
  206. modelith_dbt-0.1.0/vscode/src/lspClient.ts +45 -0
  207. modelith_dbt-0.1.0/vscode/src/mdl.ts +160 -0
  208. modelith_dbt-0.1.0/vscode/src/schemas.ts +46 -0
  209. modelith_dbt-0.1.0/vscode/tsconfig.json +15 -0
@@ -0,0 +1,17 @@
1
+ {
2
+ "version": "0.0.1",
3
+ "configurations": [
4
+ {
5
+ "name": "canvas",
6
+ "runtimeExecutable": "uv",
7
+ "runtimeArgs": ["run", "mdl", "serve", "-m", "model", "--port", "4800"],
8
+ "port": 4800
9
+ },
10
+ {
11
+ "name": "ibor",
12
+ "runtimeExecutable": "uv",
13
+ "runtimeArgs": ["run", "mdl", "serve", "-m", "/tmp/pension-ibor/model", "--port", "4802"],
14
+ "port": 4802
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,26 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ .hypothesis/
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ .coverage
11
+ htmlcov/
12
+ # generated dbt projects live under target/ by default
13
+ target/
14
+ # canvas toolchain (the production build IS committed, under packages/server/.../static)
15
+ canvas/node_modules/
16
+ # vscode extension toolchain (source is committed; artifacts are not)
17
+ vscode/node_modules/
18
+ vscode/dist/
19
+ vscode/*.vsix
20
+
21
+ # local demo workspace (own git repo inside; never part of modelith)
22
+ demo/
23
+
24
+ # duckdb build artifacts
25
+ *.duckdb
26
+ *.duckdb.wal
@@ -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,269 @@
1
+ Metadata-Version: 2.5
2
+ Name: modelith-dbt
3
+ Version: 0.1.0
4
+ Summary: Ontology-anchored, git-native data modeling tool for dbt-core teams
5
+ License: Apache-2.0
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: dbt-artifacts-parser>=0.5
9
+ Requires-Dist: fastapi>=0.110
10
+ Requires-Dist: jinja2>=3.1
11
+ Requires-Dist: pydantic>=2.6
12
+ Requires-Dist: pygls>=2.0
13
+ Requires-Dist: pyshacl>=0.25
14
+ Requires-Dist: rdflib>=7.0
15
+ Requires-Dist: ruamel-yaml>=0.18
16
+ Requires-Dist: typer>=0.12
17
+ Requires-Dist: uvicorn>=0.29
18
+ Description-Content-Type: text/markdown
19
+
20
+ # Modelith
21
+
22
+ Ontology-anchored, git-native data modeling for dbt teams. Design your model as an
23
+ entity-relationship diagram, generate contract-enforced dbt from it, reverse an
24
+ existing warehouse back into a model, and catch drift before it ships. The model
25
+ lives in git as plain YAML, so every surface (the `mdl` CLI, the web canvas, the
26
+ VS Code extension, the drift bot) is a client and none of them owns state.
27
+
28
+ [![tests](https://img.shields.io/badge/tests-215%20passing-brightgreen)](#development)
29
+ [![python](https://img.shields.io/badge/python-3.11%2B-blue)](pyproject.toml)
30
+ [![dbt](https://img.shields.io/badge/dbt--core-1.7%2B-orange)](https://www.getdbt.com/)
31
+ [![license](https://img.shields.io/badge/license-Apache--2.0-lightgrey)](#license)
32
+ [![code style: ruff](https://img.shields.io/badge/lint-ruff-black)](https://docs.astral.sh/ruff/)
33
+
34
+ ![Modelith canvas: a seven-entity pension IBoR model with crow's-foot relationships](docs/assets/canvas.png)
35
+
36
+ ## Why
37
+
38
+ Warehouse teams keep their meaning in three disconnected places: an ER tool that
39
+ never sees production, dbt SQL that drifts from the design, and a governance catalog
40
+ nobody edits. Modelith puts one model in git and makes every tool read and write it.
41
+ You get a real data modeler (entities, attributes, keys, domains, relationships,
42
+ subtypes) that generates dbt you can actually run, verifies the warehouse still
43
+ matches the model, and reads a legacy dbt project (or an erwin export) back into a
44
+ clean logical model.
45
+
46
+ Nothing here is a mockup. Every capability below is exercised by the test suite and,
47
+ where it touches SQL, by a real `dbt build` against DuckDB.
48
+
49
+ ## Install
50
+
51
+ ```bash
52
+ uv tool install modelith-dbt # puts `mdl` on your PATH
53
+ # or: pipx install modelith-dbt
54
+ mdl --help
55
+ ```
56
+
57
+ Modelith runs in the same environment as dbt-core (Python 3.11+).
58
+
59
+ ## Quickstart
60
+
61
+ ```bash
62
+ mdl init my-model --name my_model # scaffold a model repo
63
+ mdl new entity customer -m my-model # add an entity (mints ULIDs)
64
+ mdl validate -m my-model # schema, refs, naming, ontology
65
+ mdl generate -m my-model -o warehouse # emit contract-enforced dbt
66
+ mdl serve -m my-model # open the visual canvas
67
+ ```
68
+
69
+ `mdl generate` writes dbt models with protected regions, a `schema.yml` carrying
70
+ contract constraints, and a three-way merge on regeneration, so your hand edits and
71
+ the generated blocks both survive.
72
+
73
+ ```text
74
+ $ mdl validate -m my-model
75
+ validation passed
76
+
77
+ $ mdl generate -m my-model -o warehouse
78
+ created models/customer.sql
79
+ created models/schema.yml
80
+ wrote 2 files to warehouse
81
+ ```
82
+
83
+ ## The visual canvas
84
+
85
+ `mdl serve` opens an ER canvas in the browser (also embeddable as a VS Code webview).
86
+ It is a full editor, not a viewer: drag between entities to draw a relationship, edit
87
+ attributes and keys inline, align a term to an ontology, and commit from a git panel.
88
+ Every edit is a typed, comment-preserving mutation with optimistic concurrency, so two
89
+ people can work the same repo without clobbering each other.
90
+
91
+ ![The entity inspector, showing attributes, named keys, an enumerated domain, user-defined properties, and relationships](docs/assets/inspector.png)
92
+
93
+ The inspector above shows one entity carrying an enumerated domain (`asset_class`),
94
+ a named primary key and a unique key, user-defined properties, and its relationships,
95
+ all first-class in the model.
96
+
97
+ ## In VS Code
98
+
99
+ Install the extension from `vscode/modelith-vscode-0.1.0.vsix`:
100
+
101
+ ```bash
102
+ code --install-extension vscode/modelith-vscode-0.1.0.vsix
103
+ ```
104
+
105
+ The extension does not bundle its own copy of the canvas. It launches `mdl serve`
106
+ and embeds the live canvas, so whatever the CLI understands, the editor shows. The
107
+ model files stay in git; the extension is just another client over them.
108
+
109
+ **Side by side: YAML, SQL, and the canvas.** Right-click a model file in the
110
+ Explorer (or in the open editor) and choose **Modelith: Open Model Preview to the
111
+ Side**. The canvas opens in a split beside your file and follows the active editor:
112
+ open `instrument.yaml` and the canvas centers on that entity; switch to a generated
113
+ `.sql` file and the preview tracks it. Save the YAML and the preview re-renders. You
114
+ read and edit the model as text on the left, watch the diagram update on the right,
115
+ and keep the generated dbt SQL a tab away, all in one window.
116
+
117
+ ![Split view in VS Code: the model YAML on the left, the live canvas preview on the right](docs/assets/vscode-split.png)
118
+
119
+ For a full editing session, **Modelith: Open Canvas** opens the editable canvas as
120
+ its own tab (drag-to-connect relationships, inline attribute and key editing,
121
+ git commit panel). The preview-to-the-side is the read-along companion while you work
122
+ in text; the full canvas is where you drive structural edits.
123
+
124
+ What the extension adds on top of the canvas:
125
+
126
+ - **Diagnostics on save.** `mdl validate` runs when you save a model YAML and surfaces
127
+ `MDL-*` findings in the Problems panel, mapped to the file that declares the issue.
128
+ - **Language server.** `mdl lsp` drives drift and contract diagnostics on the generated
129
+ dbt files, hover cards (glossary term, ontology IRI, owner), and code actions (adopt a
130
+ column, lift a model, unmanage, declare a relationship).
131
+ - **Commands.** Generate the dbt project, check drift, lint and fix naming, scaffold a new
132
+ entity, vendor an ontology, emit the semantic layer, all from the command palette.
133
+ - **YAML completion.** JSON Schemas exported from the model are registered with the Red Hat
134
+ YAML extension, so authoring the YAML by hand is schema-checked and autocompleted.
135
+ - **Devcontainer-ready.** The extension declares `extensionKind: ["workspace"]`, so in a
136
+ devcontainer the server and the `mdl` toolchain run next to dbt and your warehouse
137
+ credentials, not on the laptop.
138
+
139
+ Detection resolves `mdl` in order: an explicit `modelith.mdlPath` setting, a project
140
+ `.venv`, `mdl` on PATH, the active conda or virtualenv, then the common per-user install
141
+ locations. A standard `uv tool install modelith-dbt` needs no configuration.
142
+
143
+ ## What it models
144
+
145
+ Modelith represents the core data-modeling taxonomy as first-class, git-tracked objects:
146
+
147
+ | Concept | Support |
148
+ |---|---|
149
+ | Conceptual / logical / physical layers | Separate object kinds, referenced by immutable ULID |
150
+ | Entities and attributes | Name, domain, role (business key / surrogate / attribute / measure), nullability |
151
+ | Relationships | Four cardinalities, identifying vs non-identifying, optionality, crow's-foot rendering |
152
+ | Named keys | Primary, alternate, unique, and index key groups with ordered, composite members |
153
+ | Domains and reference data | Reusable domains, inline enumerations, and shared code sets that emit dbt `accepted_values` tests |
154
+ | Subtypes and supertypes | Category clusters with a discriminator and a physical materialization strategy (single-table or table-per-subtype) |
155
+ | User-defined properties | Extensible metadata on any object, flowing through to dbt `meta` |
156
+ | Subject areas | Diagram partitioning with color grouping on the canvas |
157
+ | Ontology alignment | Four-layer stack (industry / core / domain / specialised), SKOS predicates, FIBO out of the box |
158
+ | Design patterns | SCD2 and Data Vault (hub / link / satellite), emitting working SQL, not stubs |
159
+
160
+ ## What it does
161
+
162
+ **Forward engineering.** Generate dbt-core models with enforced contracts, primary and
163
+ unique key constraints, relationship tests, and platform-specific types for DuckDB,
164
+ Snowflake, Redshift, Iceberg, and Trino. Regeneration runs a three-way merge so hand
165
+ edits survive.
166
+
167
+ **Reverse engineering.** Point `mdl reverse` at a compiled dbt project (`manifest.json`
168
+ plus `catalog.json`) and get a logical model back. It excludes staging and intermediate
169
+ models, collapses SCD2 column triples into a pattern, strips surrogate keys, detects Data
170
+ Vault structures, and infers relationships from tests and naming, recording every decision
171
+ in a reviewable ledger.
172
+
173
+ **Drift detection.** `mdl drift` compares the committed model to a compiled warehouse and
174
+ classifies each difference as breaking, additive, or cosmetic, with a CI gate mode and a
175
+ reconcile mode. A 400-model breaking change classifies in under thirty seconds.
176
+
177
+ **Governance sync.** A neutral governance graph maps to an external catalog through a
178
+ customer-owned Jinja profile. A Collibra adapter ships, along with OpenLineage emission
179
+ and a conformance kit that validates a bespoke mapping in CI.
180
+
181
+ **Semantic layer.** Emit MetricFlow semantic models and metrics, or OSI (version-isolated),
182
+ with joinability and fan-out validation.
183
+
184
+ **Collaboration.** A structural, ULID-keyed git merge driver lets two people add different
185
+ attributes to the same entity and merge cleanly. A change classifier routes pull requests
186
+ to the right reviewers, a debt valve records engineer-owned SQL with an expiry, and a
187
+ git-native glossary app lets subject-matter experts propose definitions as pull requests
188
+ without ever seeing git or a CLI.
189
+
190
+ ## Surfaces
191
+
192
+ | Surface | What it is |
193
+ |---|---|
194
+ | `mdl` CLI | The full command set: init, validate, lint, generate, reverse, drift, serve, glossary, ontology, emit, export, import, gov, and more |
195
+ | Web canvas | `mdl serve` opens the ER editor; state stays in git |
196
+ | VS Code extension | Canvas beside your YAML (follows the active editor), full canvas tab, diagnostics on save, generate / drift / lint commands, YAML completion, devcontainer-ready. See [In VS Code](#in-vs-code). |
197
+ | Language server | `mdl lsp` (one server for VS Code, Cursor, Windsurf, JetBrains, and CI): drift and contract diagnostics on the dbt files, hover cards, code actions |
198
+ | Glossary app | `mdl glossary` serves a narrow, git-native glossary surface for subject-matter experts |
199
+
200
+ ## CLI reference
201
+
202
+ ```text
203
+ mdl init [--workspace] [--git-hooks] scaffold a model repo or full topology
204
+ mdl new entity|term|subject-area <name> add an object (ULIDs minted)
205
+ mdl delete entity <name> [--cascade] remove an object, safely
206
+ mdl validate [--format json] schema, refs, ontology, naming
207
+ mdl lint [--fix] naming-standards lint
208
+ mdl generate [--target] [--dry-run] emit the dbt project
209
+ mdl reverse --project <manifest|schema.yml> lift a dbt project into a model
210
+ mdl drift --manifest <m> [--check|--reconcile] compare model to compiled warehouse
211
+ mdl serve [--read-only] web canvas + read API
212
+ mdl glossary [--read-only] SME glossary app
213
+ mdl ontology search|check|promote|vendor vocabulary and alignment lifecycle
214
+ mdl emit semantic --format metricflow|osi semantic layer
215
+ mdl export json-schema|rdf|shacl interchange out
216
+ mdl import osi|erwin interchange in
217
+ mdl gov plan|apply|pull|publish|import catalog sync
218
+ mdl classify | unmanage | debt | decisions collaboration and review
219
+ ```
220
+
221
+ ## Layout
222
+
223
+ ```
224
+ packages/
225
+ core/ IR, ULID identity, YAML round-trip, validator, merge engine (no in-repo deps)
226
+ emit-dbt/ dbt-core emitter, platform adapters, SCD2 macros
227
+ reverse/ manifest + catalog reader, drift, reverse engineering, decision ledger, erwin import
228
+ ontology/ vocabulary registry, four-layer validation, RDF/OWL + SHACL export
229
+ emit-semantic/ MetricFlow + OSI, joinability validation
230
+ governance/ governance graph, Jinja mapping DSL, adapter SPI, conformance kit, OpenLineage
231
+ adapters/
232
+ collibra/ Collibra governance adapter
233
+ server/ read API (FastAPI) + hosts the canvas build
234
+ lsp/ language server (pygls)
235
+ cli/ mdl
236
+ canvas/ web canvas source (Vite + React + React Flow)
237
+ vscode/ VS Code extension (TypeScript + esbuild)
238
+ profiles/ CI workflow templates and reference governance profiles
239
+ ```
240
+
241
+ The layering rule is enforced: `core` depends on nothing else in the repo, and
242
+ `emit-dbt` depends only on `core`.
243
+
244
+ ## Development
245
+
246
+ ```bash
247
+ uv sync
248
+ uv run pytest # 215 tests
249
+ uv run ruff check packages/
250
+ ```
251
+
252
+ Build the canvas and the extension (Node 20):
253
+
254
+ ```bash
255
+ cd canvas && npm install && npm run build # emits into the server static dir
256
+ cd vscode && npm install && npm run build && npm run package # produces the .vsix
257
+ ```
258
+
259
+ ## Documentation
260
+
261
+ - [`docs/adoption-guide.md`](docs/adoption-guide.md): a step-by-step runbook for taking a
262
+ team from an empty repo to a working practice (platform, then SMEs, architects, engineers).
263
+ - [`docs/collaboration-model.md`](docs/collaboration-model.md): the operating model, review
264
+ routes, and the merge driver.
265
+ - [`modelith-spec.md`](modelith-spec.md): the full build specification.
266
+
267
+ ## License
268
+
269
+ Apache-2.0.