Skip to content

docs: clear the API docs build's Sphinx warnings (#2743) - #2744

Merged
JarryShaw merged 1 commit into
mainfrom
fix/2743-docs-build-warnings
Nov 3, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/2743-docs-build-warnings

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • docs — documentation only

Description of your pull request and other information

This clears the Sphinx warnings from the HTML docs build on main. A clean-venv build goes from six warnings to none (sphinx-autodoc-typehints 3.17.2).

  • IGMP._dispatch: imports Raw under TYPE_CHECKING as well, so its return type now links. Nothing changes at run time.
  • netlink.rst: the netlink(7) / RFC 3549 footnote is now referenced from the struct nlmsghdr framing it documents.
  • IGMPv3 Query.checksum and the DTLS reassembler's __protocol_type__: Napoleon read the first-line colon in each doc comment as "type: description". That made the prose ambiguous cross-references and dropped it from the page. The colon now stays off the first line.
  • Deferred._KT prints its string constraints bare, so TransType and HandshakeType were ambiguous, and HandshakeType linked to the SSLv2 enum. A new conf.py hook, qualify_type_parameters, points each bare type-parameter name at the class its module binds. It changes those links and nothing else; the PR also adds tests/project/test_docs_type_parameters_2743_unit.py.

Closes #2743

@JarryShaw JarryShaw added docs Pull requests that change documentation only (docs: subject prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Nov 3, 2026
@github-actions github-actions Bot added this to the PyPCAPKit v1.6 milestone Nov 3, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Nov 3, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 4ed21aa8d, from a Sonnet review.

  • Warnings: 6 at ab7be2fb0, 0 here under sphinx-autodoc-typehints 3.17.2 and under 3.17.4 (build(deps): bump sphinx-autodoc-typehints from 3.17.2 to 3.17.4 in /docs #2742). Both are clean-venv builds of a non-editable install.
  • The HTML diff covers only the expected pages. qualify_type_parameters touches only type-parameter lists, and only for names bound in the node's own module. HandshakeType now links to TLS instead of SSLv2.
  • The new test fails with the hook neutralised. The Raw import is under TYPE_CHECKING only, with no cycle, and the IGMP tests pass. Project tests and Lint pass.

Non-blocking: the netlink footnote marker leaks "framing*" into the page's meta description. Other #: comments whose first line contains a colon render their prose as a type without any warning; a follow-up will track them.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Nov 3, 2026
The HTML build of main succeeded with warnings, each a link that was wrong
or missing:

- IGMP._dispatch returns Type[Raw], but Raw was imported only inside the
  method, so the annotation could not resolve and rendered unlinked. Raw is
  imported under TYPE_CHECKING as well; nothing changes at run time.
- Netlink's footnote citing netlink(7) and RFC 3549 had no reference; the
  sentence naming Netlink references it, outside the paragraph the meta tags quote.
- Napoleon reads a doc-comment's first-line colon as "type: description".
  The IGMPv3 Query.checksum comment ("Checksum: ...") and the DTLS
  reassembler's __protocol_type__ comment ("... An extension point: ...")
  had their prose taken as the type, which suffix-matched Checksum and
  Protocol to several classes and dropped the text from the page. Both keep
  the colon off the first line, as the IGMP schema's checksum does.
- sphinx-autodoc-typehints renders a legacy TypeVar's string constraints
  verbatim, so Deferred's _KT left TransType and HandshakeType bare, and the
  latter linked to the SSLv2 enumeration. The conf.py hook
  qualify_type_parameters points a bare name in a type-parameter list at
  the pcapkit class its module binds.

Build: 6 warnings before, 0 after (sphinx-autodoc-typehints 3.17.2).
@JarryShaw
JarryShaw force-pushed the fix/2743-docs-build-warnings branch from 4ed21aa to 4cb451b Compare November 3, 2026 15:03
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 4cb451baa.

The only change since 4ed21aa8d is in netlink.rst: the [*]_ footnote marker moved from the opening paragraph to the sentence that names Netlink. The page's og:description and meta description now read "…the struct nlmsghdr framing of Linux's own…", without the stray *. The footnote is still referenced, and the build is still at 0 warnings. The rest is unchanged; git range-diff shows only this hunk.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Coverage: 94.45% (unit tier, Python 3.15, 4cb451baa, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 21062 175 2914 156 98.58%
pcapkit/corekit 2861 76 916 37 96.80%
pcapkit/dumpkit 282 3 100 3 98.43%
pcapkit/foundation 3496 26 1214 32 98.77%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 22613 150 5862 123 99.03%
pcapkit/toolkit 961 26 342 8 96.62%
pcapkit/utilities 533 7 144 5 98.23%
pcapkit/vendor 5590 2286 1280 214 55.75%

Per-file detail: the coverage-html artifact of this run.

JarryShaw added a commit that referenced this pull request Nov 3, 2026
…on (#2745)

Napoleon reads the first line of a #: doc comment, or of a property's
docstring, as Google's inline "type: description" form wherever a colon
outside a role or a literal has text after it. The text before the colon
rendered as a Type field and dropped out of the prose -- "Group address",
"Protocol Type", "What __proto__ is keyed by", "IGMP version this class
reads" -- and the build warned only where that text matched several
classes. Two lines split a role across lines, so the colon of :meth:
itself was taken and the rendered page carried a second Type, "meth".

Each misread line keeps its colon off the first line: " -- ", ". ", or a
comma, as each IGMP version property's alias docstring already reads, and
the two split roles start on the second line. The IGMPv3 Query.checksum
and DTLS reassembler __protocol_type__ lines are byte-identical to #2744's
fix of the same two. Comments napoleon would misread that the docs do not
render yet are reworded too; inline types written on purpose
("int: Frame counter.") and enum members, which conf.py's
restore_enum_member_docstring already restores, are left alone.

tests/project/test_doc_comment_first_line_2745_unit.py runs napoleon's own
autodoc-process-docstring handler, under conf.py's napoleon settings, over
every attribute comment Sphinx's ModuleAnalyzer finds and every property
docstring under pcapkit/, and fails on a type that is prose rather than a
type expression.

Build: 105 rendered Type fields before, 59 after, all real types; warnings
6 before, 4 after, the 4 that #2744 clears (sphinx-autodoc-typehints
3.17.2).
@JarryShaw
JarryShaw merged commit 13a99d6 into main Nov 3, 2026
61 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Nov 3, 2026
@JarryShaw
JarryShaw deleted the fix/2743-docs-build-warnings branch November 3, 2026 16:33
JarryShaw added a commit that referenced this pull request Nov 3, 2026
…on (#2745) (#2746)

Napoleon reads the first line of a #: doc comment, or of a property's
docstring, as Google's inline "type: description" form wherever a colon
outside a role or a literal has text after it. The text before the colon
rendered as a Type field and dropped out of the prose -- "Group address",
"Protocol Type", "What __proto__ is keyed by", "IGMP version this class
reads" -- and the build warned only where that text matched several
classes. Two lines split a role across lines, so the colon of :meth:
itself was taken and the rendered page carried a second Type, "meth".

Each misread line keeps its colon off the first line: " -- ", ". ", or a
comma, as each IGMP version property's alias docstring already reads, and
the two split roles start on the second line. The IGMPv3 Query.checksum
and DTLS reassembler __protocol_type__ lines are byte-identical to #2744's
fix of the same two. Comments napoleon would misread that the docs do not
render yet are reworded too; inline types written on purpose
("int: Frame counter.") and enum members, which conf.py's
restore_enum_member_docstring already restores, are left alone.

tests/project/test_doc_comment_first_line_2745_unit.py runs napoleon's own
autodoc-process-docstring handler, under conf.py's napoleon settings, over
every attribute comment Sphinx's ModuleAnalyzer finds and every property
docstring under pcapkit/, and fails on a type that is prose rather than a
type expression.

Build: 105 rendered Type fields before, 59 after, all real types; warnings
6 before, 4 after, the 4 that #2744 clears (sphinx-autodoc-typehints
3.17.2).
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Nov 3, 2026
JarryShaw added a commit that referenced this pull request Nov 3, 2026


- Breaking: a short CALIPSO, SMF_DPD or MPL Opt Data Len raises ProtocolError,
  where 1.5.x raised FieldValueError, and a cut after the type octet reads
  short (#2737), a new entry; AppType.__registries__ is an Info, into the
  #2734 entry (#2735).
- Changed: const packages import their enumerations lazily through
  pcapkit.utilities.lazy.lazy_exports (#2735); the docs extra pins
  sphinx-autodoc-typehints 3.17.4 (#2742), as 1.5.0 recorded its pin.
- Fixed: the dumps keep a field renamed for clashing with an Info builtin
  name (#2736).
- Folded: the GraalPy leg's timeout and shards into the CI-legs entry
  (#2741); the #2735 and #2737 rulings into the conventions entry.
- No entry for the docs-only #2744 and #2746.
- 1.6.0's :func:`bytes` role is :class:`bytes`, so the changelog pages build
  with no nitpicky warning. Old values measured against v1.5.1.
- CHANGELOG.md regenerated; util/changelog_md.py --check passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Pull requests that change documentation only (docs: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

docs: the API docs build prints Sphinx warnings for ambiguous cross-references, an unresolved forward reference and an orphan footnote

1 participant