feat(cli): add rich markdown style, refine docs - #266
Merged
Merged
Conversation
Emin017
force-pushed
the
emin/update-cli-docs
branch
from
September 8, 2026 02:57
7163c9a to
263806f
Compare
Emin017
force-pushed
the
emin/update-cli-docs
branch
from
September 8, 2026 04:00
1f5842a to
ecfd5cd
Compare
25 tasks
Yell-walkalone
previously approved these changes
Sep 8, 2026
Emin017
dismissed
Yell-walkalone’s stale review
September 8, 2026 09:25
The merge-base changed after approval.
Typer has vendored click since 0.26, so application code should go
through typer's re-exports instead of importing click itself:
- click.echo -> typer.echo
- the layout-image failure now prints the same "Error: ..." line via
typer.echo(err=True) and raises typer.Exit(1) instead of
click.ClickException
- invoke_typer_app runs the command in standalone mode and converts
SystemExit back into an int return code, replacing the non-standalone
click exception plumbing; click.Ctrl-C aborts are now handled by
click ("Aborted!", exit 1) instead of propagating as a traceback
…startup chipcompiler.utility imported matplotlib.pyplot at package import time, so every 'ecc' invocation (even --help) paid ~0.8s of matplotlib import and, in the PyInstaller bundle with a cold font cache, spawned fc-list against the host fontconfig config. Re-export the five plot helpers via a PEP 562 module __getattr__ so matplotlib is only imported when a plot function is actually used. Call sites (already function-level imports in tools/ecc/plot.py) are unchanged.
…ion-tested Address codex review of ee9df80: - Move the PEP 562 __getattr__ behind a TYPE_CHECKING/else branch so pyright keeps rejecting unknown chipcompiler.utility attributes instead of accepting them via the inferred Any return. - Add __dir__ so the five lazy plot names stay in dir()/help()/completion without importing matplotlib. - Add fresh-process regression tests asserting that importing chipcompiler.utility and rendering 'ecc --help' leave matplotlib unloaded, and that the plot exports resolve on demand.
Drop the SECTION argument and --sections topic index: ecc doc now always shows the whole guide. Rendered output opens in the pydoc pager ($PAGER, falling back to less/more) on a terminal and prints in full when piped; --plain keeps its byte-exact output unpaged for scripts and agents. Also stop forcing terminal mode on colorless streams in render_markdown: rich 15 emits ANSI escapes when force_terminal=True even with no_color set, so piped rendered output leaked escape codes.
…ctor Codex re-review found two remaining eager edges: runner.py imported ECCToolsPlot at module top (pulled in by the package __init__), and the tools.ecc package re-exported ECCToolsPlot eagerly, so 'ecc doctor' still imported matplotlib via chipcompiler.tools.ecc.utility. - Move the runner's ECCToolsPlot import into run_analysis, its only use. - Re-export ECCToolsPlot from the package lazily (same PEP 562 pattern as chipcompiler.utility). - Isolate MPLCONFIGDIR with tmp_path in the lazy-plot regression tests and extend them to cover the tools.ecc probe-import path.
console.pager() flattened all styles, so the paged guide lost every heading and emphasis. Page with styles=color instead and default LESS=FRX when the user has no LESS of their own: pydoc spawns plain less, which escapes ANSI sequences unless -R is given.
Move the eight CLI guides from the repo-root docs/ into chipcompiler/docs/ so uv_build includes them in the wheel; only files under the module directory are packaged. guides_root() now resolves them through importlib.resources, which covers dev checkouts, editable installs, and wheel installs with one path; the _MEIPASS branch still serves the PyInstaller bundle. Relative links in the guides, docs/index.md, and the PyInstaller spec datas are updated for the new location.
Codex review of dc83f23 found relative links that never pointed through ../ and were missed by the move (docs/examples/gcd, docs/specification, workspace-cli.md, review-guidelines.md), now resolved as ../../docs/... from chipcompiler/docs/. Add artifact-level guards: a packaging test builds the wheel and asserts all eight guides are inside, and the PyInstaller bundle smoke test in CI now runs ecc doc for an English and a Chinese guide.
Turn on typer's built-in completion options on the root app and let completion requests through the empty-argv help shortcut, since they carry their arguments in _ECC_COMPLETE/COMP_WORDS env vars instead of argv. Document eval "$(ecc --show-completion)" in the en/cn guides, noting the --install-completion caveat on NixOS-style managed rc files.
Section 15 repeated one 'ecc param set KEY VALUE' line for every tunable field (86 for place.*, 24 for floorplan.*), duplicating what 'ecc param list --step STEP' already prints. Keep a few representative examples per step and defer the full enumeration to the CLI; the field tables in sections 2-14 remain the complete reference.
Emin017
force-pushed
the
emin/update-cli-docs
branch
from
September 8, 2026 09:25
ecfd5cd to
e13fbd4
Compare
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.
What Changed
ecc doc <config|ug|tutorial|dev>with English and Chinese guides, byte-exact--plainoutput, and a styled pager for interactive terminals.libfontconfigin the PyInstaller bundle.Scope
Select the areas touched by this PR:
uv.lock, or release artifacts.Runtime And Packaging Impact
ecc-toolsorecc-dreamplacedependency changedNotes:
ecc docand shell completion; existing machine-readable output contracts are unchanged.Validation
List the commands you ran. Mark checks that are not applicable as N/A.
uv run pytest test/uv run ruff check chipcompiler testuv run ruff format --check chipcompiler testecc --help,ecc --version,ecc version --jsonnix run .#cli -- --helpecc docsmoke for English and Chinese guides.Skipped checks and reason:
uv run pytest test/, Nix smoke, and manual flow smoke were not run. The GitHub Actions Test job is still running; lint, commit-message, version, and PyInstaller jobs have passed.Checklist