readability-cli 0.8.5__tar.gz → 0.9.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.
Files changed (39) hide show
  1. {readability_cli-0.8.5 → readability_cli-0.9.0}/.github/workflows/ci.yml +1 -1
  2. {readability_cli-0.8.5 → readability_cli-0.9.0}/.github/workflows/publish.yml +2 -2
  3. {readability_cli-0.8.5 → readability_cli-0.9.0}/.github/workflows/update-guides.yml +2 -2
  4. {readability_cli-0.8.5 → readability_cli-0.9.0}/PKG-INFO +101 -99
  5. {readability_cli-0.8.5 → readability_cli-0.9.0}/README.md +100 -98
  6. {readability_cli-0.8.5 → readability_cli-0.9.0}/pyproject.toml +4 -7
  7. readability_cli-0.9.0/readability/__init__.py +0 -0
  8. readability_cli-0.9.0/readability/checking.py +265 -0
  9. readability_cli-0.9.0/readability/cli.py +264 -0
  10. readability_cli-0.9.0/readability/guide.py +250 -0
  11. readability_cli-0.9.0/readability/outline.py +681 -0
  12. readability_cli-0.9.0/readability/tools.py +407 -0
  13. readability_cli-0.9.0/test_checking.py +1427 -0
  14. readability_cli-0.9.0/test_guide.py +223 -0
  15. readability_cli-0.9.0/test_outline.py +952 -0
  16. readability_cli-0.9.0/test_package.py +25 -0
  17. {readability_cli-0.8.5 → readability_cli-0.9.0}/uv.lock +1 -1
  18. readability_cli-0.8.5/readability.py +0 -1794
  19. readability_cli-0.8.5/test_readability.py +0 -2368
  20. {readability_cli-0.8.5 → readability_cli-0.9.0}/.gitignore +0 -0
  21. {readability_cli-0.8.5 → readability_cli-0.9.0}/.python-version +0 -0
  22. {readability_cli-0.8.5 → readability_cli-0.9.0}/LICENSE +0 -0
  23. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/configs/biome-default.json +0 -0
  24. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/configs/pyrefly.toml +0 -0
  25. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/configs/ruff.toml +0 -0
  26. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/Rguide.md +0 -0
  27. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/cppguide.md +0 -0
  28. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/csharp-style.md +0 -0
  29. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/docguide-style.md +0 -0
  30. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/go-guide.md +0 -0
  31. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/htmlcssguide.md +0 -0
  32. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/javaguide.md +0 -0
  33. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/jsguide.md +0 -0
  34. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/jsoncstyleguide.md +0 -0
  35. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/objcguide.md +0 -0
  36. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/pyguide.md +0 -0
  37. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/shellguide.md +0 -0
  38. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/tsguide.md +0 -0
  39. {readability_cli-0.8.5 → readability_cli-0.9.0/readability}/guides/vimscriptguide.md +0 -0
@@ -16,7 +16,7 @@ jobs:
16
16
  - name: Set up Python
17
17
  uses: astral-sh/setup-uv@v7
18
18
  with:
19
- python-version: '3.14'
19
+ python-version: "3.14"
20
20
 
21
21
  - name: Install dependencies
22
22
  run: uv sync
@@ -2,7 +2,7 @@ name: Publish
2
2
 
3
3
  on:
4
4
  push:
5
- tags: ['v*']
5
+ tags: ["v*"]
6
6
 
7
7
  jobs:
8
8
  publish:
@@ -17,7 +17,7 @@ jobs:
17
17
  - name: Set up Python
18
18
  uses: astral-sh/setup-uv@v7
19
19
  with:
20
- python-version: '3.14'
20
+ python-version: "3.14"
21
21
 
22
22
  - name: Build distribution
23
23
  run: uv build
@@ -2,7 +2,7 @@ name: Update Style Guides
2
2
 
3
3
  on:
4
4
  schedule:
5
- - cron: '0 0 * * 0' # Weekly on Sunday at midnight
5
+ - cron: "0 0 * * 0" # Weekly on Sunday at midnight
6
6
  workflow_dispatch: # Ad-hoc trigger
7
7
 
8
8
  jobs:
@@ -30,4 +30,4 @@ jobs:
30
30
  uses: stefanzweifel/git-auto-commit-action@v5
31
31
  with:
32
32
  commit_message: "chore: update style guides [skip ci]"
33
- file_pattern: 'guides/*.md'
33
+ file_pattern: "readability/guides/*.md"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: readability-cli
3
- Version: 0.8.5
3
+ Version: 0.9.0
4
4
  Summary: A CLI to lint, format, and type-check code with Google-style defaults, and pull Google style guides in markdown format.
5
5
  Project-URL: Homepage, https://github.com/owahltinez/readability
6
6
  Project-URL: Repository, https://github.com/owahltinez/readability
@@ -17,22 +17,21 @@ Description-Content-Type: text/markdown
17
17
  A CLI tool that keeps code aligned with Google style conventions. It runs the
18
18
  right linters, formatters, and type checkers for your project with sensible
19
19
  defaults, and serves the official Google style guides in Markdown format. This
20
- is ideal for AI agents or developers who want consistent code quality checks
21
- and quick access to style conventions without browsing HTML pages.
20
+ is ideal for AI agents or developers who want consistent code quality checks and
21
+ quick access to style conventions without browsing HTML pages.
22
22
 
23
23
  ## Features
24
24
 
25
25
  - **Linting & Formatting**: A `check` command that automatically detects and
26
- runs relevant tools (Ruff, Pyrefly, Biome, Prettier, gofmt) for your project.
27
- - **Sensible Defaults**: Bundled Google-style configurations for Ruff,
28
- Pyrefly, and Biome are used automatically when a project does not define its
29
- own.
26
+ runs relevant tools (Ruff, Pyrefly, Biome, and gofmt) for your project.
27
+ - **Predictable Ownership**: Every supported format has fixed tools, so
28
+ configuration customizes checks without changing which formatter runs.
30
29
  - **Style Guides**: A `guide` command that fetches the latest Google style
31
- guides (Python, Shell, C++, Java, JS/TS, Go, etc.) converted to Markdown,
32
- and outlines, addresses, and searches them by section rather than serving
33
- 200 KB to be read whole.
34
- - **Offline Mode**: Local caching of style guides for fast, offline access,
35
- kept fresh with a single `sync` command.
30
+ guides (Python, Shell, C++, Java, JS/TS, Go, etc.) converted to Markdown, and
31
+ outlines, addresses, and searches them by section rather than serving 200 KB
32
+ to be read whole.
33
+ - **Offline Mode**: Local caching of style guides for fast, offline access, kept
34
+ fresh with a single `sync` command.
36
35
 
37
36
  ## Quick Start
38
37
 
@@ -79,8 +78,8 @@ uv run readability sync
79
78
  ## Checking and Formatting
80
79
 
81
80
  The `check` command identifies and runs relevant linting and formatting tools
82
- based on file extensions and the presence of configuration files (triggers) in
83
- your project root:
81
+ solely from file extensions. Configuration can customize the assigned tools,
82
+ but cannot opt another tool into a format:
84
83
 
85
84
  ```bash
86
85
  # Run checks on the current directory
@@ -93,56 +92,57 @@ readability check src/ tests/ main.py
93
92
  readability check . --fix
94
93
  ```
95
94
 
96
- ### Supported Tools
95
+ ### Supported Formats
97
96
 
98
- | Tool | Supported Extensions | Config Needed | Fetched By |
99
- |------|----------------------|---------------|------------|
100
- | **Ruff** | `.py` | none, bundled | `uvx` |
101
- | **Pyrefly** | `.py` | none, bundled | `uvx` |
102
- | **Biome** | `.js`, `.ts`, `.jsx`, `.tsx`, `.json`, `.jsonc`, `.css`, `.html` | none, bundled | `npx` |
103
- | **Prettier** | `.js`, `.ts`, `.jsx`, `.tsx`, `.json`, `.css`, `.scss`, `.html`, `.md`, `.yml`, `.yaml` | `.prettierrc*` or `prettier.config.*` | `npx` |
104
- | **gofmt** | `.go` | `go.mod` | — |
97
+ | Formats | Owners | Project configuration |
98
+ | ---------------------------------------------------------------- | --------------------------------------- | ------------------------------------- |
99
+ | `.py` | Ruff lint/format; Pyrefly type checking | Ruff and Pyrefly native configuration |
100
+ | `.js`, `.jsx`, `.ts`, `.tsx`, `.json`, `.jsonc`, `.css`, `.html` | Biome | `biome.json` or `biome.jsonc` |
101
+ | `.go` | gofmt | None |
105
102
 
106
- **You do not need to install any of these.** Each is resolved in order: a
107
- project-local install (`node_modules/.bin`, `.venv/bin`) first, then whatever
108
- is on your `PATH`, and only then fetched by `uvx` or `npx`. The runners cache
109
- what they download, so the fetch happens once per machine and later runs are
110
- served from disk and work offline.
103
+ Markdown, YAML, SCSS, JSONL, and extensions not listed above are unsupported.
104
+ An unsupported-only path reports that nothing was checked and exits
105
+ successfully.
111
106
 
112
- That keeps this package at ~4 MB rather than the ~54 MB it would take to
113
- carry Ruff and Pyrefly itself a cost that would fall on everyone using only
114
- `guide`. An installed copy always wins over a fetched one, so a project that
115
- pinned a version is linted against the rules it chose.
107
+ Biome first checks a project's `node_modules/.bin`. Ruff, Pyrefly, and Biome
108
+ then use `PATH`, followed by `uvx` for the Python tools or `npx` for Biome. The
109
+ runners cache downloads, so subsequent runs work offline. Gofmt ships with Go
110
+ and must be available on `PATH`.
111
+
112
+ That keeps this package at ~4 MB rather than the ~54 MB it would take to carry
113
+ Ruff and Pyrefly itself — a cost that would fall on everyone using only `guide`.
114
+ An installed copy always wins over a fetched one, so a project that pinned a
115
+ version is linted against the rules it chose.
116
116
 
117
117
  Fetched tools carry a minimum version, enough to understand the bundled
118
118
  configurations, and no maximum. A ceiling would freeze anyone who installed
119
- nothing at whatever was current when this package shipped, and tie its
120
- releases to Ruff's — which has published seventeen minor series, roughly one
121
- every six weeks. If you need a fixed version, install it: an installed tool
122
- always wins over a fetched one.
119
+ nothing at whatever was current when this package shipped, and tie its releases
120
+ to Ruff's — which has published seventeen minor series, roughly one every six
121
+ weeks. If you need a fixed version, install it: an installed tool always wins
122
+ over a fetched one.
123
123
 
124
- Set `UV_OFFLINE=1` to forbid fetching. A tool that then cannot be reached
125
- fails the run rather than passing it.
124
+ Set `UV_OFFLINE=1` to forbid fetching. A tool that then cannot be reached fails
125
+ the run rather than passing it.
126
126
 
127
- Ruff, Pyrefly, and Biome ship with bundled configurations, so they run on any
128
- file they handle without the project arranging anything. Prettier and gofmt
129
- bring no defaults here, so they wait until the project asks with a config file.
127
+ Ruff, Pyrefly, and Biome ship with bundled configurations, so they run on every
128
+ file they own without project setup. Gofmt runs on `.go` files even when there
129
+ is no `go.mod`.
130
130
 
131
131
  A tool that could not be reached at all is never skipped quietly:
132
132
 
133
133
  ```bash
134
134
  # Some tools ran, so the result stands, but coverage was partial
135
135
  $ readability check src/
136
- Warning: not installed, so not run: prettier.
137
- No findings in 1 path(s) (ruff, pyrefly).
136
+ Warning: not installed, so not run: pyrefly.
137
+ No findings in 1 path(s) (ruff).
138
138
 
139
139
  # Nothing ran, so there is no result to report
140
140
  $ readability check src/
141
141
  Error: Every tool for 1 path(s) is missing, so nothing was verified.
142
142
  ```
143
143
 
144
- That second case needs neither the tool nor a runner to be present, which is
145
- the state a container image is usually in.
144
+ That second case needs neither the tool nor a runner to be present, which is the
145
+ state a container image is usually in.
146
146
 
147
147
  `check` exits non-zero on findings, tool failures, and when every applicable
148
148
  tool is absent, so it can gate CI without a clean exit meaning required tools
@@ -157,7 +157,7 @@ or exit-code decisions:
157
157
  ```python
158
158
  from pathlib import Path
159
159
 
160
- from readability import check_paths
160
+ from readability.checking import check_paths
161
161
 
162
162
  report = check_paths(["src", Path("tests")], project_root=Path.cwd())
163
163
  if report.findings or report.failed or not report.ran:
@@ -165,26 +165,29 @@ if report.findings or report.failed or not report.ran:
165
165
  ```
166
166
 
167
167
  The returned `CheckReport` records only whether findings occurred and which
168
- tools ran, were skipped, or failed. Detailed tool findings are still written
169
- as each tool runs. Every path is validated before any tool runs, and a missing
170
- one raises `FileNotFoundError` rather than being misreported as a finding.
171
- Relative paths remain relative to the process working directory;
172
- `project_root` controls configuration discovery only.
168
+ tools ran, were skipped, or failed. Detailed tool findings are still written as
169
+ each tool runs. Every path is validated before any tool runs, and a missing one
170
+ raises `FileNotFoundError` rather than being misreported as a finding. Relative
171
+ paths remain relative to the process working directory; `project_root` controls
172
+ configuration discovery only.
173
173
 
174
- ### Default Configurations
174
+ ### Configuring Formats
175
175
 
176
176
  Ruff and Pyrefly defaults follow the
177
177
  [Google Python style guide](https://google.github.io/styleguide/pyguide.html):
178
- 80-column lines, Google docstrings, import ordering, and full type checking.
179
- The Biome default applies the 80-column lines and two-space indentation of the
178
+ 80-column lines, Google docstrings, import ordering, and full type checking. The
179
+ Biome default applies the 80-column lines and two-space indentation of the
180
180
  [Google JavaScript style guide](https://google.github.io/styleguide/jsguide.html)
181
- and enables Biome's recommended lint rules. These defaults apply only when the
182
- project does not define its own configuration. To override them, add a
183
- `[tool.ruff]` or `[tool.pyrefly]` section to your `pyproject.toml`, or a
184
- dedicated `ruff.toml`, `pyrefly.toml`, `biome.json`, or `biome.jsonc` — any
185
- project-level configuration takes full precedence. The bundled Biome file
186
- requires Biome 2.5 or later, matching the version floor used by the fallback
187
- runner.
181
+ and enables Biome's recommended lint rules. Project `biome.json` and
182
+ `biome.jsonc` files replace those bundled defaults for Biome-owned formats.
183
+
184
+ For Python, add `[tool.ruff]` or `[tool.pyrefly]` to `pyproject.toml`, or use
185
+ `ruff.toml`, `.ruff.toml`, or `pyrefly.toml`. Ruff, Pyrefly, and Biome load
186
+ their native project configurations in place of bundled defaults. Readability
187
+ does not interpret EditorConfig itself; a canonical tool such as Biome may opt
188
+ into it through that tool's native configuration. Gofmt has no project settings.
189
+ The bundled Biome file requires Biome 2.5 or later, matching the fallback
190
+ runner's version floor.
188
191
 
189
192
  ## Style Guides
190
193
 
@@ -210,17 +213,17 @@ readability guide python --full | grep -i f-string
210
213
 
211
214
  A guide can exceed 200 KB, so the outline is what a bare invocation prints:
212
215
  listing the sections and fetching the one you need beats reading the lot.
213
- Nothing is written to disk, which is what a coding agent should do rather
214
- than redirecting a guide into the repository it is working on — use a shell
215
- redirect if you do want a copy.
216
+ Nothing is written to disk, which is what a coding agent should do rather than
217
+ redirecting a guide into the repository it is working on — use a shell redirect
218
+ if you do want a copy.
216
219
 
217
- `REF` and `--full` cannot be combined; that is refused rather than resolved
218
- by a precedence rule you would have to know.
220
+ `REF` and `--full` cannot be combined; that is refused rather than resolved by a
221
+ precedence rule you would have to know.
219
222
 
220
223
  ### Navigating a Guide
221
224
 
222
- The outline gives each section an index to fetch it by, and flags the ones
223
- large enough to be worth knowing about first:
225
+ The outline gives each section an index to fetch it by, and flags the ones large
226
+ enough to be worth knowing about first:
224
227
 
225
228
  ```bash
226
229
  $ readability guide cpp
@@ -234,28 +237,28 @@ Google C++ Style Guide
234
237
  # 140 sections · print one: readability guide cpp 4.5.1
235
238
  ```
236
239
 
237
- Sizes appear only at 1200 words and above — the 4% of sections expensive
238
- enough that you would want warning. They include subsections, since that is
239
- what the reference returns. The trailing line goes to stderr, so it never
240
- contaminates a piped outline.
240
+ Sizes appear only at 1200 words and above — the 4% of sections expensive enough
241
+ that you would want warning. They include subsections, since that is what the
242
+ reference returns. The trailing line goes to stderr, so it never contaminates a
243
+ piped outline.
241
244
 
242
245
  A section reference can be any of the following:
243
246
 
244
- | Reference | Example |
245
- |-----------|---------|
246
- | Section index, as shown by the outline | `2.2.4` |
247
- | Heading text, case-insensitive, or its slug | `"function comments"` |
247
+ | Reference | Example |
248
+ | ------------------------------------------- | ---------------------- |
249
+ | Section index, as shown by the outline | `2.2.4` |
250
+ | Heading text, case-insensitive, or its slug | `"function comments"` |
248
251
  | A parent-scoped path, spaces around the `>` | `"Imports > Decision"` |
249
252
 
250
- Whole matches are preferred; a reference that matches nothing in full is
251
- retried as a substring of the heading text.
253
+ Whole matches are preferred; a reference that matches nothing in full is retried
254
+ as a substring of the heading text.
252
255
 
253
256
  Three of the shipped guides — Python, JavaScript, and Java — number their own
254
257
  sections, and those numbers are the index. A rule cited from the outline then
255
- matches the published guide exactly, including where the guide skips a
256
- number: the Python guide has no 2.15 at all, so its 2.16 is listed as 2.16
257
- rather than renumbered. The other eleven guides number nothing, so their
258
- index comes from each heading's position in the tree.
258
+ matches the published guide exactly, including where the guide skips a number:
259
+ the Python guide has no 2.15 at all, so its 2.16 is listed as 2.16 rather than
260
+ renumbered. The other eleven guides number nothing, so their index comes from
261
+ each heading's position in the tree.
259
262
 
260
263
  Either way the index is unique, which is what makes a repeated heading
261
264
  addressable — `Definition`, `Pros`, `Cons`, and `Decision` appear under every
@@ -278,8 +281,8 @@ Error: 'Decision' matches 19 headings in the 'python' guide. Repeat with one of:
278
281
 
279
282
  A guide discusses plenty that no heading is named after, so a reference that
280
283
  matches nothing is usually a vocabulary mismatch rather than a mistake. The
281
- sections that mention the words are reported, which turns the miss into the
282
- next command:
284
+ sections that mention the words are reported, which turns the miss into the next
285
+ command:
283
286
 
284
287
  ```bash
285
288
  $ readability guide python f-string
@@ -289,22 +292,21 @@ It appears in these sections:
289
292
  3.10.1 Python Style Rules > Strings > Logging
290
293
  ```
291
294
 
292
- This locates a rule; it does not search text. For that, pipe `--full` to
293
- `grep`, which you already know and which brings its own `-i`, `-A`, `-c` and
294
- the rest:
295
+ This locates a rule; it does not search text. For that, pipe `--full` to `grep`,
296
+ which you already know and which brings its own `-i`, `-A`, `-c` and the rest:
295
297
 
296
298
  ```bash
297
299
  readability guide python --full | grep -in -A2 "f-string"
298
300
  ```
299
301
 
300
- Content goes to stdout and diagnostics to stderr, so every form is safe to
301
- pipe. Headings inside fenced code blocks are ignored, which matters for the
302
- Shell and Python guides where `#` starts a comment.
302
+ Content goes to stdout and diagnostics to stderr, so every form is safe to pipe.
303
+ Headings inside fenced code blocks are ignored, which matters for the Shell and
304
+ Python guides where `#` starts a comment.
303
305
 
304
306
  ### Supported Languages
305
307
 
306
- Run `readability guide` with no language for the full list and which guides
307
- are cached:
308
+ Run `readability guide` with no language for the full list and which guides are
309
+ cached:
308
310
 
309
311
  ```bash
310
312
  $ readability guide
@@ -337,17 +339,17 @@ readability sync
337
339
 
338
340
  ### Offline Mode
339
341
 
340
- The tool stores local copies of the style guides in the `guides/` directory
341
- and the `guide` command uses these local files when they exist. The bundled
342
- copies are automatically synchronized weekly from the official
342
+ The tool stores local copies of the style guides in the
343
+ `readability/guides/` directory and
344
+ the `guide` command uses these local files when they exist. The bundled copies
345
+ are automatically synchronized weekly from the official
343
346
  [Google Style Guides](https://google.github.io/styleguide/) repository via
344
- GitHub Actions, and you can refresh your local cache at any time with the
345
- `sync` command.
347
+ GitHub Actions, and you can refresh your local cache at any time with the `sync`
348
+ command.
346
349
 
347
- You can override the default `guides/` directory by setting the
350
+ You can override the default guide directory by setting the
348
351
  `READABILITY_CACHE` environment variable. This is useful if you want to store
349
- the guides in a specific location or share them across different
350
- installations:
352
+ the guides in a specific location or share them across different installations:
351
353
 
352
354
  ```bash
353
355
  export READABILITY_CACHE=/path/to/my/guides