Rewrite as production-ready Python package (v0.1.0 on PyPI)#1
Merged
Conversation
Replace the prototype with a proper `src/`-layout package, published
as `dbt-dag-opt` on PyPI.
- Typer-based CLI with `analyze` subcommand, `--format table|json|jsonl`,
`--top N`, `--output`, and both file-mode and dbt Cloud Admin API-mode
input. `DBT_CLOUD_TOKEN` env var preferred over `--token`.
- Replace per-source recursive DFS + ProcessPoolExecutor with a single
iterative DP over topological order (O(V+E) across all sources, no
recursion limit or 20s/task timeout).
- Node weights are now attached to the target of each hop; fixes the
buggy parent-weight-on-outgoing-edge logic and the
`if node not in self.weights` membership check that compared node ids
against float values.
- Output JSON is now valid (single object keyed by source) instead of
the prior append-mode stream of comma-joined fragments.
- Typed exceptions, `py.typed` marker, full type hints, mypy --strict
clean.
- pytest suite (29 tests) covering loaders, graph build, longest-path
correctness on diamonds/chains/cycles, formatters, and the Typer CLI
via `CliRunner`. Cloud mode tests mock `requests` via `responses`.
- ruff + mypy configured in pyproject.toml.
- GitHub Actions: `ci.yml` (3.10/3.11/3.12 matrix, lint+type+test),
`publish.yml` (tag-triggered PyPI publish via Trusted Publishing /
OIDC, no long-lived token in secrets).
- Rewritten README with badges, install, CLI reference, sample output,
and explicit scope ("is not a scheduler simulator or cost model —
yet"). CHANGELOG.md with v0.1.0 entry.
Deferred to later versions: thread-aware scheduler simulation (v0.2),
warehouse cost modeling (v0.3), multi-run averaging, graphviz export.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the prototype with a proper
src/-layout Python package intended to ship on PyPI asdbt-dag-opt. The package name is available; first release will bev0.1.0.dbt-dag-opt analyzewith file-mode (--manifest/--run-results) and dbt Cloud mode (--account-id/--job-id/DBT_CLOUD_TOKEN), plus--format table|json|jsonl,--top N,--output, and--run-idfor historical runs.ProcessPoolExecutor. O(V+E) across all sources. Removes the 20s-per-task timeout ceiling and the recursion-limit risk.if node not in self.weightsbug (compared node ids against a list of floats) is gone with the rewrite.{key: value}fragments.responses-mocked Cloud API), graph building, longest-path correctness on diamonds / linear chains / cycles / single-node / missing-run-result, formatters, and the CLI viatyper.testing.CliRunner.ruff,mypy --strict,py.typed,hatchlingbuild backend,uv.lockcommitted for reproducible CI.ci.ymlmatrix on Python 3.10 / 3.11 / 3.12 (lint + type + test + coverage).publish.ymlis tag-triggered and uses PyPI Trusted Publishing (OIDC) — no long-lived tokens in repo secrets.CHANGELOG.mddocuments the upgrade.Deferred to later versions
threads; v0.1 treats the critical-path distance as a lower bound.--warehouse-size,--rate $/hr→ projected $ savings for Snowflake-style billing).Test plan
uv run ruff check .— cleanuv run mypy src— clean under--strictuv run pytest— 29/29 passinguv build+uv run --with twine twine check dist/*— both sdist and wheel passuv run dbt-dag-opt --version→dbt-dag-opt 0.1.0uv run dbt-dag-opt analyze --manifest tests/fixtures/tiny_manifest.json --run-results tests/fixtures/tiny_run_results.json --format table— top path israw.orders → stg_orders → int_orders → fact_ordersat 35.00s, matching hand-verified expectationmanifest.json+run_results.jsonfrom a past dbt project and eyeball top pathstrouze/dbt-dag-opt/publish.yml/ environmentpypi)🤖 Generated with Claude Code