Skip to content

Fix PrettyPrint dependency compatibility - #118

Closed
appleweiping wants to merge 1 commit into
ReaLLMASIC:mainfrom
appleweiping:fix/78-prettyprint-dependencies
Closed

appleweiping wants to merge 1 commit into
ReaLLMASIC:mainfrom
appleweiping:fix/78-prettyprint-dependencies

Conversation

@appleweiping

@appleweiping appleweiping commented Aug 30, 2026 •

Copy link
Copy Markdown

Summary

  • remove the unused prettyprint package from the base installation
  • constrain PrettyPrintTree to >=1.36.4,<2, whose API matches the existing PortTree.print() call
  • install that renderer in the lightweight unit-test job, which intentionally does not install the package's full dependency set
  • add a regression test that verifies PortTree.print(savetofile=True) writes the expected hierarchy

Why

A clean Python 3.11 installation of current main resolves both prettyprint 0.1.5 and prettyprinttree 2.0.2. On the case-insensitive Windows filesystem used for reproduction, their prettyprint/ and PrettyPrint/ package trees collide. The imports in port_utils.py then fall through to the no-op shim, so PortTree.print() silently produces no file.

Removing only the unused package is not sufficient: PrettyPrintTree 2.0.2 changed its constructor API and raises TypeError for the existing default_orientation option. Version 1.36.4 has the compatible API and already ships a universal py3-none-any wheel.

The original report concerned Apple Silicon. I have not reproduced on arm64 macOS, so this PR limits its claim to the dependency conflict and API mismatch verified on Windows/Python 3.11.

Tests

  • python -m pytest -q tests/test_port_tree.py — 1 passed
  • python -m pytest -q tests/test_port_tree.py tests/test_import_paths.py tests/test_repo_layout.py — 9 passed
  • python -m pytest -q tests --ignore=tests/test_cells_layout.py — 26 passed, 16 subtests passed
  • .github/workflows/tests.yml parsed successfully with PyYAML
  • regression check with the dependencies selected by current setup.py (prettyprint 0.1.5 + PrettyPrintTree 2.0.2) — new test fails because the output file is not created

The passing runs report existing Pydantic v2 deprecation warnings; this change does not add or address them.

Review status

This is intentionally a draft while awaiting maintainer direction in #78. It preserves the current PortTree API and avoids broader renderer or packaging refactors.

Closes #78

Assisted-by: OpenAI Codex

@appleweiping
appleweiping force-pushed the fix/78-prettyprint-dependencies branch from cd53445 to 3e129ed Compare August 30, 2026 09:31
Remove the unused prettyprint package, which collides with PrettyPrintTree on case-insensitive filesystems. Constrain PrettyPrintTree to the compatible 1.x API, install it in the lightweight unit-test job, and cover PortTree text output with a regression test.

Signed-off-by: Weiping Yan <152196713+appleweiping@users.noreply.github.com>
Assisted-by: OpenAI Codex
@appleweiping appleweiping reopened this Aug 30, 2026
@appleweiping appleweiping mentioned this pull request Aug 30, 2026
@appleweiping

Copy link
Copy Markdown
Author

Closing this draft in favour of #123, which supersedes its dependency fix.

This draft pinned prettyprinttree>=1.36.4,<2. That alone is not sufficient: 1.36.x does not constrain its own cmd2 dependency, and cmd2 4.x moved cmd2.ansi, which makes PrettyPrint unimportable — port_utils then silently falls back to its no-op shim, so PortTree.print() produces no output rather than raising. #123 adds the cmd2<3 bound as well, so the printer actually runs.

This draft also carries a regression test (tests/test_port_tree.py) that builds a component, calls PortTree.print(savetofile=True, ...), and asserts the hierarchy reaches the file, plus a line adding prettyprinttree to the test job so the fast gdstk workflow would cover it. I have not kept that in #123 because I cannot run gLayout locally to confirm the test passes in your CI environment, and I would rather not add a test to a PR on the strength of an untested guess. If you would like it there, say so on #123 and I will add it — or take it from this branch directly.

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.

PrettyPrint

1 participant