Repository navigation
ci(docs): API ドキュメントを strict にビルドする docs job を足す - #15
Merged
Merged
Conversation
docs-python アクションを呼ぶ docs job を足し、ci-passed の needs に加える。 手元で警告 6 件が出たので同じ変更で直す。 - parts.py の docstring の build(**params) を literal にする - check.py の from __future__ import annotations を外し、dataclass の署名の 型注釈(tuple[float, float, float] など)が途中で切れないようにする - docs/conf.py と docs/index.rst を足し、build123d の Shape の未解決参照を nitpick_ignore で除く(build123d の目録とは名前の形が違い、intersphinx で結べない) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No-Issue: /github-audit-triage の drift 修正で、対応する Issue は無い
課題
このリポジトリは Python のパッケージ(
lab)だが、API ドキュメントを strict にビルドする検査が CI に無く、docstring・型注釈の誤りが検出されない。dotfiles のdocs-pythonアクション(スタック標準の docs 必須化)を呼ぶ job が必要。解決策
ci.ymlにdocs(name: API docs)を足し、ci-passedのneedsに加える。既存 job のname:は変えない。requires-pythonが>=3.13,<3.14なので、python-version: '3.13'を渡す(既定の3.xは最新を選び、pip install -e .が落ちる)。src/lab/parts.py: モジュール docstring 1 行目のbuild(**params)が rst の強調の開始とみなされていた(Inline strong start-string without end-string)。literal(二重バッククォート)にした。src/lab/check.py:from __future__ import annotationsを外した。これがあると dataclassReportの署名の型注釈が文字列になり、tuple[float, float, float]などがカンマで割られて 2 件の警告になっていた。Python 3.13 固定で、実行時にも型注釈の評価で困る箇所は無い(テスト 36 件通過)。build123d.topology.shape_core.Shapeの未解決参照 3 件: build123d の公式ドキュメントの目録はbuild123d.を付けない名前(topology.shape_core.Shape)で持っており、intersphinx では結べない。docs/conf.pyを新設してnitpick_ignoreに 1 件だけ入れた。docs/conf.pyを置くとアクションは最小構成の生成をやめてそれを使うため、docs/index.rst(automoduleで 5 モジュール)も足した。conf.py はアクションが生成する構成(autodoc・viewcode・doctest・intersphinx・doctest_global_setup)と同じ内容にしてある。docs/の既存の Markdown は Sphinx の対象外。Before / After
検証
手元(uv venv、Python 3.13、
docs-python/requirements.txtの Sphinx 9.1.0 とpip install -e .)で実行した。sphinx-apidoc --full --ext-doctestと、アクションが追記するdoctest_global_setup・intersphinx の 2 行)でsphinx-build -W -n -b htmlを実行し、警告 6 件(上記)を再現した。docs/conf.pyを使う経路でsphinx-build -W -n -b html docsとsphinx-build -W -b doctest docsがともに成功した。uv run ruff check .、uv run ruff format --check .、uv run pytest -q(36 passed)、uv run lab check --allが通る。API docsjob を含む)の結果は、作成後にgh pr checksで確認する。🤖 Generated with Claude Code