Skip to content

chore: lint imports that are not at the top-level of a file - #69

Merged
SuMayaBee merged 2 commits into
mainfrom
enforce-top-level-imports
Aug 19, 2026
Merged

SuMayaBee merged 2 commits into
mainfrom
enforce-top-level-imports

Conversation

@SuMayaBee

Copy link
Copy Markdown
Collaborator

Description

Turns on ruff's PLC0415 (import should be at the top level of a file), so a lazy import gets caught by lint instead of only in review. Bumps the pinned ruff pre-commit rev to v0.15.5, the rule only became stable there.

Every import this flagged was already deliberately lazy, so each gets a # noqa: PLC0415 and a comment naming its measured cost.

Fixes #68

AI Disclosure

  • Tool & Model: Claude Code

  • I have tested all AI-generated content in my PR.

  • I take responsibility for all AI-generated content in my PR.

Checklist

  • Tests added and are passing

@SuMayaBee
SuMayaBee requested a review from ahuang11 August 19, 2026 21:56
@SuMayaBee

Copy link
Copy Markdown
Collaborator Author

@ahuang11 It's ready for review, here is the detail overview:

Import Cost Why it stays nested
panel (app.py) ~704 ms only pls serve needs it
panel_live_server.pages (app.py) ~1510 ms only pls serve needs it
panel_live_server.app (cli.py) ~532 ms only pls serve needs it
panel_live_server.server (cli.py) ~528 ms only pls mcp needs it
panel / bokeh (utils.py) ~704 ms / ~289 ms cli.py imports utils to fix the Windows DLL path before any heavy import
playwright (screenshot.py) ~31 ms kept for robustness, not cost: a broken install should disable screenshots, not pls mcp

@SuMayaBee
SuMayaBee merged commit b63c4db into main Aug 19, 2026
8 checks passed
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.

Lint imports that are not at the top level of a file

2 participants