dagster-dex 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.
- dagster_dex-0.1.0/LICENSE +201 -0
- dagster_dex-0.1.0/PKG-INFO +301 -0
- dagster_dex-0.1.0/README.md +269 -0
- dagster_dex-0.1.0/pyproject.toml +159 -0
- dagster_dex-0.1.0/setup.cfg +4 -0
- dagster_dex-0.1.0/src/dagster_dex/__init__.py +51 -0
- dagster_dex-0.1.0/src/dagster_dex/artifact.py +243 -0
- dagster_dex-0.1.0/src/dagster_dex/conformance.py +579 -0
- dagster_dex-0.1.0/src/dagster_dex/declarations.py +442 -0
- dagster_dex-0.1.0/src/dagster_dex/dex.py +845 -0
- dagster_dex-0.1.0/src/dagster_dex/model.py +348 -0
- dagster_dex-0.1.0/src/dagster_dex/project.py +345 -0
- dagster_dex-0.1.0/src/dagster_dex/protocol.py +142 -0
- dagster_dex-0.1.0/src/dagster_dex/py.typed +0 -0
- dagster_dex-0.1.0/src/dagster_dex.egg-info/PKG-INFO +301 -0
- dagster_dex-0.1.0/src/dagster_dex.egg-info/SOURCES.txt +25 -0
- dagster_dex-0.1.0/src/dagster_dex.egg-info/dependency_links.txt +1 -0
- dagster_dex-0.1.0/src/dagster_dex.egg-info/entry_points.txt +2 -0
- dagster_dex-0.1.0/src/dagster_dex.egg-info/requires.txt +10 -0
- dagster_dex-0.1.0/src/dagster_dex.egg-info/top_level.txt +1 -0
- dagster_dex-0.1.0/tests/test_artifact.py +217 -0
- dagster_dex-0.1.0/tests/test_ascii_only.py +200 -0
- dagster_dex-0.1.0/tests/test_conformance.py +33 -0
- dagster_dex-0.1.0/tests/test_dex_bridge.py +862 -0
- dagster_dex-0.1.0/tests/test_packaging.py +69 -0
- dagster_dex-0.1.0/tests/test_project.py +419 -0
- dagster_dex-0.1.0/tests/test_upstream_contract.py +399 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 David Anaya
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dagster-dex
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Let dex read your Dagster asset graph the way it reads a dbt project: keys, joins, sources, semantics, drift
|
|
5
|
+
Author: David Anaya
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/catincloud-labs/dagster-dex
|
|
8
|
+
Project-URL: Repository, https://github.com/catincloud-labs/dagster-dex
|
|
9
|
+
Project-URL: Issues, https://github.com/catincloud-labs/dagster-dex/issues
|
|
10
|
+
Keywords: dagster,dex,dbt,data-quality,drift,project-format
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Database
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: pyyaml>=6.0
|
|
25
|
+
Provides-Extra: dagster
|
|
26
|
+
Requires-Dist: dagster>=1.13; extra == "dagster"
|
|
27
|
+
Provides-Extra: dex
|
|
28
|
+
Requires-Dist: exmergo-dex-core~=1.6.4; extra == "dex"
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: pytest>=8.4; extra == "test"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# dagster-dex
|
|
34
|
+
|
|
35
|
+
A Dagster asset graph read as a **project format** for
|
|
36
|
+
[dex](https://github.com/exmergo/dex), and the tiered seam it proposes for
|
|
37
|
+
reading one.
|
|
38
|
+
|
|
39
|
+
Copyright 2026 David Anaya. Apache-2.0.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install dagster-dex # the core: no orchestrator, no engine
|
|
43
|
+
pip install 'dagster-dex[dex]' # with the dex-core boundary
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or from source, for `main` ahead of the last release:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install 'git+https://github.com/catincloud-labs/dagster-dex'
|
|
50
|
+
pip install 'dagster-dex[dex] @ git+https://github.com/catincloud-labs/dagster-dex'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Python 3.10+, matching Dagster's own floor. The `[dex]` extra needs 3.11+,
|
|
54
|
+
because the engine does: on 3.10 you can still reduce a graph and write an
|
|
55
|
+
artifact for a machine that has the engine to read it.
|
|
56
|
+
|
|
57
|
+
Once installed, dex can name this format directly:
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
# .dex/config.yml
|
|
61
|
+
project:
|
|
62
|
+
format: dagster
|
|
63
|
+
options:
|
|
64
|
+
assets: my_project.definitions:all_assets
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**dex** reads a project's declared structure (keys, joins, sources, semantics)
|
|
68
|
+
and reports where the warehouse has drifted from it. It reads dbt projects
|
|
69
|
+
natively. This package makes a Dagster asset graph readable the same way,
|
|
70
|
+
without the graph having to pretend to be a dbt project first.
|
|
71
|
+
|
|
72
|
+
## What this is
|
|
73
|
+
|
|
74
|
+
A working sketch of a contract, not a finished integration. It exists to make a
|
|
75
|
+
design argument concrete enough to disagree with: an asset graph is a perfectly
|
|
76
|
+
good source of project truth, and reading one does not require it to pretend to
|
|
77
|
+
be a dbt project first.
|
|
78
|
+
|
|
79
|
+
## The seam, in three tiers
|
|
80
|
+
|
|
81
|
+
| Tier | Adds | A format implements it when |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| `ProjectSource` | `declarations()` | it can say what it declares |
|
|
84
|
+
| `FingerprintedProject` | `fingerprint()` | it can be a drift baseline |
|
|
85
|
+
| `EditableProject` | `propose_edits()` | its source of truth can receive an edit |
|
|
86
|
+
|
|
87
|
+
`DagsterProject` implements tiers 1 and 2, and **not** tier 3 - not by setting a
|
|
88
|
+
flag, but by not having the method. `isinstance(project, EditableProject)` is
|
|
89
|
+
False, so a caller finds out by asking rather than by receiving an empty result
|
|
90
|
+
that looks like success. A generated project is safe from stray writes today
|
|
91
|
+
only where a naming convention happens not to match; declining a tier makes that
|
|
92
|
+
structural.
|
|
93
|
+
|
|
94
|
+
## Four model decisions worth arguing about
|
|
95
|
+
|
|
96
|
+
**A key is always a tuple of columns.** A single-column grain is the `n == 1`
|
|
97
|
+
case, not a different type. Modelling it the other way is what makes a composite
|
|
98
|
+
grain inexpressible until someone widens the type - and after widening, every
|
|
99
|
+
reader handles two shapes forever.
|
|
100
|
+
|
|
101
|
+
**There is no project directory.** A path is one format's way of locating
|
|
102
|
+
itself, not a property every project has.
|
|
103
|
+
|
|
104
|
+
**Freshness is a tri-state.** `FRESH` / `STALE` / `NOT_APPLICABLE`. A boolean
|
|
105
|
+
cannot tell "current" from "there is no such artifact here", so a format with
|
|
106
|
+
nothing to compile reports itself identically to one that just compiled.
|
|
107
|
+
|
|
108
|
+
**A required field is a refusal to invent.** `ExternalSource` requires a source
|
|
109
|
+
system because the consumer requires one; making it optional would only move the
|
|
110
|
+
moment of invention into the boundary code, where a fabricated value cannot be
|
|
111
|
+
told from a declared one. Where the consumer requires something a project may
|
|
112
|
+
genuinely lack, such as a file path, the field is optional here and the loss is
|
|
113
|
+
reported instead of filled in.
|
|
114
|
+
|
|
115
|
+
## External sources: the edge a graph cannot see
|
|
116
|
+
|
|
117
|
+
Everything in `models` is something the project builds. `ExternalSource` is
|
|
118
|
+
where it stops and depends on a warehouse object somebody else keeps honoring.
|
|
119
|
+
|
|
120
|
+
These **cannot be derived from the asset graph**. A model that reads a table in
|
|
121
|
+
its own SQL, because the source system offers no other interface, draws no
|
|
122
|
+
dependency edge, so the read is invisible to any amount of traversal. It is
|
|
123
|
+
genuinely extra information and has to be declared, keyed by the model that
|
|
124
|
+
reads it. A format that inferred sources from dependencies would find none and
|
|
125
|
+
look like it had checked.
|
|
126
|
+
|
|
127
|
+
They are not decorative on the consumer side either: they drive a
|
|
128
|
+
`dangling_source` finding and the set of tables a project is understood to
|
|
129
|
+
cover. A format that reports none silently narrows its own blast radius.
|
|
130
|
+
|
|
131
|
+
## Layout, and why the dependencies sit where they do
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
model.py the neutral model stdlib only
|
|
135
|
+
protocol.py the tiered seam stdlib only
|
|
136
|
+
declarations.py input parsing + pyyaml
|
|
137
|
+
project.py the Dagster reduction + dagster, lazily
|
|
138
|
+
conformance.py the importable contract + pytest
|
|
139
|
+
dex.py the dex-core boundary + exmergo-dex-core, lazily
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The engine coupling is one file. Everything else, including the conformance
|
|
143
|
+
suite, runs with dex-core uninstalled, which is what keeps the design from
|
|
144
|
+
being shaped by whatever the engine happens to look like today. `dex.py` imports
|
|
145
|
+
**public API only**; `tests/test_dex_bridge.py` asserts that with an AST walk
|
|
146
|
+
rather than trusting it.
|
|
147
|
+
|
|
148
|
+
## Running it
|
|
149
|
+
|
|
150
|
+
From the repository root:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# the core: no orchestrator, no engine
|
|
154
|
+
uv run --no-project --with-editable . \
|
|
155
|
+
--with pytest==8.4.1 \
|
|
156
|
+
python -m pytest tests \
|
|
157
|
+
--ignore=tests/test_dex_bridge.py \
|
|
158
|
+
--ignore=tests/test_upstream_contract.py
|
|
159
|
+
|
|
160
|
+
# with the engine, to exercise the boundary
|
|
161
|
+
uv run --no-project --with-editable . \
|
|
162
|
+
--with pytest==8.4.1 --with exmergo-dex-core==1.6.4 --with sqlglot==30.13.0 \
|
|
163
|
+
python -m pytest tests \
|
|
164
|
+
--ignore=tests/test_upstream_contract.py
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
`--with-editable` is not optional: without it the package is never installed and
|
|
168
|
+
every test errors at collection on `No module named 'dagster_dex'`. These
|
|
169
|
+
are the two commands CI runs, and the first is a **control**: it is what holds
|
|
170
|
+
the engine coupling to one file, so an `exmergo_dex_core` import anywhere else
|
|
171
|
+
turns it red at collection.
|
|
172
|
+
|
|
173
|
+
The engine is pinned to `==1.6.4` here and in CI, which is **not** what the
|
|
174
|
+
`[dex]` extra publishes. The extra is `~=1.6.4`, so consumers are not forced onto
|
|
175
|
+
one patch release; the exact pin is where the demonstration lives, because a
|
|
176
|
+
claim about what passed should name the version it passed against.
|
|
177
|
+
|
|
178
|
+
### Against dex-core's own contract
|
|
179
|
+
|
|
180
|
+
`tests/test_upstream_contract.py` runs this format against the conformance suite
|
|
181
|
+
**dex-core ships**, which is upstream's acceptance criterion for a second project
|
|
182
|
+
format (`exmergo/dex#144`). That suite ships in **v1.5.2**, released 2026-08-05,
|
|
183
|
+
via [`exmergo/dex#192`](https://github.com/exmergo/dex/pull/192) - our own PR, so
|
|
184
|
+
the criterion is now judged by upstream's released code rather than by a branch:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
DEX_UPSTREAM_CONTRACT_REQUIRED=1 \
|
|
188
|
+
uv run --no-project --with-editable . \
|
|
189
|
+
--with pytest==8.4.1 --with exmergo-dex-core==1.6.4 --with sqlglot==30.13.0 \
|
|
190
|
+
python -m pytest tests/test_upstream_contract.py
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`DEX_UPSTREAM_CONTRACT_REQUIRED=1` is what makes it a signal, and the release did
|
|
194
|
+
not change that. Without the variable the file skips itself when the contract is
|
|
195
|
+
unimportable, which is right at a developer's desk and wrong in CI, where an unrun
|
|
196
|
+
file and a passing file look the same. With it, a missing contract is a collection
|
|
197
|
+
error - which still matters against a release, because a yank or a bad bump lands
|
|
198
|
+
in exactly the same place a rewritten branch used to.
|
|
199
|
+
|
|
200
|
+
## Using the contract on another format
|
|
201
|
+
|
|
202
|
+
```python
|
|
203
|
+
from dagster_dex.conformance import FingerprintedProjectContract
|
|
204
|
+
|
|
205
|
+
class TestMyFormat(FingerprintedProjectContract):
|
|
206
|
+
def make_project(self, declarations, semantics, sources):
|
|
207
|
+
return MyProject(declaration_sources=declarations,
|
|
208
|
+
semantic_sources=semantics,
|
|
209
|
+
source_declarations=sources)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
The assertions that matter most are behavioural: `declarations()` must not raise
|
|
213
|
+
on an absent, empty, or malformed project. That is the property a second
|
|
214
|
+
implementation is most likely to get wrong, and a suite checking only shapes
|
|
215
|
+
will pass it.
|
|
216
|
+
|
|
217
|
+
`make_project` took two arguments before external sources landed. The third
|
|
218
|
+
is a **breaking change to this contract**, taken deliberately while the suite has
|
|
219
|
+
no outside implementers rather than carried forever as an optional hook that
|
|
220
|
+
could be skipped - and a skipped assertion is not a passing one.
|
|
221
|
+
|
|
222
|
+
## Status
|
|
223
|
+
|
|
224
|
+
**Alpha, and the contract may move before 1.0.** The tiered seam is a proposal,
|
|
225
|
+
not a settled interface: it exists to be argued with, and the argument may change
|
|
226
|
+
it. Pin the minor if you depend on it.
|
|
227
|
+
|
|
228
|
+
**The entry point stopped being inert on 2026-08-08.** This section used to end:
|
|
229
|
+
*"nothing resolves it today, and an entry point nobody looks up is inert."*
|
|
230
|
+
dex-core **1.6.0** added resolution for exactly the `exmergo_dex_core.projects`
|
|
231
|
+
group this package has declared since `0.1.0` - a format can now be named from
|
|
232
|
+
`.dex/config.yml`, from a dotted `mypkg.projects:my_project` path, or from that
|
|
233
|
+
entry-point group, with `--project-format` overriding on the CLI.
|
|
234
|
+
|
|
235
|
+
That arrived through [`exmergo/dex#171`](https://github.com/exmergo/dex/issues/171),
|
|
236
|
+
which this package's own constraint shaped: a host reaching dex as a subprocess
|
|
237
|
+
cannot hand an object in, so name resolution was the only door that worked.
|
|
238
|
+
|
|
239
|
+
**And it was registered wrong.** That paragraph originally ended *"what is left
|
|
240
|
+
between here and a resolvable format is packaging, not design"*, written before
|
|
241
|
+
anyone had run it. Resolution found the entry point immediately and then refused:
|
|
242
|
+
it named the **class**, and dex-core's `ProjectFactory` calls what it resolves
|
|
243
|
+
**with a `ProjectContext`**, so the context bound to `models`. A second gap sat
|
|
244
|
+
behind it: a bare `DagsterProject` is refused as *"missing name, definitions"*,
|
|
245
|
+
because this package says `format`/`declarations()` where the seam says
|
|
246
|
+
`name`/`definitions()`.
|
|
247
|
+
|
|
248
|
+
=> The lesson is worth more than the fix: **a declared-but-unresolved extension
|
|
249
|
+
point is not evidence that registration works.** It was inert from `0.1.0`, so
|
|
250
|
+
there was no moment before 2026-08-08 at which it could have failed.
|
|
251
|
+
|
|
252
|
+
Both are fixed. The entry point names `dex:project_from_context`, which takes a
|
|
253
|
+
context and returns a `DexProject`, and a regression test asserts the registration
|
|
254
|
+
*and* that it loads to the callable.
|
|
255
|
+
|
|
256
|
+
**This paragraph used to end with a hand-counted end-to-end result** - a model
|
|
257
|
+
count, a source count, semantic models and metrics, from dex driven as a
|
|
258
|
+
subprocess against a private asset graph. It was true where it was written and it
|
|
259
|
+
is unverifiable here: nobody outside can run it, and it was four numbers in a
|
|
260
|
+
document, which is the thing this project's own rules forbid. What replaces it is
|
|
261
|
+
smaller and checkable by anyone:
|
|
262
|
+
|
|
263
|
+
| Verified in CI, every commit | Where |
|
|
264
|
+
| --- | --- |
|
|
265
|
+
| The suite passes with the engine uninstalled | control step |
|
|
266
|
+
| The suite passes against the engine | boundary step |
|
|
267
|
+
| The format passes dex-core's own project contract | criterion step |
|
|
268
|
+
| The reduction works on real Dagster objects | reduction step |
|
|
269
|
+
| The annotations type-check at the floor | type check |
|
|
270
|
+
| The built wheel imports, declares its entry point, ships `py.typed` | release workflow |
|
|
271
|
+
|
|
272
|
+
Everything above runs from a clean checkout with two commands and no access to
|
|
273
|
+
anything private, which is the property the old sentence did not have.
|
|
274
|
+
|
|
275
|
+
### Two ways to name the project, and the reason there are two
|
|
276
|
+
|
|
277
|
+
`assets:` reduces a live asset graph in the calling process. That is the honest
|
|
278
|
+
form, and on a real project it costs **~2.6 s** - almost entirely the import of
|
|
279
|
+
the code location, which is not something laziness or caching can reach, because
|
|
280
|
+
a host that builds a project per command never holds one long enough to amortize
|
|
281
|
+
it.
|
|
282
|
+
|
|
283
|
+
`artifact:` is the answer for a host that cannot pay that: the side that already
|
|
284
|
+
has the graph reduces it once and writes the result down, and the side that
|
|
285
|
+
answers requests reads it back.
|
|
286
|
+
|
|
287
|
+
```yaml
|
|
288
|
+
project:
|
|
289
|
+
format: dagster
|
|
290
|
+
options:
|
|
291
|
+
artifact: project/my_project.json # written by dagster_dex.artifact.dumps
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Exactly one of the two is required, and naming both is refused rather than
|
|
295
|
+
resolved: a snapshot and a live graph disagree by design. An artifact carries
|
|
296
|
+
its own declarations and its own name, so `declarations:`/`semantics:`/`sources:`
|
|
297
|
+
and `name:` are refused beside it rather than silently ignored.
|
|
298
|
+
|
|
299
|
+
**A missing artifact is refused, not read as an empty project.** An empty
|
|
300
|
+
project is a valid one, so the tolerant reading would report a broken deploy as a
|
|
301
|
+
warehouse with nothing declared, quietly, and for as long as it lasted.
|