dbt-macro-test 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.
- dbt_macro_test-0.1.0/.claude/skills/create-pr/SKILL.md +109 -0
- dbt_macro_test-0.1.0/.claude/skills/record-demo/SKILL.md +91 -0
- dbt_macro_test-0.1.0/.claude/skills/release/SKILL.md +140 -0
- dbt_macro_test-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +7 -0
- dbt_macro_test-0.1.0/.github/workflows/ci.yml +114 -0
- dbt_macro_test-0.1.0/.github/workflows/release.yml +122 -0
- dbt_macro_test-0.1.0/.gitignore +16 -0
- dbt_macro_test-0.1.0/.python-version +1 -0
- dbt_macro_test-0.1.0/CHANGELOG.md +32 -0
- dbt_macro_test-0.1.0/LICENSE +21 -0
- dbt_macro_test-0.1.0/PKG-INFO +285 -0
- dbt_macro_test-0.1.0/README.md +255 -0
- dbt_macro_test-0.1.0/dbt-macro-test.code-workspace +20 -0
- dbt_macro_test-0.1.0/docs/design.md +199 -0
- dbt_macro_test-0.1.0/docs/history/design-log.md +1066 -0
- dbt_macro_test-0.1.0/docs/images/README.md +29 -0
- dbt_macro_test-0.1.0/docs/images/demo.cast +148 -0
- dbt_macro_test-0.1.0/docs/images/demo.gif +0 -0
- dbt_macro_test-0.1.0/docs/images/demo.sh +16 -0
- dbt_macro_test-0.1.0/docs/releasing.md +61 -0
- dbt_macro_test-0.1.0/docs/spec.md +211 -0
- dbt_macro_test-0.1.0/pyproject.toml +72 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/__init__.py +0 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/__main__.py +3 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/cli.py +291 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/engine/__init__.py +45 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/engine/config.py +9 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/engine/judge.py +65 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/engine/runner.py +149 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/engine/signature.py +77 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/engine/validate.py +28 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/project/__init__.py +40 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/project/discovery.py +49 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/project/fixtures.py +52 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/project/generate.py +166 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/project/packages.py +42 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/py.typed +0 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/spec/__init__.py +49 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/spec/expectation.py +92 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/spec/literals.py +39 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/spec/output.py +29 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/spec/select.py +68 -0
- dbt_macro_test-0.1.0/src/dbt_macro_test/spec/spec.py +301 -0
- dbt_macro_test-0.1.0/tests/__init__.py +0 -0
- dbt_macro_test-0.1.0/tests/fixtures/macros/greeting.sql +9 -0
- dbt_macro_test-0.1.0/tests/fixtures/macros/safe_divide.sql +3 -0
- dbt_macro_test-0.1.0/tests/fixtures/macros/uses_ref.sql +1 -0
- dbt_macro_test-0.1.0/tests/fixtures/packages/other_utils/dbt_project.yml +4 -0
- dbt_macro_test-0.1.0/tests/fixtures/packages/other_utils/macros/noop.sql +1 -0
- dbt_macro_test-0.1.0/tests/fixtures/packages/spike_utils/dbt_project.yml +4 -0
- dbt_macro_test-0.1.0/tests/fixtures/packages/spike_utils/macros/hello.sql +4 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/dbt_project.yml +10 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macro_test/arguments.yml +29 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macro_test/columns.yml +22 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macro_test/errors.yml +32 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macro_test/fixtures/numbers.csv +3 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macro_test/fixtures/numbers_sql.sql +1 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macro_test/formats.yml +32 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macro_test/greeting.yml +10 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macro_test/overrides.yml +46 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macro_test/queries.yml +32 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macro_test/safe_divide.yml +19 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macro_test/shout.yml +10 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macro_test/warnings.yml +21 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macros/arguments.sql +2 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macros/columns.sql +2 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macros/composite.sql +4 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macros/environment.sql +2 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macros/fine.sql +1 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macros/greeting.sql +1 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macros/queries.sql +14 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macros/raising.sql +13 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macros/safe_divide.sql +3 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/macros/warning.sql +4 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/more_macros/shout.sql +1 -0
- dbt_macro_test-0.1.0/tests/fixtures/project/profiles.yml +6 -0
- dbt_macro_test-0.1.0/tests/fixtures/project_with_packages/dbt_project.yml +8 -0
- dbt_macro_test-0.1.0/tests/fixtures/project_with_packages/macro_test/m.yml +16 -0
- dbt_macro_test-0.1.0/tests/fixtures/project_with_packages/macros/m.sql +3 -0
- dbt_macro_test-0.1.0/tests/fixtures/project_with_packages/packages.yml +2 -0
- dbt_macro_test-0.1.0/tests/fixtures/project_with_packages/profiles.yml +6 -0
- dbt_macro_test-0.1.0/tests/spec_writer.py +46 -0
- dbt_macro_test-0.1.0/tests/test_cli_e2e.py +709 -0
- dbt_macro_test-0.1.0/tests/test_discovery.py +85 -0
- dbt_macro_test-0.1.0/tests/test_expectation.py +29 -0
- dbt_macro_test-0.1.0/tests/test_fixtures.py +57 -0
- dbt_macro_test-0.1.0/tests/test_generate.py +183 -0
- dbt_macro_test-0.1.0/tests/test_judge.py +128 -0
- dbt_macro_test-0.1.0/tests/test_layout.py +65 -0
- dbt_macro_test-0.1.0/tests/test_literals.py +47 -0
- dbt_macro_test-0.1.0/tests/test_output.py +26 -0
- dbt_macro_test-0.1.0/tests/test_packages.py +67 -0
- dbt_macro_test-0.1.0/tests/test_runner.py +69 -0
- dbt_macro_test-0.1.0/tests/test_select.py +157 -0
- dbt_macro_test-0.1.0/tests/test_signature.py +96 -0
- dbt_macro_test-0.1.0/tests/test_spec.py +384 -0
- dbt_macro_test-0.1.0/tests/test_spec_writer.py +48 -0
- dbt_macro_test-0.1.0/tests/test_validate.py +56 -0
- dbt_macro_test-0.1.0/uv.lock +1755 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-pr
|
|
3
|
+
description: Create (or update) a GitHub pull request for the current branch in this repo. Use whenever the user asks to open, create, or update a PR. Fills in this repo's PR template and writes the title/body in English, even if the conversation is in Japanese.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Create PR
|
|
7
|
+
|
|
8
|
+
Create a pull request for the current branch against `main`, following this
|
|
9
|
+
repo's PR template.
|
|
10
|
+
|
|
11
|
+
## First: the issue
|
|
12
|
+
|
|
13
|
+
Every PR is for an issue, so find it before anything else: before starting the
|
|
14
|
+
work, and at the latest before creating the PR. Look with
|
|
15
|
+
`gh issue list --state all --search "<keywords>"`, and in the roadmap issue
|
|
16
|
+
(#17), which lists them. If one matches, use its number. If none does, open
|
|
17
|
+
one first (title and body in English, with a label, as the other issues are)
|
|
18
|
+
and tell the user, rather than creating a PR without one. The number goes in
|
|
19
|
+
the PR title (step 5) and in the `Ref` section (step 4). A PR that does not
|
|
20
|
+
fit any issue usually means the work was not thought through yet.
|
|
21
|
+
|
|
22
|
+
## Steps
|
|
23
|
+
|
|
24
|
+
1. **Name the branch `<type>/<short-slug>`** when creating a new branch for
|
|
25
|
+
the work (before starting, not at PR time). `<type>` mirrors Conventional
|
|
26
|
+
Commit types — `feat`, `fix`, `docs`, `refactor`, `chore`, `test`, `ci`,
|
|
27
|
+
`perf`, `build` — picked to match the nature of the change. `<slug>` is a
|
|
28
|
+
short kebab-case description (e.g. `docs/contributing-and-issue-templates`,
|
|
29
|
+
`fix/dashboard-location-label`). Do **not** put issue numbers in the
|
|
30
|
+
branch name — link issues from the PR body's `Ref` section instead (see
|
|
31
|
+
step 4), since a branch name shouldn't need updating if the issue's scope
|
|
32
|
+
shifts.
|
|
33
|
+
|
|
34
|
+
2. **Check state.** Run `git status`, `git log main..HEAD`, and
|
|
35
|
+
`git diff main...HEAD` to see what's actually being shipped. If there are
|
|
36
|
+
uncommitted changes relevant to the PR, ask the user before including
|
|
37
|
+
them — don't silently commit unrelated work.
|
|
38
|
+
|
|
39
|
+
3. **Push the branch** if it isn't already tracked upstream:
|
|
40
|
+
`git push -u origin <branch>`.
|
|
41
|
+
|
|
42
|
+
4. **Read the template** at `.github/PULL_REQUEST_TEMPLATE.md` (sections:
|
|
43
|
+
`What` / `Why` / `QA` / `Ref`) and fill in each section based on the
|
|
44
|
+
actual diff and commits — don't invent content that isn't supported by
|
|
45
|
+
the change. Reference any related issue in the `Ref` section (e.g.
|
|
46
|
+
`Closes #26`), rather than encoding it in the branch name.
|
|
47
|
+
|
|
48
|
+
5. **Title: start it with the issue the PR is for, in brackets**, then a
|
|
49
|
+
short imperative summary: `[#7] Write the expected rows as csv, sql or a
|
|
50
|
+
fixture file`. The number is the issue the PR closes or, for one step of
|
|
51
|
+
a larger issue, the issue it belongs to (a step of #38 is `[#38] ...`).
|
|
52
|
+
Every PR has an issue; if there is none, open one first rather than
|
|
53
|
+
leaving the prefix off. The branch name still does not carry the number
|
|
54
|
+
(step 1).
|
|
55
|
+
|
|
56
|
+
6. **Language: always write the PR title and body in English**, regardless
|
|
57
|
+
of what language the conversation with the user is in. This applies to
|
|
58
|
+
both new PRs and edits to existing ones.
|
|
59
|
+
|
|
60
|
+
7. **Create or update the PR using `gh api`, not `gh pr create --body` /
|
|
61
|
+
`gh pr edit --body`.** In this repo/account, `gh pr create` and
|
|
62
|
+
`gh pr edit` intermittently fail with:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
GraphQL: Projects (classic) is being deprecated in favor of the new
|
|
66
|
+
Projects experience ... (repository.pullRequest.projectCards)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This comes from the `gh` CLI's own follow-up GraphQL query for extra
|
|
70
|
+
fields (deprecated project cards) after the mutation, not from the
|
|
71
|
+
mutation itself — the PR create/update can partially succeed while `gh`
|
|
72
|
+
still reports an error, which is confusing. Avoid it entirely by calling
|
|
73
|
+
the REST API directly:
|
|
74
|
+
|
|
75
|
+
- New PR:
|
|
76
|
+
```bash
|
|
77
|
+
gh api -X POST repos/{owner}/{repo}/pulls \
|
|
78
|
+
-f title="..." \
|
|
79
|
+
-f head="<branch>" \
|
|
80
|
+
-f base="main" \
|
|
81
|
+
-f body="$(cat <<'EOF'
|
|
82
|
+
...body text...
|
|
83
|
+
EOF
|
|
84
|
+
)"
|
|
85
|
+
```
|
|
86
|
+
- Update an existing PR's body/title:
|
|
87
|
+
```bash
|
|
88
|
+
gh api -X PATCH repos/{owner}/{repo}/pulls/{number} \
|
|
89
|
+
-f body="$(cat <<'EOF'
|
|
90
|
+
...body text...
|
|
91
|
+
EOF
|
|
92
|
+
)"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Get `{owner}/{repo}` from `git remote get-url origin` if not already
|
|
96
|
+
known.
|
|
97
|
+
|
|
98
|
+
8. **Verify** by reading back the result (`gh pr view <number> --json
|
|
99
|
+
url,title,body -q ...` or the API response) and report the PR URL to the
|
|
100
|
+
user.
|
|
101
|
+
|
|
102
|
+
## Merging
|
|
103
|
+
|
|
104
|
+
Merge with a squash, through the REST API (`gh api -X PUT
|
|
105
|
+
repos/{owner}/{repo}/pulls/{number}/merge -f merge_method=squash`), and pass
|
|
106
|
+
the title explicitly: `-f commit_title="<the PR title> (#<PR number>)"`. When a
|
|
107
|
+
PR has one commit GitHub takes that commit's subject, not the PR's title, so
|
|
108
|
+
without this the history would lose the `[#issue]` prefix. The result is, for
|
|
109
|
+
example, `[#7] Write the expected rows as csv, sql or a fixture file (#44)`.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: record-demo
|
|
3
|
+
description: Re-record the demo animation of the README (docs/images/demo.gif), a real session of the quick start recorded with asciinema and converted to a GIF with agg. Use when the output of `dbt-macro-test run` or the quick start changes, or when asked to re-record, update or redo the demo GIF or animation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Record the demo
|
|
7
|
+
|
|
8
|
+
`docs/images/demo.gif` is a **recording of a real session**, not a drawing: the quick start of the
|
|
9
|
+
README, run for real with the current code. Never hand-draw it or edit frames; if the output of the
|
|
10
|
+
tool changed, record again. Write the pull request in English and follow the `create-pr` skill
|
|
11
|
+
(the issue first, `[#N]` in the title).
|
|
12
|
+
|
|
13
|
+
## When
|
|
14
|
+
|
|
15
|
+
The output of `dbt-macro-test run` changes (its lines, its summary, the failure), the quick start
|
|
16
|
+
changes (the macro, the spec, the commands), or the GIF is found wrong. Not for a change that does
|
|
17
|
+
not show on the screen.
|
|
18
|
+
|
|
19
|
+
## What is needed
|
|
20
|
+
|
|
21
|
+
- `uv` (for `uvx asciinema`), and the font DejaVu Sans Mono (`fc-list | grep DejaVu`).
|
|
22
|
+
- `agg`, the converter of asciinema, as an **executable fetched from GitHub**. Running a fetched
|
|
23
|
+
executable needs the user's agreement: **ask first**, and when it is refused, stop and say what
|
|
24
|
+
was refused and why it is needed (see below); do not look for a way round.
|
|
25
|
+
- Version 1.9.0 was used (`gh release download v1.9.0 -R asciinema/agg -p
|
|
26
|
+
agg-x86_64-unknown-linux-gnu -O agg`, in a directory of its own, not in the repository).
|
|
27
|
+
- **Check it before running it**: compare `sha256sum agg` with the digest GitHub publishes,
|
|
28
|
+
`gh api repos/asciinema/agg/releases/tags/v1.9.0 --jq '.assets[] | select(.name ==
|
|
29
|
+
"agg-x86_64-unknown-linux-gnu") | .digest'`. They must be the same (`f111e315…aeda6` for 1.9.0).
|
|
30
|
+
Then `chmod +x`.
|
|
31
|
+
- Another version, or another platform: check the digest the same way, and say it in
|
|
32
|
+
`docs/images/README.md`.
|
|
33
|
+
|
|
34
|
+
## Steps
|
|
35
|
+
|
|
36
|
+
1. **A scratch directory** outside the repository (the scratchpad), with a `shop/` project that is
|
|
37
|
+
exactly the quick start of the README: `dbt_project.yml` (name `shop`, profile `shop`,
|
|
38
|
+
`macro-paths: ["macros"]`), `profiles.yml` (duckdb, `path: ":memory:"`), `macros/safe_divide.sql`
|
|
39
|
+
and `macro_test/safe_divide.yml` with the two cases of the README. If the quick start changed,
|
|
40
|
+
change this the same way: the GIF must show what the README says.
|
|
41
|
+
2. **`bin/dbt-macro-test`**, a two-line shell script that `exec`s the checkout's
|
|
42
|
+
`.venv/bin/dbt-macro-test "$@"`, so that the recording runs the code of the branch, and
|
|
43
|
+
`demo.sh` from `docs/images/demo.sh` next to `shop/` and `bin/`. The script types each command
|
|
44
|
+
and then runs it for real; the second run is made to fail by a real `sed` on the spec.
|
|
45
|
+
3. **Record**, wide enough that no line wraps (the longest line of dbt's output is about 120
|
|
46
|
+
characters) and tall enough for one run:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
TERM=xterm-256color uvx asciinema rec --overwrite -q --cols 122 --rows 38 \
|
|
50
|
+
-c "bash $PWD/demo.sh" run.cast
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
4. **The script changes the spec** (`2.5` to `2.0`) and does not change it back. Restore it before
|
|
54
|
+
the next recording (`sed -i 's/{result: 2.0}/{result: 2.5}/' shop/macro_test/safe_divide.yml`),
|
|
55
|
+
and delete `shop/target` and `shop/logs`, or the first run will not be the first.
|
|
56
|
+
5. **Convert**:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
agg --theme github-dark --font-family "DejaVu Sans Mono" --font-size 14 \
|
|
60
|
+
--idle-time-limit 2 --last-frame-duration 4 run.cast run.gif
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Its progress bar is noisy: `2>&1 | tr '\r' '\n' | tail -1`. Expect about 160 KB and about 18 s.
|
|
64
|
+
6. **Look at it.** The size of the file says nothing. Take frames with Pillow (`uvx --with pillow
|
|
65
|
+
python`) and open them with the Read tool. The frames are not evenly spaced in time (idle time
|
|
66
|
+
is cut), so pick them **by time**, summing the `duration` of each frame, not by index. Look at
|
|
67
|
+
three: the passing run, the typing of the `sed`, the failing run with its diff. Check that
|
|
68
|
+
- no line wraps, and each run fits on one screen (the top of the second is not scrolled out);
|
|
69
|
+
- the green of PASS and the red of FAIL and of the diff are there;
|
|
70
|
+
- the text is the real output (version of dbt, `PASS=2` and `1 failed, 1 passed`, exit code 1).
|
|
71
|
+
If not, change `--cols`, `--rows` or `--font-size` and record again.
|
|
72
|
+
7. **Put it in the repository**: `run.gif` and `run.cast` become `docs/images/demo.gif` and
|
|
73
|
+
`docs/images/demo.cast`; `demo.sh` stays in `docs/images/`. In `docs/images/README.md` update the
|
|
74
|
+
versions (asciinema, agg and its SHA-256, dbt-core, dbt-duckdb) if they changed.
|
|
75
|
+
8. **The README refers to the GIF by its address on `main`**
|
|
76
|
+
(`https://raw.githubusercontent.com/HirofumiTsuda/dbt-macro-test/main/docs/images/demo.gif`),
|
|
77
|
+
because PyPI shows the README as the page and cannot read a relative path. So the image does not
|
|
78
|
+
show in the README of the pull request before the merge. After the merge, check that the address
|
|
79
|
+
answers with `Content-Type: image/gif`. Say in the pull request that this is not checked before.
|
|
80
|
+
|
|
81
|
+
## Written in the pull request
|
|
82
|
+
|
|
83
|
+
That it is a real session (and which versions), that the frames were looked at and what was fixed,
|
|
84
|
+
that `agg` was fetched with the user's agreement and its SHA-256 matched the published one, and
|
|
85
|
+
what is not checked (how it shows on GitHub and on PyPI).
|
|
86
|
+
|
|
87
|
+
## Why it asks first
|
|
88
|
+
|
|
89
|
+
A fetched executable is outside what the repository and PyPI vouch for. The first time, running it
|
|
90
|
+
was refused; the user then agreed to it for this purpose. That agreement is for this converter, at
|
|
91
|
+
the version whose digest was checked, not for fetched executables in general.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: release
|
|
3
|
+
description: Prepare and carry out a release of dbt-macro-test to PyPI, or a dry run on TestPyPI. Use when the user asks to release, cut or publish a version, tag a release, or do a TestPyPI dry run. It lists what Claude may do alone and what only the user decides.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Release
|
|
7
|
+
|
|
8
|
+
`docs/releasing.md` has the steps for a person; read it first, and change both when the way
|
|
9
|
+
changes. This skill adds what Claude must check and what Claude must not do alone. The workflow is
|
|
10
|
+
`.github/workflows/release.yml`.
|
|
11
|
+
|
|
12
|
+
## What only the user decides
|
|
13
|
+
|
|
14
|
+
A version on PyPI, and on TestPyPI, **can never be used again**, even if the release is deleted.
|
|
15
|
+
So Claude does none of these on its own, and does each only when the user has just said to:
|
|
16
|
+
|
|
17
|
+
- push a tag `vX.Y.Z` (it starts the release);
|
|
18
|
+
- run the workflow by hand (`gh workflow run release.yml`), which publishes to TestPyPI;
|
|
19
|
+
- approve the `pypi` environment (that is the user's approval, in the browser);
|
|
20
|
+
- change the settings of PyPI, TestPyPI or the environments of GitHub (the user's accounts; Claude
|
|
21
|
+
may create the environments with `gh api` only when asked).
|
|
22
|
+
|
|
23
|
+
Everything else (the release pull request, the checks, the verification after) Claude does, and
|
|
24
|
+
reports in Japanese, short, with what was not checked.
|
|
25
|
+
|
|
26
|
+
## Before anything: look
|
|
27
|
+
|
|
28
|
+
1. `main` is green, and nothing is open that the release depends on (`gh api
|
|
29
|
+
"repos/HirofumiTsuda/dbt-macro-test/issues?state=open"`; the roadmap is #17, the release is #12
|
|
30
|
+
and #56).
|
|
31
|
+
2. **The version.** Semantic versioning; before 1.0.0 a minor version may change the spec format.
|
|
32
|
+
Say what was chosen and why. Ask when it is not obvious.
|
|
33
|
+
3. **The changelog is true.** Read each line of the entry of the version in `CHANGELOG.md` and check
|
|
34
|
+
it against the code or by running it (the README says the same about the spec: nothing is said
|
|
35
|
+
that was not run). Changes since the last tag: `git log <last tag>..main`, and what the closed
|
|
36
|
+
issues said.
|
|
37
|
+
4. **The README and `docs/` say what is so.** Run the quick start of the README from nothing
|
|
38
|
+
(a new project, a new venv) and compare its output with what the README shows. The links that
|
|
39
|
+
leave the README are absolute (PyPI cannot read a relative path).
|
|
40
|
+
5. `uv build` and `uvx twine check --strict dist/*` pass. The classifiers are in the official list
|
|
41
|
+
(`uvx --from trove-classifiers python`, compare `pyproject.toml` with `trove_classifiers.classifiers`):
|
|
42
|
+
PyPI refuses an upload with one it does not know, and `twine check` does not look.
|
|
43
|
+
|
|
44
|
+
## The first release only: the README says "not on PyPI"
|
|
45
|
+
|
|
46
|
+
The page of a release on PyPI is the README **as it was when the version was built**, and cannot be
|
|
47
|
+
changed afterwards except by a new version. The README of the first release says it is not on PyPI,
|
|
48
|
+
not released yet, and installs from `git+https://...`; that would be on the PyPI page of 0.1.0. So,
|
|
49
|
+
in the release pull request:
|
|
50
|
+
|
|
51
|
+
- the Status line ("not released yet", "not on PyPI") is changed to what is true then;
|
|
52
|
+
- the install line becomes `pip install dbt-macro-test` (with the adapter), here and in the example
|
|
53
|
+
for GitHub Actions of the README; **that has never been run against PyPI**, so it is checked
|
|
54
|
+
after the publication, and the example's workflow is run again once;
|
|
55
|
+
- the demo animation and the links need no change.
|
|
56
|
+
|
|
57
|
+
Ask the user about the wording of the Status line, and say that the install line cannot be tried
|
|
58
|
+
before the package is on PyPI (so the first minutes after the publication are when it is checked).
|
|
59
|
+
|
|
60
|
+
## The `pypi` environment must exist, with a reviewer, before any tag
|
|
61
|
+
|
|
62
|
+
**This is what makes "waits for the approval" true.** If the job names an environment that does not
|
|
63
|
+
exist, GitHub creates it on the first run **with no protection**, and the job goes on at once; the
|
|
64
|
+
trusted publisher on PyPI would accept it, and the version would be published without anyone
|
|
65
|
+
approving it. (The environment `testpypi` was made that way by the first dry run, and has no rule.)
|
|
66
|
+
So, before asking for or pushing a tag, run
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
gh api repos/HirofumiTsuda/dbt-macro-test/environments --jq '.environments[] | {name, reviewers: [.protection_rules[]? | select(.type == "required_reviewers") | .reviewers[]?.reviewer.login]}'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
and do not go on unless `pypi` is there with the user as a reviewer. When it is not (it was not,
|
|
73
|
+
on 2026-11-25), say so, and **ask** before creating it: the user, as reviewer, is the approval.
|
|
74
|
+
|
|
75
|
+
## Settings, once (the user's)
|
|
76
|
+
|
|
77
|
+
Pending trusted publishers on PyPI and TestPyPI (project `dbt-macro-test`, owner `HirofumiTsuda`,
|
|
78
|
+
repository `dbt-macro-test`, workflow `release.yml`, environment `pypi` and `testpypi`), and the
|
|
79
|
+
GitHub environments `pypi` (with the user as a required reviewer) and `testpypi`. Both publishers
|
|
80
|
+
were set on 2026-11-25; check that the environment `pypi` exists with a reviewer before the tag
|
|
81
|
+
(`gh api repos/HirofumiTsuda/dbt-macro-test/environments`), and **ask** before creating it.
|
|
82
|
+
|
|
83
|
+
## A dry run on TestPyPI
|
|
84
|
+
|
|
85
|
+
Worth doing when `pyproject.toml`, the workflow or the README changed since the last one: it shows
|
|
86
|
+
what PyPI does with the package. Done twice (0.1.0.dev1: the whole workflow; 0.1.0.dev2: the page
|
|
87
|
+
of the README).
|
|
88
|
+
|
|
89
|
+
1. On a throwaway branch from `main`: `version = "X.Y.Z.devN"` in `pyproject.toml`, and a heading
|
|
90
|
+
`## [X.Y.Z.devN] - dry run on TestPyPI, not a release` in `CHANGELOG.md` (the workflow checks it).
|
|
91
|
+
Check that TestPyPI does not have the version: `curl -s -o /dev/null -w '%{http_code}'
|
|
92
|
+
https://test.pypi.org/pypi/dbt-macro-test/X.Y.Z.devN/json` must be 404.
|
|
93
|
+
2. **Ask the user**, then `gh workflow run release.yml --ref <branch>`, and wait for the run
|
|
94
|
+
(`gh run view <id> --json conclusion,jobs`). `build`, both `smoke` jobs and `testpypi` pass;
|
|
95
|
+
`pypi` is skipped.
|
|
96
|
+
3. Check what was registered, with the JSON API
|
|
97
|
+
(`https://test.pypi.org/pypi/dbt-macro-test/X.Y.Z.devN/json`): the description, its content type,
|
|
98
|
+
the project URLs, the classifiers, the keywords. **The page itself answers a script with a
|
|
99
|
+
bot-challenge page**, so it cannot be read: render the description with
|
|
100
|
+
`uvx --from "readme-renderer[md]" python` (`readme_renderer.markdown.render`), which is what PyPI
|
|
101
|
+
uses, and list the images and the links that survive. Then **ask the user to open the page**
|
|
102
|
+
(`https://test.pypi.org/project/dbt-macro-test/X.Y.Z.devN/`) and look.
|
|
103
|
+
4. Delete the branch (local and remote). The version stays on TestPyPI for good; say so.
|
|
104
|
+
5. Install it into a new environment and run the fixture project:
|
|
105
|
+
`pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/
|
|
106
|
+
dbt-macro-test==X.Y.Z.devN` (and `dbt-duckdb` from PyPI), `dbt-macro-test --help`, and
|
|
107
|
+
`dbt-macro-test run` on a copy of `tests/fixtures/project` (27 cases passed).
|
|
108
|
+
|
|
109
|
+
## The release
|
|
110
|
+
|
|
111
|
+
1. **The release pull request**, with its issue (`[#N]`, see `create-pr`): `version` in
|
|
112
|
+
`pyproject.toml` if it is not already, the heading of the version in `CHANGELOG.md` renamed to
|
|
113
|
+
`## [X.Y.Z] - YYYY-MM-DD` (today, from `date +%F`; do not guess the date), what changed listed,
|
|
114
|
+
and the README changes of the section above for the first release. Its checks include the build
|
|
115
|
+
and the smoke test of the release workflow (it runs for a change to `pyproject.toml` or
|
|
116
|
+
`CHANGELOG.md`). In the body, **no "close(s)/fix(es) #N" unless it should close that issue**:
|
|
117
|
+
GitHub reads it even in a negation (this closed #56 and #71 by mistake).
|
|
118
|
+
2. Merge it only when the user says so. Update local `main`.
|
|
119
|
+
3. **Ask the user** to tag, or, when they say to, `git tag vX.Y.Z` on the merge commit and
|
|
120
|
+
`git push origin vX.Y.Z`. The workflow starts. (The pattern `v[0-9]+.[0-9]+.[0-9]+*` has not met
|
|
121
|
+
a tag yet: if no run starts, look at the pattern first.)
|
|
122
|
+
4. The workflow builds, checks that the tag, the version and the changelog agree, installs the wheel
|
|
123
|
+
and the sdist into clean environments and runs them, and then **waits for the approval of
|
|
124
|
+
`pypi`**. Tell the user it is waiting, and what they approve. Claude does not approve.
|
|
125
|
+
5. After the publication, check, and report what was and was not checked:
|
|
126
|
+
- `https://pypi.org/pypi/dbt-macro-test/X.Y.Z/json` answers, with the right metadata; and the
|
|
127
|
+
page (**ask the user to look**; a script cannot read it);
|
|
128
|
+
- a new environment: `pip install dbt-duckdb dbt-macro-test==X.Y.Z`, `dbt-macro-test --help`, the
|
|
129
|
+
quick start of the README **as it is written now** (this is the first time its install line is
|
|
130
|
+
run against PyPI), and `run` on a copy of `tests/fixtures/project`;
|
|
131
|
+
- for the first release, the example workflow of the README, run once on GitHub (a throwaway pull
|
|
132
|
+
request that is closed afterwards).
|
|
133
|
+
6. Close what the release finishes (#56, then #12), tick the roadmap (#17), and write in the issue
|
|
134
|
+
what was published and what was checked. If something is wrong with the published version, it
|
|
135
|
+
cannot be replaced: say so, and prepare the next version (a yanked release is the user's call).
|
|
136
|
+
|
|
137
|
+
## Written to the user
|
|
138
|
+
|
|
139
|
+
Short, in Japanese: what was done, what is left for them (the tag, the approval, looking at the
|
|
140
|
+
page), and what was not checked (the page of PyPI, an adapter other than duckdb, macOS).
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
# Every job runs on every pull request, because the required checks of `main` are listed by name
|
|
13
|
+
# and a job that did not run would leave its check pending for ever. The `changes` job says
|
|
14
|
+
# whether a pull request changes more than documentation (the globs are in it, and only there),
|
|
15
|
+
# and the other jobs skip their steps when it does not, so they still report success under their
|
|
16
|
+
# own names (#65). A push to `main`, and any failure of `changes`, run everything.
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
changes:
|
|
20
|
+
name: changes
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
permissions:
|
|
23
|
+
pull-requests: read
|
|
24
|
+
outputs:
|
|
25
|
+
code: ${{ steps.scope.outputs.code }}
|
|
26
|
+
steps:
|
|
27
|
+
- if: github.event_name == 'pull_request'
|
|
28
|
+
id: scope
|
|
29
|
+
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
|
|
30
|
+
with:
|
|
31
|
+
predicate-quantifier: some-with-excludes
|
|
32
|
+
filters: |
|
|
33
|
+
code:
|
|
34
|
+
- '**'
|
|
35
|
+
- '!docs/**'
|
|
36
|
+
- '!*.md'
|
|
37
|
+
- '!LICENSE'
|
|
38
|
+
- '!.github/PULL_REQUEST_TEMPLATE.md'
|
|
39
|
+
|
|
40
|
+
check:
|
|
41
|
+
name: check (Python ${{ matrix.python-version }})
|
|
42
|
+
needs: changes
|
|
43
|
+
if: ${{ !cancelled() }}
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
strategy:
|
|
46
|
+
fail-fast: false
|
|
47
|
+
matrix:
|
|
48
|
+
python-version: ["3.11", "3.12", "3.13", "3.14"]
|
|
49
|
+
env:
|
|
50
|
+
UV_PYTHON: ${{ matrix.python-version }}
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
53
|
+
|
|
54
|
+
- if: needs.changes.outputs.code != 'false'
|
|
55
|
+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
56
|
+
|
|
57
|
+
- if: needs.changes.outputs.code != 'false'
|
|
58
|
+
run: uv sync --locked
|
|
59
|
+
|
|
60
|
+
- if: needs.changes.outputs.code != 'false'
|
|
61
|
+
run: uv run ruff check .
|
|
62
|
+
|
|
63
|
+
- if: needs.changes.outputs.code != 'false'
|
|
64
|
+
run: uv run ruff format --check .
|
|
65
|
+
|
|
66
|
+
- if: needs.changes.outputs.code != 'false'
|
|
67
|
+
run: uv run mypy
|
|
68
|
+
|
|
69
|
+
- if: needs.changes.outputs.code != 'false'
|
|
70
|
+
run: uv run pytest
|
|
71
|
+
|
|
72
|
+
oldest-dbt:
|
|
73
|
+
# dbt-core 1.8 is the oldest version with native unit tests; the job above runs the
|
|
74
|
+
# newest one (the lock file's), this runs the oldest.
|
|
75
|
+
name: check (dbt-core 1.8)
|
|
76
|
+
needs: changes
|
|
77
|
+
if: ${{ !cancelled() }}
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
env:
|
|
80
|
+
UV_PYTHON: "3.12"
|
|
81
|
+
steps:
|
|
82
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
83
|
+
|
|
84
|
+
- if: needs.changes.outputs.code != 'false'
|
|
85
|
+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
86
|
+
|
|
87
|
+
- if: needs.changes.outputs.code != 'false'
|
|
88
|
+
run: uv sync --locked
|
|
89
|
+
|
|
90
|
+
- if: needs.changes.outputs.code != 'false'
|
|
91
|
+
run: uv pip install "dbt-core==1.8.*" "dbt-duckdb==1.8.*"
|
|
92
|
+
|
|
93
|
+
- if: needs.changes.outputs.code != 'false'
|
|
94
|
+
run: uv run --no-sync pytest
|
|
95
|
+
|
|
96
|
+
windows:
|
|
97
|
+
# Python 3.13 only: the suite is the same, and the system is what differs.
|
|
98
|
+
name: check (Windows)
|
|
99
|
+
needs: changes
|
|
100
|
+
if: ${{ !cancelled() }}
|
|
101
|
+
runs-on: windows-latest
|
|
102
|
+
env:
|
|
103
|
+
UV_PYTHON: "3.13"
|
|
104
|
+
steps:
|
|
105
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
106
|
+
|
|
107
|
+
- if: needs.changes.outputs.code != 'false'
|
|
108
|
+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
109
|
+
|
|
110
|
+
- if: needs.changes.outputs.code != 'false'
|
|
111
|
+
run: uv sync --locked
|
|
112
|
+
|
|
113
|
+
- if: needs.changes.outputs.code != 'false'
|
|
114
|
+
run: uv run pytest
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# A tag `vX.Y.Z` builds the package, checks it, installs it into a clean environment and
|
|
4
|
+
# runs it on a project, and then, after an approval, publishes it to PyPI. Nothing is published
|
|
5
|
+
# without the approval of the `pypi` environment. See docs/releasing.md.
|
|
6
|
+
#
|
|
7
|
+
# The build and the smoke test also run for a pull request that touches what a release is made
|
|
8
|
+
# of, so that a broken package is found before the tag.
|
|
9
|
+
#
|
|
10
|
+
# A manual run (workflow_dispatch) publishes to TestPyPI, as a dry run of the whole thing.
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
push:
|
|
14
|
+
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
|
|
15
|
+
pull_request:
|
|
16
|
+
paths:
|
|
17
|
+
- pyproject.toml
|
|
18
|
+
- CHANGELOG.md
|
|
19
|
+
- .github/workflows/release.yml
|
|
20
|
+
workflow_dispatch:
|
|
21
|
+
|
|
22
|
+
permissions:
|
|
23
|
+
contents: read
|
|
24
|
+
|
|
25
|
+
jobs:
|
|
26
|
+
build:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
30
|
+
|
|
31
|
+
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
32
|
+
|
|
33
|
+
- name: The version, the tag and the changelog agree
|
|
34
|
+
run: |
|
|
35
|
+
version=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
|
|
36
|
+
echo "pyproject.toml says $version"
|
|
37
|
+
if [ "$GITHUB_REF_TYPE" = tag ]; then
|
|
38
|
+
[ "$GITHUB_REF_NAME" = "v$version" ] || { echo "::error::the tag is $GITHUB_REF_NAME, pyproject.toml says $version"; exit 1; }
|
|
39
|
+
fi
|
|
40
|
+
grep -qE "^## \[$version\]" CHANGELOG.md || { echo "::error::CHANGELOG.md has no heading '## [$version]'"; exit 1; }
|
|
41
|
+
|
|
42
|
+
- run: uv build
|
|
43
|
+
|
|
44
|
+
- name: The distributions are well formed, and hold what they should
|
|
45
|
+
run: |
|
|
46
|
+
uvx twine check --strict dist/*
|
|
47
|
+
unzip -l dist/*.whl | grep -E "dbt_macro_test/py\.typed"
|
|
48
|
+
unzip -l dist/*.whl | grep -E "licenses/LICENSE"
|
|
49
|
+
tar -tzf dist/*.tar.gz | grep -E "/LICENSE$"
|
|
50
|
+
|
|
51
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
52
|
+
with:
|
|
53
|
+
name: dist
|
|
54
|
+
path: dist/
|
|
55
|
+
if-no-files-found: error
|
|
56
|
+
|
|
57
|
+
smoke:
|
|
58
|
+
# What was built, not the checkout, installed into a clean environment and run on a project.
|
|
59
|
+
needs: build
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
strategy:
|
|
62
|
+
fail-fast: false
|
|
63
|
+
matrix:
|
|
64
|
+
kind: [wheel, sdist]
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
67
|
+
|
|
68
|
+
- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
69
|
+
|
|
70
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
71
|
+
with:
|
|
72
|
+
name: dist
|
|
73
|
+
path: dist/
|
|
74
|
+
|
|
75
|
+
- name: Install it into a new environment
|
|
76
|
+
run: |
|
|
77
|
+
uv venv --python 3.12 "$RUNNER_TEMP/venv"
|
|
78
|
+
if [ "${{ matrix.kind }}" = wheel ]; then file=$(ls dist/*.whl); else file=$(ls dist/*.tar.gz); fi
|
|
79
|
+
uv pip install --python "$RUNNER_TEMP/venv/bin/python" dbt-duckdb "$file"
|
|
80
|
+
|
|
81
|
+
- name: It is the installed package that runs
|
|
82
|
+
run: |
|
|
83
|
+
"$RUNNER_TEMP/venv/bin/python" -c "import dbt_macro_test; print(dbt_macro_test.__file__)" | tee /dev/stderr | grep -q site-packages
|
|
84
|
+
"$RUNNER_TEMP/venv/bin/dbt-macro-test" --help
|
|
85
|
+
|
|
86
|
+
- name: Run it on a project
|
|
87
|
+
run: |
|
|
88
|
+
cp -r tests/fixtures/project "$RUNNER_TEMP/project"
|
|
89
|
+
cd "$RUNNER_TEMP/project"
|
|
90
|
+
"$RUNNER_TEMP/venv/bin/dbt-macro-test" run
|
|
91
|
+
|
|
92
|
+
testpypi:
|
|
93
|
+
if: github.event_name == 'workflow_dispatch'
|
|
94
|
+
needs: smoke
|
|
95
|
+
runs-on: ubuntu-latest
|
|
96
|
+
environment: testpypi
|
|
97
|
+
permissions:
|
|
98
|
+
id-token: write
|
|
99
|
+
steps:
|
|
100
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
101
|
+
with:
|
|
102
|
+
name: dist
|
|
103
|
+
path: dist/
|
|
104
|
+
|
|
105
|
+
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
106
|
+
with:
|
|
107
|
+
repository-url: https://test.pypi.org/legacy/
|
|
108
|
+
|
|
109
|
+
pypi:
|
|
110
|
+
if: github.ref_type == 'tag'
|
|
111
|
+
needs: smoke
|
|
112
|
+
runs-on: ubuntu-latest
|
|
113
|
+
environment: pypi
|
|
114
|
+
permissions:
|
|
115
|
+
id-token: write
|
|
116
|
+
steps:
|
|
117
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
118
|
+
with:
|
|
119
|
+
name: dist
|
|
120
|
+
path: dist/
|
|
121
|
+
|
|
122
|
+
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes are listed here, newest first. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
|
|
5
|
+
[Semantic Versioning](https://semver.org/); before 1.0.0, a minor version may change the spec format.
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-11-25
|
|
8
|
+
|
|
9
|
+
The first release.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `dbt-macro-test run`: a spec in YAML under `macro_test/` is turned into throwaway models and
|
|
14
|
+
dbt's native unit tests, which dbt runs; the output and the diff of a failure are dbt's own.
|
|
15
|
+
- Zero-config project discovery, and the project's `vars`, `dispatch`, `macro-paths` and packages
|
|
16
|
+
carried over (installed packages are used as they are, otherwise `dbt deps` runs).
|
|
17
|
+
- Arguments are given by name and checked against the macro's declaration before dbt runs;
|
|
18
|
+
`type: jinja` writes an expression, such as a `Relation`.
|
|
19
|
+
- `output`: a single expression (the default), `columns` (aliased or several), or `query` (a
|
|
20
|
+
whole `select`).
|
|
21
|
+
- `expect`: rows (a list of mappings, or `format: csv` / `sql`), a `fixture` file, an `error`, and
|
|
22
|
+
a `warning` together with rows.
|
|
23
|
+
- `overrides` of macros, `vars` and `env_vars` for a case, passed to dbt's own unit tests.
|
|
24
|
+
- `--select`, `--list`, `--target`, `--profiles-dir`, `--project-dir`, `--keep-generated`,
|
|
25
|
+
`--verbose`; exit code 0 (passed), 1 (a case failed or errored), 2 (could not be run).
|
|
26
|
+
- dbt-core 1.8 and later (below 2) on Python 3.11 and later; the suite runs in CI on Linux and
|
|
27
|
+
Windows, on the newest dbt-core and on 1.8. Only duckdb has been tried.
|
|
28
|
+
|
|
29
|
+
### Not yet
|
|
30
|
+
|
|
31
|
+
`ref` / `source`, text that is not SQL, DML, generic tests, dbt Fusion and adapters other than
|
|
32
|
+
duckdb; the README lists them with their issues.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hirofumi Tsuda
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|