Skip to content

docs: correct API facts and state contracts concisely - #566

Merged
Alpha9463 merged 10 commits into
mainfrom
docs/552-fix-documentation
Oct 1, 2026
Merged

Alpha9463 merged 10 commits into
mainfrom
docs/552-fix-documentation

Conversation

@Alpha9463

Copy link
Copy Markdown
Owner

Summary

Corrects the documented API facts that disagreed with the code: the crossing-style default, the placement algorithm in CONTRIBUTING, and a broken cross-reference. It also rewrites the package's documentation as concise NumPy-style contracts, without issue, review or corpus history. Documentation only: no behaviour, drawing or golden changes.

Related Issues

Closes #552
Refs: #547

Changes

  • Facts corrected:
    • Crossing style defaults to "gap" in docs/api.md, the Flowsheet render entry points, both renderers and the CLI help.
    • CONTRIBUTING describes the weighted least-squares placement and grid passes.
    • drawio.py's _BUILTIN_SHAPES reference now points at tests/test_drawio.py.
  • History replaced: design-history docstrings and narrative comments are now short current-constraint statements: layout/claims.py, COL_GAP and the rollback docstring among them.
  • Coverage: whole-file NumPy pass on the layout, routing, model, CLI, flowsheet, units, spec, document, validate and render modules. pandid/devices.py is regenerated from scripts/gen_devices.py.
  • Kept: standards citations, registration numbers, equations, units, provenance and licence text, and public examples.

How to Test

  1. Run the suite and gates:

    python3 -m pytest -q
    python3 -m ruff check .
    python3 -m ruff format --check tests
    python3 -m mypy pandid
    python3 -m pyright pandid
  2. Check the crossing-style default as an API consumer:

    python3 -c "import inspect, pandid; print(inspect.signature(pandid.Flowsheet.render).parameters['crossing_style'])"
    python3 -c "import pandid; help(pandid.Flowsheet.render)" | grep -A2 "crossing_style :"
  3. Confirm the generated module matches its generator:

    python3 -m pytest -q tests/test_devices.py

Evidence

Before (180a2cf) After
Comment lines in pandid/ 9,390 3,112
Lines with history markers 499 99
NumPy-style docstrings 22% 76%
Undocumented definitions (all now overload/type stubs or documented __init__) 586 259
Unresolved cross-references 23 5 (builtins)
  • Code identity: every touched module's AST matches the pre-batch version with docstrings stripped. The one deliberate exception is the CLI help string, which now prints (default: gap).
  • Full suite: 11,481 passed, 188 skipped.
  • Lint and types: ruff, test formatting, mypy and git diff --check are clean. Pyright reports 0 errors plus the existing __all__ warning.

Checklist

  • Base branch is main and the branch is mergeable
  • Commit subjects follow Conventional Commits; tracked work links its issue
  • Self-reviewed the full diff on the Files changed tab
  • Relevant local checks pass; all CI jobs pass before merge
  • Documentation and examples updated if behaviour changed
  • Before/after drawings included if rendered output changed (no rendered output changed)
  • Blocking review feedback resolved, if review was requested

🤖 Generated with Claude Code

Describe the layout pipeline as it runs, state every rendering default in the API reference, show keyword-only arguments, and cut historical narrative from the contributing guide.

Refs: #552
Rewrite the layout and routing docstrings in NumPy style, keep the equations and constraints the code relies on, and remove design history, review narrative and corpus figures stated as current fact.

Refs: #552
Rewrite the model, port geometry, loop, station, deprecation and CLI docstrings in NumPy style, and take the CLI's crossing-style help default from argparse so it reports gap rather than arc.

Refs: #552
State the gap crossing-style default, rewrite every flowsheet docstring in NumPy style, and replace review history and corpus figures with the rules the code relies on.

Refs: #552
Rewrite every docstring and comment in pandid/units.py to NumPy style: short class contracts with parameters and raised errors, method docstrings throughout, and short comments for placement claims. Remove issue, version and corpus history that no longer guides a maintainer. Code is unchanged; the AST matches the previous revision apart from docstrings.

Refs: #552
Rewrite the documentation of pandid/spec.py, pandid/document.py and
pandid/validate.py in NumPy style, cutting issue, version and corpus
history to the constraint each still explains. Shorten the device
docstrings and comments in scripts/gen_devices.py, add a parameters
note and stub docstrings to its output, and regenerate
pandid/devices.py. Module code is unchanged; the generator's logic
changes only in the docstring text it emits.

Refs: #552
Rewrite the documentation of pandid/render/svg.py in NumPy style and cut issue, corpus and review history to the constraint each comment still explains. State "gap" as the crossing-style default in the CROSSING_STYLES notes and the SvgRenderer.render docstring, which called "arc" the default. Code is unchanged; the AST matches the previous revision apart from docstrings.

Refs: #552
Rewrite the documentation of pandid/render/symbols.py and
pandid/render/iso_parts.py in NumPy style. Give SymbolRegistry and its
public methods full contracts, move the Symbol field notes into an
Attributes section, and cut issue, corpus and drafting history while
keeping ISO item and registration references, grid coordinates and
provenance. Code is unchanged; the AST matches the previous revision
apart from docstrings.

Refs: #552
Rewrite the documentation of pandid/render/drawio.py in NumPy style, cutting issue, version and corpus history to the mxGraph or draw.io behaviour each comment still explains. Give DrawioRenderer.render a
full parameter section with "gap" as the crossing-style default, and
point the _Approximation docstring at the _BUILTIN_SHAPES set in
tests/test_drawio.py instead of an undefined module name. Code is unchanged; the AST matches the previous revision apart from
docstrings.

Refs: #552
Rewrite the documentation of pandid/render/furniture.py, export.py, debug.py, weights.py, escape.py and render/__init__.py in NumPy style, cutting issue, corpus and drafting history while keeping the ISO citations and measured layout facts. Code is unchanged; the AST matches the previous revision apart from docstrings.

Refs: #552
@Alpha9463
Alpha9463 merged commit 67f9385 into main Oct 1, 2026
7 checks passed
@Alpha9463
Alpha9463 deleted the docs/552-fix-documentation branch October 1, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Correct API documentation and replace historical commentary with concise contracts

1 participant