Skip to content

docs: package-wide docstring standardization - #488

Draft
lkdvos wants to merge 4 commits into
mainfrom
docs/docstrings
Draft

docs: package-wide docstring standardization#488
lkdvos wants to merge 4 commits into
mainfrom
docs/docstrings

Conversation

@lkdvos

@lkdvos lkdvos commented Jul 30, 2026

Copy link
Copy Markdown
Member

Docstring standardization slice of #449, re-applied on top of current main: a new docs/DOCSTRING_STYLE.md and its conventions applied to 53 files under src/ — unified bullets and argument lists, a fixed section order, $(TYPEDEF)/$(TYPEDFIELDS) for algorithm structs, @extref links to upstream APIs, driver ↔ algorithm cross-links, and runnable jldoctest examples on the main entry points.

Documentation-only. Stripping docstrings and comments from every touched src/ file and diffing against main gives an empty result — no code changed. The three genuine code changes hiding in #449's src/ diff went to #489 instead.

Two things beyond the style pass:

  • src/utility/plotting.jl linked (@ref entanglement_spectrum), an anchor that exists nowhere; since lib/lib.md autodocs the whole module, this fails the build. Retargeted at the real entanglement_spectrum docstring.
  • The source branch predates Replace trscheme by trunc #482 (trschemetrunc) and Refactor MPSTensor construction to fix type piracy #475 (removed MPSTensor constructors), so it was applied as a patch keeping main's code; the affected docstrings and one jldoctest were rewritten accordingly.

Also adds two mpskit.bib lines these docstrings need: the gleis2023 entry, and the Hubig2015hubig2015 rename with its @cite. Expect a one-line conflict with #487 on that key; take lowercase.

Doctests pass and the Documenter half of the build is clean; the vitepress build step can't run on my machine (host glibc too old for rollup), so CI should confirm the HTML render.

🤖 Generated with Claude Code

lkdvos and others added 3 commits July 30, 2026 17:33
Write down the conventions the package-wide docstring pass applies: section
headings, `- name::Type: description` argument lists, cross-linking with `@ref`
/ `@extref`, `@cite` references, and how algorithm types document their fields
and constructors.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`SketchedExpand`'s docstring cites the controlled-bond-expansion paper, so add
the corresponding bibliography entry. Rename the one capitalised citation key
to `hubig2015` for consistency with every other key in the file, and update the
`@cite` in `DMRG3S` to match.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Prose and formatting pass over every docstring in `src/`, following
`docs/DOCSTRING_STYLE.md`:

- unify bullet markers on `-` and argument lists on `- name::Type: description`
- promote `##` section headings to `#`, and order them consistently
  (signature, description, arguments, keywords, returns, examples, see-also,
  references)
- switch algorithm types to `$(TYPEDEF)`/`$(TYPEDFIELDS)` with per-field
  docstrings, and document their constructors under `# Constructors`
- add `Used as the ... argument of [...](@ref)` cross-links so algorithm types
  point back at the driver they plug into
- link upstream API with `[text](@extref Pkg.name)` (KrylovKit,
  MatrixAlgebraKit, TensorOperations) instead of naming it in plain text
- normalise spacing in type parameters and keyword defaults
  (`PeriodicArray{T,1}` -> `PeriodicArray{T, 1}`, `side=:both` -> `side = :both`)
- add `@cite` references where an algorithm has a canonical paper
- new or substantially expanded docstrings for the quasiparticle state types,
  the finite environment types, and several driver functions, with runnable
  `jldoctest` examples on the main entry points

Also drop a link to a non-existent `entanglement_spectrum` anchor in
`entanglementplot`, retargeting it at the `entanglement_spectrum` docstring.

This commit changes documentation only. Verified by stripping docstrings,
comments and blank lines from both `origin/main`'s version and this one of every
touched file and diffing the results, which is empty.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/algorithms/ED.jl 100.00% <ø> (ø)
src/algorithms/approximate/approximate.jl 56.00% <ø> (ø)
src/algorithms/changebonds/changebonds.jl 91.30% <ø> (ø)
src/algorithms/changebonds/optimalexpand.jl 98.85% <ø> (ø)
src/algorithms/changebonds/randexpand.jl 63.63% <ø> (ø)
src/algorithms/changebonds/sketchedexpand.jl 98.43% <ø> (ø)
src/algorithms/changebonds/svdcut.jl 89.18% <ø> (ø)
src/algorithms/changebonds/vumpssvd.jl 100.00% <ø> (ø)
src/algorithms/derivatives/mpo_derivatives.jl 72.53% <ø> (ø)
src/algorithms/excitation/chepigaansatz.jl 91.48% <ø> (ø)
... and 42 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lkdvos lkdvos added the documentation Improvements or additions to documentation label Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

After the build completes, the updated documentation will be available here

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant