dbt-tree 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.
@@ -0,0 +1,23 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.10", "3.11", "3.12"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - run: pip install -e ".[dev]"
20
+ - name: Lint (ruff)
21
+ run: ruff check src tests
22
+ - name: Unit tests
23
+ run: pytest -q
@@ -0,0 +1,67 @@
1
+ name: release
2
+
3
+ # Publishes to PyPI via Trusted Publishing (OIDC) — no API tokens needed.
4
+ # Fires when you publish a GitHub Release (e.g. for tag v0.1.0).
5
+
6
+ on:
7
+ release:
8
+ types: [published]
9
+ workflow_dispatch:
10
+ inputs:
11
+ target:
12
+ description: "Publish target"
13
+ type: choice
14
+ default: testpypi
15
+ options: [testpypi, pypi]
16
+
17
+ jobs:
18
+ build:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.12"
25
+ - run: python -m pip install --upgrade build twine
26
+ - run: python -m build
27
+ - run: python -m twine check dist/*
28
+ - uses: actions/upload-artifact@v4
29
+ with:
30
+ name: dist
31
+ path: dist/
32
+
33
+ publish-pypi:
34
+ # Real PyPI on a published release, or manual dispatch with target=pypi.
35
+ if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.target == 'pypi')
36
+ needs: build
37
+ runs-on: ubuntu-latest
38
+ environment:
39
+ name: pypi
40
+ url: https://pypi.org/p/dbt-tree
41
+ permissions:
42
+ id-token: write # required for Trusted Publishing
43
+ steps:
44
+ - uses: actions/download-artifact@v4
45
+ with:
46
+ name: dist
47
+ path: dist/
48
+ - uses: pypa/gh-action-pypi-publish@release/v1
49
+
50
+ publish-testpypi:
51
+ # Dry-run channel: manual dispatch with target=testpypi (the default).
52
+ if: github.event_name == 'workflow_dispatch' && inputs.target == 'testpypi'
53
+ needs: build
54
+ runs-on: ubuntu-latest
55
+ environment:
56
+ name: testpypi
57
+ url: https://test.pypi.org/p/dbt-tree
58
+ permissions:
59
+ id-token: write
60
+ steps:
61
+ - uses: actions/download-artifact@v4
62
+ with:
63
+ name: dist
64
+ path: dist/
65
+ - uses: pypa/gh-action-pypi-publish@release/v1
66
+ with:
67
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ venv/
5
+ *.egg-info/
6
+ build/
7
+ dist/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .DS_Store
dbt_tree-0.1.0/LICENSE ADDED
@@ -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,13 @@
1
+ .PHONY: install test lint fmt
2
+
3
+ install:
4
+ pip install -e ".[dev]"
5
+
6
+ test:
7
+ pytest -q
8
+
9
+ lint:
10
+ ruff check .
11
+
12
+ fmt:
13
+ ruff format .
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.4
2
+ Name: dbt-tree
3
+ Version: 0.1.0
4
+ Summary: Pretty terminal lineage tree for dbt selectors (dbt-tree "model+").
5
+ Project-URL: Homepage, https://github.com/KarthikRajashekaran/dbt-tree
6
+ Project-URL: Issues, https://github.com/KarthikRajashekaran/dbt-tree/issues
7
+ Author: Karthik Rajashekaran
8
+ License: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: cli,dag,data-engineering,dbt,lineage,tree
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Build Tools
18
+ Classifier: Topic :: Utilities
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: rich>=13.0
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=7.4; extra == 'dev'
23
+ Requires-Dist: ruff>=0.4; extra == 'dev'
24
+ Description-Content-Type: text/markdown
25
+
26
+ # dbt-tree
27
+
28
+ Pretty terminal lineage tree for dbt selectors. Run a selector, get a readable
29
+ tree of the resulting DAG right in your terminal — no docs server, no browser.
30
+
31
+ ```bash
32
+ dbt-tree "my_model+"
33
+ ```
34
+
35
+ `dbt-tree` forwards the selector **verbatim** to `dbt ls`, so every dbt selector
36
+ works exactly as it does in dbt itself: `model+`, `+model`, `+model+`,
37
+ `2+model+3`, `tag:nightly+`, `path:models/marts`, set unions, and so on.
38
+
39
+ ## Requirements
40
+
41
+ - A working **dbt-core** install that you can run as `dbt` (any virtualenv tool is
42
+ fine — `venv`, `virtualenv`, `conda`, `poetry`, `uv`, …). The only requirement
43
+ is that the `dbt` executable is reachable (active venv, on `PATH`, or via
44
+ `$DBT_TREE_DBT` / `--dbt-executable`).
45
+ - Python 3.10+.
46
+
47
+ `dbt ls` is parse-only, so **no warehouse connection is needed** to draw the tree.
48
+
49
+ ## Install
50
+
51
+ Install into the **same environment as your dbt** so they share a `PATH`:
52
+
53
+ ```bash
54
+ pip install dbt-tree # once published
55
+ # or, from source:
56
+ pip install "git+https://github.com/KarthikRajashekaran/dbt-tree.git"
57
+ ```
58
+
59
+ `dbt` itself is **not** a Python dependency — `dbt-tree` shells out to your
60
+ existing dbt rather than pinning a version.
61
+
62
+ ### Which dbt does it use?
63
+
64
+ Resolution order:
65
+
66
+ 1. `--dbt-executable`
67
+ 2. `$DBT_TREE_DBT`
68
+ 3. **the active virtualenv** (`$VIRTUAL_ENV/bin/dbt`) — so once you activate your
69
+ dbt venv, dbt-tree uses the same dbt as your shell
70
+ 4. `dbt` on `PATH`
71
+
72
+ dbt-tree prefers **dbt-core** and will skip a **dbt Fusion** binary when a core
73
+ install is available (Fusion's stricter parsing and different `ls` surface aren't
74
+ supported yet).
75
+
76
+ ### Recommended workflow:
77
+
78
+ ```bash
79
+ gva # activate your dbt venv (dbt-core)
80
+ dbt-tree "my_model+"
81
+ ```
82
+
83
+ Tip: `pip install` dbt-tree *into that same dbt venv* so `gva` puts both `dbt` and
84
+ `dbt-tree` on your `PATH` together.
85
+
86
+ ## Usage
87
+
88
+ ```bash
89
+ # Downstream lineage
90
+ dbt-tree "my_model+"
91
+
92
+ # Upstream lineage
93
+ dbt-tree "+my_model"
94
+
95
+ # Scope / dbt passthrough
96
+ dbt-tree "tag:nightly+" --target prod --project-dir dbt/my_project
97
+ ```
98
+
99
+ Example output:
100
+
101
+ ```text
102
+ my_model (view) *
103
+ └── stg_orders (table)
104
+ └── int_orders_joined (table)
105
+ ├── fct_orders (table)
106
+ │ ├── mart_revenue (table)
107
+ │ └── ...
108
+ └── fct_order_items (table)
109
+ ```
110
+
111
+ The originally-selected model is marked with `*`. Nodes are colored by resource
112
+ type; the suffix shows materialization (`table`/`view`) or resource type
113
+ (`source`/`seed`/`snapshot`).
114
+
115
+ ### Orientation follows the selector
116
+
117
+ The tree is rooted so the focal model is always at the top:
118
+
119
+ - `model+` (downstream) — root is the model, children are its descendants.
120
+ - `+model` (upstream) — root is the model, children are its **ancestors** (up to
121
+ sources/seeds).
122
+ - `+model+` (both) — two sections: `▲ ancestors` then `▼ descendants`.
123
+
124
+ ## How it works
125
+
126
+ 1. Runs `dbt --quiet ls --output json --output-keys ... --select <selector>`.
127
+ 2. Keeps models, sources, seeds, and snapshots (tests off unless `--include-tests`).
128
+ 3. Builds child adjacency **within the selected set**, finds roots, and expands a
129
+ duplicated tree (Unix `tree` style) with cycle and node-count guards.
130
+ 4. Renders a `rich` tree (duplicating shared subtrees, `tree`-command style).
131
+
132
+ ## Options
133
+
134
+ | flag | default | meaning |
135
+ |---|---|---|
136
+ | `--target` | — | dbt target |
137
+ | `--project-dir` | — | dbt project directory |
138
+ | `--profiles-dir` | — | dbt profiles directory |
139
+ | `--dbt-executable` | `dbt` | path to dbt |
140
+ | `--include-tests` | off | include data/unit tests as nodes |
141
+ | `--max-depth` | `0` | limit depth (0 = unlimited) |
142
+ | `--max-nodes` | `5000` | safety cap on rendered nodes |
143
+ | `--no-color` | off | disable color in plain output |
144
+
145
+ Unknown flags are forwarded to `dbt ls` as an escape hatch.
146
+
147
+ ## Limitations
148
+
149
+ - **Single project.** Lineage covers whatever `dbt ls` resolves in the active
150
+ project; it does not stitch across sibling projects in a monorepo.
151
+ - Selector parsing is dbt's, so behavior matches your installed dbt version.
152
+
153
+ ## Development
154
+
155
+ ```bash
156
+ pip install -e ".[dev]"
157
+ pytest
158
+ ruff check .
159
+ ```
160
+
161
+ ## License
162
+
163
+ Apache-2.0
@@ -0,0 +1,138 @@
1
+ # dbt-tree
2
+
3
+ Pretty terminal lineage tree for dbt selectors. Run a selector, get a readable
4
+ tree of the resulting DAG right in your terminal — no docs server, no browser.
5
+
6
+ ```bash
7
+ dbt-tree "my_model+"
8
+ ```
9
+
10
+ `dbt-tree` forwards the selector **verbatim** to `dbt ls`, so every dbt selector
11
+ works exactly as it does in dbt itself: `model+`, `+model`, `+model+`,
12
+ `2+model+3`, `tag:nightly+`, `path:models/marts`, set unions, and so on.
13
+
14
+ ## Requirements
15
+
16
+ - A working **dbt-core** install that you can run as `dbt` (any virtualenv tool is
17
+ fine — `venv`, `virtualenv`, `conda`, `poetry`, `uv`, …). The only requirement
18
+ is that the `dbt` executable is reachable (active venv, on `PATH`, or via
19
+ `$DBT_TREE_DBT` / `--dbt-executable`).
20
+ - Python 3.10+.
21
+
22
+ `dbt ls` is parse-only, so **no warehouse connection is needed** to draw the tree.
23
+
24
+ ## Install
25
+
26
+ Install into the **same environment as your dbt** so they share a `PATH`:
27
+
28
+ ```bash
29
+ pip install dbt-tree # once published
30
+ # or, from source:
31
+ pip install "git+https://github.com/KarthikRajashekaran/dbt-tree.git"
32
+ ```
33
+
34
+ `dbt` itself is **not** a Python dependency — `dbt-tree` shells out to your
35
+ existing dbt rather than pinning a version.
36
+
37
+ ### Which dbt does it use?
38
+
39
+ Resolution order:
40
+
41
+ 1. `--dbt-executable`
42
+ 2. `$DBT_TREE_DBT`
43
+ 3. **the active virtualenv** (`$VIRTUAL_ENV/bin/dbt`) — so once you activate your
44
+ dbt venv, dbt-tree uses the same dbt as your shell
45
+ 4. `dbt` on `PATH`
46
+
47
+ dbt-tree prefers **dbt-core** and will skip a **dbt Fusion** binary when a core
48
+ install is available (Fusion's stricter parsing and different `ls` surface aren't
49
+ supported yet).
50
+
51
+ ### Recommended workflow:
52
+
53
+ ```bash
54
+ gva # activate your dbt venv (dbt-core)
55
+ dbt-tree "my_model+"
56
+ ```
57
+
58
+ Tip: `pip install` dbt-tree *into that same dbt venv* so `gva` puts both `dbt` and
59
+ `dbt-tree` on your `PATH` together.
60
+
61
+ ## Usage
62
+
63
+ ```bash
64
+ # Downstream lineage
65
+ dbt-tree "my_model+"
66
+
67
+ # Upstream lineage
68
+ dbt-tree "+my_model"
69
+
70
+ # Scope / dbt passthrough
71
+ dbt-tree "tag:nightly+" --target prod --project-dir dbt/my_project
72
+ ```
73
+
74
+ Example output:
75
+
76
+ ```text
77
+ my_model (view) *
78
+ └── stg_orders (table)
79
+ └── int_orders_joined (table)
80
+ ├── fct_orders (table)
81
+ │ ├── mart_revenue (table)
82
+ │ └── ...
83
+ └── fct_order_items (table)
84
+ ```
85
+
86
+ The originally-selected model is marked with `*`. Nodes are colored by resource
87
+ type; the suffix shows materialization (`table`/`view`) or resource type
88
+ (`source`/`seed`/`snapshot`).
89
+
90
+ ### Orientation follows the selector
91
+
92
+ The tree is rooted so the focal model is always at the top:
93
+
94
+ - `model+` (downstream) — root is the model, children are its descendants.
95
+ - `+model` (upstream) — root is the model, children are its **ancestors** (up to
96
+ sources/seeds).
97
+ - `+model+` (both) — two sections: `▲ ancestors` then `▼ descendants`.
98
+
99
+ ## How it works
100
+
101
+ 1. Runs `dbt --quiet ls --output json --output-keys ... --select <selector>`.
102
+ 2. Keeps models, sources, seeds, and snapshots (tests off unless `--include-tests`).
103
+ 3. Builds child adjacency **within the selected set**, finds roots, and expands a
104
+ duplicated tree (Unix `tree` style) with cycle and node-count guards.
105
+ 4. Renders a `rich` tree (duplicating shared subtrees, `tree`-command style).
106
+
107
+ ## Options
108
+
109
+ | flag | default | meaning |
110
+ |---|---|---|
111
+ | `--target` | — | dbt target |
112
+ | `--project-dir` | — | dbt project directory |
113
+ | `--profiles-dir` | — | dbt profiles directory |
114
+ | `--dbt-executable` | `dbt` | path to dbt |
115
+ | `--include-tests` | off | include data/unit tests as nodes |
116
+ | `--max-depth` | `0` | limit depth (0 = unlimited) |
117
+ | `--max-nodes` | `5000` | safety cap on rendered nodes |
118
+ | `--no-color` | off | disable color in plain output |
119
+
120
+ Unknown flags are forwarded to `dbt ls` as an escape hatch.
121
+
122
+ ## Limitations
123
+
124
+ - **Single project.** Lineage covers whatever `dbt ls` resolves in the active
125
+ project; it does not stitch across sibling projects in a monorepo.
126
+ - Selector parsing is dbt's, so behavior matches your installed dbt version.
127
+
128
+ ## Development
129
+
130
+ ```bash
131
+ pip install -e ".[dev]"
132
+ pytest
133
+ ruff check .
134
+ ```
135
+
136
+ ## License
137
+
138
+ Apache-2.0
@@ -0,0 +1,51 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "dbt-tree"
7
+ version = "0.1.0"
8
+ description = "Pretty terminal lineage tree for dbt selectors (dbt-tree \"model+\")."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "Apache-2.0" }
12
+ authors = [{ name = "Karthik Rajashekaran" }]
13
+ keywords = [
14
+ "dbt",
15
+ "lineage",
16
+ "dag",
17
+ "tree",
18
+ "cli",
19
+ "data-engineering",
20
+ ]
21
+ classifiers = [
22
+ "Development Status :: 3 - Alpha",
23
+ "Intended Audience :: Developers",
24
+ "License :: OSI Approved :: Apache Software License",
25
+ "Programming Language :: Python :: 3.10",
26
+ "Programming Language :: Python :: 3.11",
27
+ "Programming Language :: Python :: 3.12",
28
+ "Topic :: Software Development :: Build Tools",
29
+ "Topic :: Utilities",
30
+ ]
31
+ dependencies = ["rich>=13.0"]
32
+
33
+ [project.optional-dependencies]
34
+ dev = ["pytest>=7.4", "ruff>=0.4"]
35
+
36
+ [project.scripts]
37
+ dbt-tree = "dbt_tree.cli:main"
38
+
39
+ [project.urls]
40
+ Homepage = "https://github.com/KarthikRajashekaran/dbt-tree"
41
+ Issues = "https://github.com/KarthikRajashekaran/dbt-tree/issues"
42
+
43
+ [tool.hatch.build.targets.wheel]
44
+ packages = ["src/dbt_tree"]
45
+
46
+ [tool.pytest.ini_options]
47
+ testpaths = ["tests"]
48
+
49
+ [tool.ruff]
50
+ line-length = 100
51
+ target-version = "py310"
@@ -0,0 +1,3 @@
1
+ """dbt-tree: interactive terminal lineage tree for dbt selectors."""
2
+
3
+ __version__ = "0.1.0"