Repository navigation
Use the package summary as the default llms.txt description - #198
jacobtomlinson merged 1 commit into
Conversation
When llms_txt_description is not set, the project description is looked up from the installed package named by `project`. It read the Description metadata field, which is the long description and usually the whole README, so the README was copied into the blockquote of every generated llms.txt. The pyproject.toml description is the Summary field. Signed-off-by: Max Freedom Pollard <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #198 +/- ##
===========================================
+ Coverage 81.89% 94.09% +12.20%
===========================================
Files 4 17 +13
Lines 624 3725 +3101
Branches 87 345 +258
===========================================
+ Hits 511 3505 +2994
- Misses 84 164 +80
- Partials 29 56 +27
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jacobtomlinson-bot
left a comment
There was a problem hiding this comment.
Reviewed commit 25adb01. No blocking issues found.
The metadata lookup now uses the package Summary as documented, while preserving the explicit llms_txt_description override and existing fallback behavior. The new regression test covers both a package with a summary and one with only a README body.
Validation: uv run pytest src/sphinx_llm/tests/ — 505 passed on Python 3.15.0 / Sphinx 9.1.0.
When
llms_txt_descriptionis not set,get_project_description()looks up the installed package named byprojectand reads itsDescriptionmetadata field. That field holds the long description, which is usually the whole README. Thedescriptionfrompyproject.tomlis stored in theSummaryfield.During a Sphinx build this lookup returns the README on every supported Python version. On Python 3.10+,
importlib.metadataexposes the metadata body asDescription. On Python 3.9, Sphinx loads theimportlib_metadatabackport, which does the same. Any project whoseprojectvalue is the name of an installed package therefore gets its entire README, including badges and headings, in the blockquote of the rootllms.txtand of every nestedllms.txt. The README documents the default as the project description frompyproject.toml.Reproduction (Docutils is installed with Sphinx):
With one short
index.rst,sphinx-build -b htmlwrites a 419-linellms.txtwith a 412-line blockquote containing the Docutils 0.22.4 README. With this change, the blockquote is the single line> Docutils -- Python Documentation Utilities.Changes:
Summaryinstead ofDescription. Packages without a summary still fall back tohtml_title..dist-infowith a README body, both with and without a summary.Testing:
mainin both cases, because the README is returned. It passes with the change on Python 3.14 with Sphinx 9.1, and on Python 3.9 with the lowest direct dependency versions (Sphinx 5.1, Docutils 0.15).main, plus the two new cases).ruff check,ruff format --check(0.16.1) andcodespell(2.4.3) pass on the changed files.🤖 Generated with Claude Code