Repository navigation
docs: baseline docstring rules and generate llms.txt in CI - #443
Merged
Merged
Conversation
Enable ruff's D rules with the existing docstring debt recorded as a per-directory baseline, so CI stays green on the current tree while new docstring debt fails immediately. Each baseline entry records its finding count; deleting a rule from an entry makes that tier's debt fail until it is fixed. Add scripts/generate_llms.py plus an llms-txt job that runs ahead of release-please and opens a pull request when the generated llms.txt or llms-full.txt differ from what is committed. The job is non-blocking: a failure reports red but does not hold the release. Configuration and documentation only; no packaging or lockfile changes.
loonghao
added a commit
that referenced
this pull request
Oct 13, 2026
…der CI lint (#445) Follow-up to #443, covering three of the four P2 findings from its review. Correct the docstring baseline comments where they described behaviour that ruff does not implement: `per-file-ignores` unions every matching pattern instead of resolving the most specific one, and the "delete a rule from a tier" ratchet only operates on the widest tier covering a file. The finding counts in the comments were also wrong in a way that reversed the explanation. Rules, tiers and counts are unchanged, so CI behaviour is not affected. Extend the lint scope from `photoshop` to `photoshop test scripts`, which makes the `test/**` and `test/manual_test/**` baseline tiers reachable from CI for the first time and puts `scripts/` under the `D` rules with no baseline. Six files under `test/` are reformatted; all six are AST-identical before and after, and the repo's pre-commit hook already applied `ruff format` to the whole tree. Run `scripts/generate_llms.py --check` in the `Python package` workflow so a drifted `llms.txt` fails the build instead of only producing a bot pull request. Also correct two stale references: the generator's module docstring pointed at a workflow file that does not exist, and a comment claimed the job stamps the version about to be released when it actually stamps the last released one. Configuration, comments and CI wiring only. No packaging or lockfile changes, and the generated `llms.txt` / `llms-full.txt` are untouched.
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.
Summary
Two related changes, both configuration and documentation only. No packaging
changes and no lockfile changes.
.flake8configuredflake8-docstrings(google convention), but the pluginwas never installed in CI, so those rules never actually ran. Ruff's
Drulesare now enabled and every current finding is recorded as a per-directory
baseline, so CI stays green on the current tree while any new docstring debt
fails immediately.
llms.txt/llms-full.txtare now generated, not hand-written. A newscript generates both, and a new CI job runs it ahead of
release-pleaseandopens a pull request whenever the output differs from what is committed.
Docstring baseline
There were 864
Dfindings when the rules were switched on. They arerecorded per directory tier in
[tool.ruff.lint.per-file-ignores], each with itsfinding count:
photoshop/api/enumerations.pyphotoshop/api/save_options/**photoshop/api/open_options/**photoshop/api/colors/**photoshop/api/**(the rest)photoshop/**(package root)test/manual_test/**test/**(the rest)The baseline is a ratchet, not a permanent exemption. Verified in both
directions:
photoshop/api/errors.py(a file whoseD100/D101are baselined) producesD103, which is not baselined for that tier, andruff checkfails.remaining debt fail until it is fixed.
To clear a tier: fix the findings, delete the corresponding rule from that
tier's list.
enumerations.pyis the cheapest first target — all 129 areD101on
IntEnumconstant tables where a per-class docstring is mostly noise.llms.txt generation
scripts/generate_llms.pywritesllms.txt(a ~2.7 KB curated index) andllms-full.txt(~58 KB; README, examples, and a module index concatenated).maintainer on Windows and CI on Linux produce identical bytes.
--checkexits non-zero when the committed files are stale. Runpython scripts/generate_llms.pylocally to regenerate.llms-txtjob sits in the Release workflow withneeds: [preflight], andrelease-pleasenow hasneeds: [preflight, llms-txt], so generation isordered ahead of the release.
release-pleasekeepsif: always(), so afailure here reports red but does not block a release.
docs/update-llms-txtrather thanpushing to
main, and is a no-op when nothing changed.The
llms.txtquickstart snippet is the example from thephotoshop.Sessiondocstring, not a newly invented one.
Rules that could not be mapped 1:1 from
.flake8Flagged rather than silently dropped:
ignore = BLK100—BLK100comes fromflake8-black, which is not inthe dev dependencies and was never installed, so the ignore was inert. Dropped
as dead configuration. Formatting is already enforced by
ruff formatin CI.excludeincludedtest, the ruff port does not. Thetestdirectorywas excluded from flake8 but is linted under ruff. This widens coverage rather
than narrowing it. Verified safe:
E,W,F,Q,IandUPreport zerofindings on
test/, so the widening introduces no new failures.docstring-convention = googlewas inert for the reason above; it is nowlive as
[tool.ruff.lint.pydocstyle] convention = "google"and is whatproduced the 864 baselined findings.
.pylintrcdisabledC0103(invalid-name) andR0903(too-few-public-methods).These are pylint-only and have no ruff equivalent; pylint was never invoked by
nox, pre-commit, or any workflow, so the file was dead configuration and was
already deleted in an earlier PR. No ruff rules were added to replace them.
Validation
ruff check photoshop(the CI lint command): passes.ruff check .(the full tree): passes.ruff format --check photoshop: 64 files already formatted.ruff check scripts/andruff format --check scripts/: clean.python scripts/generate_llms.pythen--check: idempotent.pytest test/test_collections.py test/test_imports.py: 18 passed.pytest --collect-only: 169 tests collected.The remaining tests under
test/manual_test/drive a real Photoshop COMinstance and cannot run in this environment; they were not executed here.