epythet.sweep¶
epythet sweep: validate many packages read-only and rank the queue.
The fleet has some two hundred packages and one question about each rule:
how often does it fire, and where? Severities in the ledger are decided by
that distribution, not by intuition (decision D9). The sweep runs
epythet.validation.validate() at level 0 (the coverage detectors, no
linters unless asked) and level 0.5 (the doctree of every docstring) over
each package, never writes into any of them, appends what it saw to the
observations file outside the repositories, and reports two things:
the rule distribution: per rule, how many findings, in how many packages, and the rate per hundred public objects;
the queue: packages ranked by how much documentation work they hold, weighted the way the doc-quality research orders the work (entry points first: an entry point without an example outranks a helper without a summary; a rendering error outranks both).
Packages come from directories on the command line, or from a manifest: a
.pth-style file with one project directory per line (the local package
manifest is exactly that). The manifest is read, never written.
>>> from epythet.sweep import queue_score
>>> queue_score({"DQ002": 3, "DR003": 1, "DQ004": 2}, severities={"DR003": "error"})
18.0
Module Attributes
How much one finding of a rule weighs in the queue (research_doc_quality §4.3: examples first, then correctness, then the summary, then parameter semantics). |
|
Weight per severity for rendering findings (level 0.5) not listed above. |
Functions
|
Project directories listed in a |
|
The queue weight of a package from its per-rule finding counts. |
|
The human report: distribution table, then the queue. |
|
Validate every package under |
|
Validate many packages read-only; print the rule distribution and the work queue. |
Where sweep summaries are appended: |
Classes
|
What the sweep saw in one package. |
|
Every package swept, the rule distribution and the ranked queue. |
- class epythet.sweep.PackageSweep(path, name, version=None, objects=0, undocumented=0, counts=<factory>, severities=<factory>, duration_s=0.0, error=None, notes=<factory>)[source]¶
Bases:
objectWhat the sweep saw in one package.
- epythet.sweep.RULE_WEIGHTS = {'DQ001': 3.0, 'DQ002': 4.0, 'DQ003': 1.0, 'DQ004': 0.5, 'DQ005': 1.0}¶
How much one finding of a rule weighs in the queue (research_doc_quality §4.3: examples first, then correctness, then the summary, then parameter semantics).
- epythet.sweep.SEVERITY_WEIGHTS = {'error': 5.0, 'info': 0.5, 'warning': 2.0}¶
Weight per severity for rendering findings (level 0.5) not listed above.
- class epythet.sweep.SweepResult(packages=<factory>, levels=(0, 0.5), started='', duration_s=0.0, ledger_severity=<factory>, ledger_title=<factory>)[source]¶
Bases:
objectEvery package swept, the rule distribution and the ranked queue.
- distribution()[source]¶
Per rule: findings, packages affected, rate per 100 public objects; most frequent first.
- epythet.sweep.packages_from_manifest(path)[source]¶
Project directories listed in a
.pth-style manifest (one per line,#comments).
- epythet.sweep.queue_score(counts, *, severities)[source]¶
The queue weight of a package from its per-rule finding counts.
- Return type:
- epythet.sweep.render_sweep(result, *, top=20)[source]¶
The human report: distribution table, then the queue.
- Return type:
- epythet.sweep.sweep(dirs=(), *, manifest=None, levels=(0, 0.5), ignore=(), ledger=None, napoleon=True, linters=False, observe=True, observations_path=None, record=True, limit=None, on_package=None)[source]¶
Validate every package under
dirsandmanifestread-only; return the result.- Parameters:
dirs (
Iterable[str|PathLike]) – Project or package directories.manifest (
str|PathLike|None) – A.pth-style file of project directories, read only.levels (
Iterable[float]) – The validate levels to run (0coverage,0.5parse by default).ignore (
Iterable[str]) – Path substrings to skip inside each package.ledger (
Ledger|str|PathLike|None) – The rule catalog (None= bundled).napoleon (
bool) – Parse docstrings with napoleon’s pre-processing.linters (
bool) – Also shell out to ruff and pydoclint at level 0.observe (
bool) – Append each package’s findings to the observations file.observations_path (
str|PathLike|None) – Override the observations file (tests use this).record (
bool) – Append the sweep summary tosweeps.jsonlunder the user data dir.on_package – Called with each
PackageSweepas it completes.
- Return type:
- epythet.sweep.sweep_command(*dirs, manifest=None, parse_only=False, linters=False, ignore=None, ledger=None, no_napoleon=False, no_observe=False, limit=None, format='table', top=20, output=None, quiet=False)[source]¶
Validate many packages read-only; print the rule distribution and the work queue.
Runs level 0 (coverage detectors) and level 0.5 (every docstring’s doctree) over each package; never writes into a package or the manifest.
- Parameters:
dirs (
str) – Project or package directories to sweep.manifest (
str|None) – A .pth-style file listing project directories, one per line (read only).parse_only (
bool) – Run level 0.5 only (skip the coverage detectors).linters (
bool) – Also run ruff and pydoclint at level 0 (slower).ignore (
list[str] |None) – Skip files whose path contains this string (repeat -i for several).ledger (
str|None) – Directory of extra rule YAML files overlaid on the bundled ledger.no_napoleon (
bool) – Parse docstrings without napoleon’s Google/NumPy pre-processing.no_observe (
bool) – Do not append findings (or the sweep summary) to the user data dir.format (
str) – table (human) or json (the full result).top (
int) – How many packages the queue shows.output (
str|None) – Write the report to this file instead of stdout.quiet (
bool) – Do not print progress on stderr.
- Return type: