Skip to content

Documentation coverage: a page per package and module, with a condensed listing - #35

Merged
Paebbels merged 2 commits into
devfrom
claude/doc-coverage-pages
Oct 15, 2026
Merged

Paebbels merged 2 commits into
devfrom
claude/doc-coverage-pages

Conversation

@pytooling-claude

@pytooling-claude pytooling-claude Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

New Features

  • Pages per package and module for the documentation coverage: an entry of pyTooling_DocCoverage_Packages with "pages": "<document name>" gets a page per package and per module, generated below that name, linked from the rows of the report:doc-coverage table and listed in the navigation below the page holding the directive - as code coverage does.
    • A package page: the summary - expected, covered, uncovered, coverage, colored by the coverage levels - and a table of its sub-packages and modules.
    • A module page: the summary and a condensed listing of the module's source (pyTooling.Sphinx.CondensedSource):
      • the module's doc-string; imports and other statements are elided to one ... line;
      • a class or function with its decorators, its header as written - a signature spanning lines too - and its doc-string; a function's body is elided to ..., except nested classes and functions; a class' members follow;
      • a class' fields and a module's variables as written, with their #: comment or doc-string literal;
      • an if/try holding definitions as written, its definitions condensed.
    • Each class and function is marked documented, undocumented, ignored or excluded, in the colors and with the legend of the code coverage listing; LaTeX gets colored line numbers and markers.
    • New role :doccov: (object type module) referring to a package's or module's page; the domain's data_version is 2.
  • pyTooling.Sphinx.Node.DocCoverageListing with HTML and LaTeX visitors; both listings share highlightTokens/writeListing.
  • pyTooling.Sphinx.Pages.ReportPages._Source(entity): the source file of a page, so a module's file triggers a rebuild of its page.

Changes

  • The packages are analyzed once per build, when the builder is initialized (DocCoverageBase.AnalyzePackages), instead of by every directive. A package that can't be analyzed - OSError, SyntaxError, tokenize.TokenError, UnicodeDecodeError, or pyEDAA.Reports' DocCoverageError - is reported by the directive and the pages naming it (GetReport chains the cause); any other exception ends the build.
  • The configuration is re-read on every build; pages is checked like code coverage's.
  • LevelOf(levels, coverage, configKey): the level lookup as a static method, shared by the table and the pages.

Known Issues

  • States of classes and functions come from docstr_coverage's raw results (DocStrCoverage.CoverageReport), matched to the source in visit order, names checked: pyEDAA.Reports' Convert() fills only per-file counts, no per-item states. A mismatch is warned about, and the listing stays unmarked.
  • Fields and variables are shown, but not marked: docstr_coverage doesn't analyze assignments, so the model has no states for them, and the coverage figures don't count them. The listing asks the model's Variables/Fields, so a later analyzer filling them marks them without a change here. Research on such an analyzer: see the discussion of tree: a legend explaining the icons #32.

Documentation

  • doc/Directives/DocCoverage.rst: section on the pages and the listing; the page renders a fixture package (example, pages below doccoverage/example).
  • doc/DocCoverage.rst moves to doc/doccoverage/index.rst (label DOCCOV), with pages: doccoverage/src - the same layout as coverage/index.rst with coverage/src in Documentation: pages for the own unit test and code coverage reports #33.
  • doc/News.rst: the pages in v0.1.0's new features.

Unit Tests

  • tests/unit/DocCoveragePages.py with the fixture package tests/data/DocCoverage/myPackage/: configuration, pages and links, the condensed listing (signatures kept, bodies elided, doc-strings and #: comments present, states marked), a source not matching the analysis, a package with a syntax error, the root package's page.
  • tests/unit/UnittestPages.py: the domain data built by hand needs the new role's key.

Related Issues and Pull-Requests

@pytooling-claude
pytooling-claude Bot requested a review from Paebbels as a code owner October 15, 2026 14:21
@pytooling-claude pytooling-claude Bot added Documentation Improvements or additions to documentation Enhancement New feature or request labels Oct 15, 2026
@codacy-production

codacy-production Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 24 minor

Alerts:
⚠ 24 issues (≤ 0 issues of at least minor severity)

Results:
24 new issues

Category Results
Documentation 15 minor
CodeStyle 8 minor
Complexity 1 minor

View in Codacy

🟢 Metrics 190 complexity · 4 duplication

Metric Results
Complexity 190
Duplication 4

View in Codacy

🟢 Coverage 96.65% diff coverage · +1.75% coverage variation

Metric Results
Coverage variation ✅ +1.75% coverage variation (-1.00%)
Diff coverage ✅ 96.65% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (a466998) 3308 2729 82.50%
Head commit (6dd8c94) 3733 (+425) 3145 (+416) 84.25% (+1.75%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#35) 478 462 96.65%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.72385% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.75%. Comparing base (a466998) to head (6dd8c94).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
pyTooling/Sphinx/CondensedSource.py 91.06% 8 Missing and 8 partials ⚠️
pyTooling/Sphinx/DocCoveragePages.py 94.28% 4 Missing and 4 partials ⚠️
pyTooling/Sphinx/DocCoverage.py 91.42% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev      #35      +/-   ##
==========================================
+ Coverage   80.04%   81.75%   +1.70%     
==========================================
  Files          19       21       +2     
  Lines        3308     3733     +425     
  Branches      502      568      +66     
==========================================
+ Hits         2648     3052     +404     
- Misses        579      588       +9     
- Partials       81       93      +12     
Flag Coverage Δ
unittests 81.75% <93.72%> (+1.70%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

claude-code and others added 2 commits October 15, 2026 14:57
…ed listing

A package in pyTooling_DocCoverage_Packages declared with 'pages' gets a
generated page per package and module, linked from the report:doc-coverage
table and listed in the navigation below it, like the code coverage pages.
A page shows the counters, colored by coverage level; a package's page its
sub-packages and modules. The role ':doccov:' refers to a page.

A module's listing is its source condensed to what is documented:
decorators, headers - multi-line signatures as written - and doc-strings of
classes and functions, fields and variables with their '#:' comments; a body
and the imports are elided to one '...' line. Each class and function is
marked by docstr_coverage's state; fields and variables are marked only if
pyEDAA.Reports' model holds a state for them. HTML and LaTeX share the
listing code with the code coverage listing.

The packages are analyzed once per build, when the builder is initialized,
instead of per directive. The own documentation dogfoods the pages, and the
directive's page shows a fixture package.

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
…errors

CondensedSource moves into a module of its own, so no file exceeds 700
lines. Its constructor takes the condensed lines; the classmethod Parse
condenses a module's source with a private builder, which holds the state
while walking the syntax tree.

Analyzing a package keeps only the exceptions the analysis raises -
ReportExtensionError (pyEDAA.Reports missing, or its DocCoverageError),
OSError, SyntaxError, tokenize.TokenError and UnicodeDecodeError -, which
GetReport chains; any other exception ends the build.

The documentation coverage report moves to doccoverage/index.rst, above its
pages doccoverage/src, as the code coverage report does.

Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
@pytooling-claude
pytooling-claude Bot force-pushed the claude/doc-coverage-pages branch from 0c55446 to 6dd8c94 Compare October 15, 2026 14:58
@Paebbels
Paebbels merged commit 49ed83d into dev Oct 15, 2026
52 of 53 checks passed
@Paebbels
Paebbels deleted the claude/doc-coverage-pages branch October 15, 2026 15:16
This was referenced Oct 15, 2026
@pytooling-claude pytooling-claude Bot mentioned this pull request Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants