tepyd 0.5.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.
tepyd-0.5.0/LICENSE ADDED
@@ -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 Stefane Fermigier
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.
tepyd-0.5.0/PKG-INFO ADDED
@@ -0,0 +1,299 @@
1
+ Metadata-Version: 2.4
2
+ Name: tepyd
3
+ Version: 0.5.0
4
+ Summary: TEst PYramid Doctor — diagnose a project's test pyramid: mass, structure, and coverage.
5
+ Author: Stefane Fermigier
6
+ Author-email: Stefane Fermigier <sf@abilian.com>
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Requires-Python: >=3.12
10
+ Description-Content-Type: text/markdown
11
+
12
+ # Tepyd — The TEst PYramid Doctor
13
+
14
+ *Diagnose your test pyramid: is the shape what you say you want?*
15
+
16
+ Tepyd looks at a project's test suite and tells you whether its *shape* matches the test pyramid you say you want: a broad base of cheap unit tests, fewer integration tests, a thin cap of end-to-end tests. It automates the checks you'd otherwise do by hand — which packages are under- or over-tested, where the cheap tests are missing, whether the test tree mirrors the source tree, and — by running your suite under coverage — which tier actually exercises each package.
17
+
18
+ It's configuration-driven: point it at any project, describe that project's layout once in `pyproject.toml`, and run one command. The author's own layout ships as the default, so for projects that share it there's nothing to configure.
19
+
20
+ > Think `tepyd doctor`: diagnose my pyramid.
21
+
22
+ ## The lenses
23
+
24
+ Tepyd looks at a suite through several complementary lenses. Each is useful alone; together they catch failure modes the others miss.
25
+
26
+ | Lens | Command | Question | Runs tests? | Status |
27
+ |------|---------|----------|-------------|--------|
28
+ | **Mass** | `tepyd mass` | How much test code is there, and what shape does it make? | no | ✅ implemented |
29
+ | **Mirror** | `tepyd mirror` | Does the test tree structurally parallel the source tree? | no | ✅ implemented |
30
+ | **Cover** | `tepyd cover` | Which tier actually *executes* each unit — and is it the cheap one? | yes | ✅ implemented |
31
+ | **Report** | `tepyd report` | All the checks at once, plus advice: the *why* and the *how*, not just the *what*. | no | ✅ implemented |
32
+ | **Audit** | `tepyd audit` | Does each test file's imports match the tier it lives in? | no | 🔜 planned |
33
+
34
+ ## Requirements
35
+
36
+ - Python ≥ 3.12.
37
+ - `mass`, `mirror`, and `report` have no runtime dependencies — the line counter is built in.
38
+ - `cover` additionally needs the analysed project's own `pytest` and `coverage` to be importable, so run it from that project's environment (see [`tepyd cover`](#tepyd-cover)).
39
+ - `cloc` is an optional opt-in for the line counter (`counter = "cloc"`).
40
+
41
+ ## Install
42
+
43
+ ```bash
44
+ uv sync # for development in this repo
45
+ # once published to PyPI (not yet):
46
+ # uv tool install tepyd
47
+ ```
48
+
49
+ After `uv sync`, prefix commands with `uv run` (or activate the venv). Once published, `uv tool install tepyd` puts `tepyd` on your PATH directly.
50
+
51
+ The default line counter is built in — no external dependency. Set `counter = "cloc"` in config to use the [`cloc`](https://github.com/AlDanial/cloc) binary instead, if you want its stricter, multi-language counting.
52
+
53
+ ## Quick start
54
+
55
+ ```bash
56
+ uv run tepyd init # detect this project's layout, write a config
57
+ uv run tepyd mass --min-src 1 # analyse the current directory
58
+ uv run tepyd -C /path/to/project mass # analyse another project
59
+ uv run tepyd report # the checks + advice, in one read
60
+ ```
61
+
62
+ (`--min-src` skips source units under 20 LOC by default; pass `--min-src 1` on small projects to see every unit. Drop the `uv run` prefix once Tepyd is on your PATH.)
63
+
64
+ `mass`, `mirror`, and `cover` take `--json` for machine-readable output — the contract `report` and a future CI gate build on (`report` itself renders text or Markdown via `--format`). All commands take `-C/--root DIR` to point at a project other than the current directory.
65
+
66
+ ## Concepts
67
+
68
+ - **Source unit** — a meaningful slice of the source tree that Tepyd analyses as a whole, derived from configurable glob patterns (by default: each package under `modules/`, plus every other top-level package).
69
+ - **Tier** — one rung of the pyramid: a directory of tests of a given cost (e.g. `tests/a_unit`). Tiers are listed cheapest-first in config; any number is allowed, not just three.
70
+ - **Unit share** — the fraction of a unit's test code that lives in the cheapest tier. The headline pyramid-health metric.
71
+ - **Shape glyph** — a one-character read on a unit's pyramid:
72
+
73
+ | Glyph | Meaning |
74
+ |-------|---------|
75
+ | `▲` | healthy — the cheapest tier is the largest *and* ≥ 40 % of test LOC |
76
+ | `◇` | balanced — neither clearly healthy nor inverted |
77
+ | `▼` | inverted — the most expensive tier is the largest *and* unit share < 30 % |
78
+ | `·` | no tests at all |
79
+
80
+ ## `tepyd mass`
81
+
82
+ Counts test LOC against source LOC for every source unit and reports the per-tier breakdown, ratios, and pyramid shape.
83
+
84
+ ```bash
85
+ tepyd mass
86
+ tepyd mass --json
87
+ tepyd mass --min-src 50 # skip source units under 50 LOC (default: 20)
88
+ tepyd mass --exclude faker # skip a unit, on top of config exclusions (repeatable)
89
+ ```
90
+
91
+ ```
92
+ package src unit integration http-e2e browser tests ratio u%
93
+ ------------ --- ---- ----------- -------- ------- ----- ----- ---- -
94
+ modules/biz 24 32 8 4 0 44 1.83x 73% ▲
95
+ modules/wire 24 0 0 0 24 24 1.00x 0% ▼
96
+ services 16 0 16 0 0 16 1.00x 0% ◇
97
+ models 16 0 0 0 0 0 0.00x — ·
98
+
99
+ === Summary ===
100
+ ... (per-tier totals and outlier lists)
101
+ Tier mix across the codebase : unit 50% / integration 20% / http-e2e 10% / browser 20%
102
+ ⚠ unit share is 50%, below the 60% target — the pyramid is flattened.
103
+ Caveat : tier is by directory, not by what each test actually exercises.
104
+ ```
105
+
106
+ **How to read it.** Each tier has its own column; `ratio` is total test LOC ÷ source LOC; `u%` is unit share. The summary lists outliers (untested, under-tested below 0.5×, heavily-tested above 2×), flags inverted pyramids, and warns when the codebase-wide unit share falls below the first tier's `target_share`.
107
+
108
+ **A caveat Tepyd states up front:** LOC is a *proxy* for effort, not a measure of quality, and a test's tier is decided by its directory, not by what it actually exercises. Mass tells you where to look; the [`cover` lens](#tepyd-cover) tells you whether the tests are real.
109
+
110
+ ## `tepyd mirror`
111
+
112
+ Static, no-execution comparison of the test tree against the source tree, per tier, at sub-package granularity.
113
+
114
+ ```bash
115
+ tepyd mirror
116
+ tepyd mirror --json
117
+ tepyd mirror --max-depth 1 # only check top-level source packages
118
+ tepyd mirror --exclude faker
119
+ ```
120
+
121
+ ```
122
+ Mirror — test tree vs source tree (6 source units)
123
+
124
+ unit: 3/6 mirrored (50%)
125
+ gap domain/models
126
+ gap web
127
+ orphan tests/a_unit/legacy
128
+
129
+ integration: 1/6 mirrored (17%)
130
+ gap domain
131
+ ...
132
+ ```
133
+
134
+ **How to read it.** For each tier:
135
+
136
+ - **present** — the source package has a matching test directory that contains tests (counted in the `X/Y mirrored` figure),
137
+ - **gap** — a source package with no test counterpart at this tier,
138
+ - **orphan** — a test directory that contains tests but has no source on disk (tests for code that moved or vanished).
139
+
140
+ Orphan detection checks whether the source actually exists, so it's independent of `--max-depth` and of exclusions. Mirror coverage is presented as data, not a pass/fail — a browser tier showing `1/20 mirrored` is often by design.
141
+
142
+ ## `tepyd cover`
143
+
144
+ The only lens that **runs your test suite**. For each tier it does one `coverage run -m pytest <tier-dir>` (the tiers partition the suite, so the cost is roughly one full run), then measures, per source unit, what fraction of its statements each tier actually executes.
145
+
146
+ > **Run `cover` from your project's own environment.** Unlike the other lenses, it imports and executes your code, so it must run where your package, `pytest`, and `coverage` are installed. Add Tepyd there (`uv add --dev tepyd`) and run `uv run tepyd cover` from the project root. Installing Tepyd standalone (`uv tool install`) and pointing it at the project with `-C` will fail to import your tests.
147
+
148
+ ```bash
149
+ tepyd cover # all tiers
150
+ tepyd cover --tier a_unit # just the unit tier (repeatable)
151
+ tepyd cover --json
152
+ ```
153
+
154
+ ```
155
+ unit stmts unit e2e any
156
+ -------- ----- ---- --- ----
157
+ checkout 7 0% 88% 88% v hidden
158
+ domain 9 100% 0% 100%
159
+ ```
160
+
161
+ The **any** column is the union across tiers — a unit's true reachable-by-tests coverage. The flag marks the **hidden inverted pyramid**: a unit that's well covered overall (`any` high) but barely by its unit tier — the lines run, but only the expensive tiers run them. A global coverage report would show both rows as green; only this lens reveals that `checkout`'s coverage is entirely e2e.
162
+
163
+ Requirements & behavior:
164
+ - `coverage` and `pytest` must be importable in the environment you run it from (run it from the project's venv, e.g. `uv run tepyd cover`); if not, it exits with a clear install hint.
165
+ - It **ignores the project's own `[tool.coverage]` config** so the numbers don't depend on it, and attributes coverage by resolved path (robust to multi-file units and absolute coverage paths).
166
+ - A tier that **fails to run** is shown as a 0% column and listed as not-measured (distinct from "0% because untested"); a tier whose tests **ran but failed** is used with a warning that the numbers are a floor. Both also print to stderr.
167
+
168
+ ## `tepyd report`
169
+
170
+ Runs every check at once and synthesises the results into a list of **findings**, each carrying not just *what* is wrong but *why* it matters (the pyramid principle behind it) and *how* to fix it.
171
+
172
+ ```bash
173
+ tepyd report # console report, "senior" level
174
+ tepyd report --format md # Markdown, for a PR comment or a committed file
175
+ tepyd report --level newb # teach the concepts (intro + glossary + advice)
176
+ tepyd report --level expert # a terse one-line-per-finding checklist
177
+ ```
178
+
179
+ Every report opens with a **context lead-in** — what's being measured and why — and the `--level` knob tunes how much it explains, not which problems it finds:
180
+
181
+ | Level | What you get |
182
+ |-------|--------------|
183
+ | `newb` | A full plain-language explanation of the pyramid, every finding's what/why/fix, general advice, and a glossary. |
184
+ | `junior` | A shorter context, every finding's what/why/fix, and general advice. |
185
+ | `senior` (default) | A brief context, then each finding's what/why/fix — no hand-holding. |
186
+ | `expert` | A one-line context note, then one line per finding: the marker, the title, and the action. |
187
+
188
+ It reports an overall **health verdict** (`healthy` / `fair` / `needs work`), a one-line summary of each lens, and findings ordered by severity (`✗` problem, `⚠` warning, `ℹ` info). `--min-src`, `--max-depth`, and `--exclude` work as they do on the individual lenses.
189
+
190
+ ## `tepyd init`
191
+
192
+ Rather than write the config by hand, let Tepyd guess it. `tepyd init` looks around the project for the usual clues — a `src/` package (or a flat top-level one), a `tests/` tree split into tiers, a `modules/` sub-layout, a top-level browser-test root — and **appends** a commented `[tool.tepyd]` block to `pyproject.toml`, leaving the rest of the file untouched.
193
+
194
+ ```bash
195
+ tepyd init # detect and write the section
196
+ tepyd init --dry-run # print what it would write, change nothing
197
+ ```
198
+
199
+ When it can't make a confident guess — for example, several packages under `src/` with none named `app` or matching the project name — it **asks you to choose** (when run interactively). In a non-interactive context (a pipe, CI), it falls back to the first candidate and prints a note rather than blocking. It also refuses to overwrite an existing `[tool.tepyd]` section, and prints a note for anything else it had to guess (an undetected source root, no test tiers). The result is a head start to review — not necessarily a finished config.
200
+
201
+ ## Configuration
202
+
203
+ `tepyd init` writes this for you, but here is the full reference. Everything is configured under `[tool.tepyd]` in `pyproject.toml`. With no section at all, the defaults below apply (except `exclude`, which is always empty unless set — exclusions are per-project policy, not a layout default).
204
+
205
+ ```toml
206
+ [tool.tepyd]
207
+ src_root = "src/app" # filesystem root of the analysed source
208
+ src_package = "app" # dotted import path; reserved — not read by any lens yet
209
+
210
+ # How to slice the source tree into units (globs, first-match-wins): explode
211
+ # each package under modules/ one level deep, then take every other
212
+ # top-level package as a unit.
213
+ units = ["modules/*", "*"]
214
+
215
+ # Line counter: "internal" (built-in, no dependency) or "cloc".
216
+ counter = "internal"
217
+
218
+ # Source units excluded from analysis — a reason is REQUIRED, so the policy
219
+ # decision is documented where it's made.
220
+ [tool.tepyd.exclude]
221
+ faker = "seed/fake-data generator, exercised via fixtures"
222
+
223
+ # Test tiers, cheapest first (bottom of the pyramid first). Any number of tiers.
224
+ [[tool.tepyd.tiers]]
225
+ name = "a_unit"
226
+ root = "tests/a_unit"
227
+ label = "unit"
228
+ target_share = 0.60 # policy gate: ≥ 60 % of test LOC should be here
229
+
230
+ [[tool.tepyd.tiers]]
231
+ name = "b_integration"
232
+ root = "tests/b_integration"
233
+ label = "integration"
234
+
235
+ [[tool.tepyd.tiers]]
236
+ name = "c_e2e"
237
+ root = "tests/c_e2e"
238
+ label = "http-e2e"
239
+
240
+ [[tool.tepyd.tiers]]
241
+ name = "e2e_playwright"
242
+ root = "e2e_playwright" # an arbitrary root — needn't live under tests/
243
+ label = "browser"
244
+ strip_prefix = "modules/" # this tier flattens the layout: modules/biz → biz
245
+ ```
246
+
247
+ ### Reference
248
+
249
+ | Key | Default | Meaning |
250
+ |-----|---------|---------|
251
+ | `src_root` | `"src/app"` | Filesystem root of the analysed source. |
252
+ | `src_package` | `"app"` | Dotted import path of the source. Currently informational — no lens reads it yet (`cover` keys off `src_root`). |
253
+ | `units` | `["modules/*", "*"]` | Glob patterns slicing the source tree into units; first match wins, and a container whose children were already claimed is skipped. A pattern ending in `.py` (e.g. `["*.py"]`) makes each top-level **module** a unit — for flat packages with no sub-packages; `["*"]` stays directories-only. |
254
+ | `counter` | `"internal"` | `internal` (tokenize-based; counts non-blank, non-comment lines) or `cloc`. |
255
+ | `exclude` | `{}` | Table of `unit = "reason"`; the reason is required. |
256
+ | `tiers` | four tiers (see above) | Array of tables, cheapest-first. |
257
+
258
+ Per-tier keys: `name` (required), `root` (required), `label` (defaults to `name`), `target_share` (0–1, optional policy gate), `strip_prefix` (mapping rewrite for tiers that flatten the layout).
259
+
260
+ A different project just describes itself — e.g. a flat `src/` with two tiers:
261
+
262
+ ```toml
263
+ [tool.tepyd]
264
+ src_root = "src"
265
+ src_package = "mypkg"
266
+ units = ["*"]
267
+
268
+ [[tool.tepyd.tiers]]
269
+ name = "unit"
270
+ root = "tests/unit"
271
+
272
+ [[tool.tepyd.tiers]]
273
+ name = "e2e"
274
+ root = "tests/e2e"
275
+ ```
276
+
277
+ ## What Tepyd is not
278
+
279
+ - **Not a test runner**, and not a replacement for pytest or coverage — `cover` orchestrates them.
280
+ - **Not a correctness checker.** LOC is a *proxy* for effort, and a test's tier is decided by its directory, not by what it exercises.
281
+ - **Not a pass/fail gate** (today): it reports data and advice. The mirror and cover figures are diagnostics, not targets — `1/20 mirrored` for a browser tier is often correct by design.
282
+
283
+ ## Development
284
+
285
+ ```bash
286
+ make test # pytest
287
+ make lint # ruff + ty + pyrefly + mypy
288
+ make format # ruff format + autofix
289
+ ```
290
+
291
+ Tests are themselves organised as a pyramid (`tests/a_unit`, `tests/b_integration`, `tests/c_e2e`) — Tepyd eats its own dog food.
292
+
293
+ ## Changelog
294
+
295
+ See [CHANGES.md](CHANGES.md).
296
+
297
+ ## License
298
+
299
+ Tepyd is licensed under the Apache License 2.0 — see [LICENSE](LICENSE).