Skip to content

[CI] lint: Reject importing a name through a module that only re-imports it - #47992

Merged
hnyls2002 merged 4 commits into
mainfrom
lsyin/indirect-import-lint
Nov 3, 2026
Merged

hnyls2002 merged 4 commits into
mainfrom
lsyin/indirect-import-lint

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator
  • Add scripts/lint/check_indirect_imports.py as the check-indirect-imports pre-commit hook. It rejects from sglang.a import f when sglang/a.py does not define f but only imports it, and names the module that sglang.a imports f from.
  • A module still exports an imported name when it says so: the name is in its literal __all__, it imports it as f as f, it is a package __init__.py, or it binds the name inside an if / try (the module that picks an implementation per platform or as a fallback). Relative imports are resolved and checked like absolute ones, not rejected.
  • The hook checks the changed files on each commit and the whole tree under pre-commit run --all-files, which the lint workflow runs.
  • Fix the ten imports the check flags on main: choice lists read through server_args now come from sglang.srt.arg_groups.choices (server_args keeps its public block for plugins), and two tests take get_tokenizer from sglang.benchmark.utils.

No behavior change.


CI States

Latest PR Test (Base): 🚫 Run #41572148959
Latest PR Test (Extra): ❌ Run #41572148835
Latest PR Test (AMD ROCm 10): ⏳ Run #41572149095

Tip

Base CI only covers the core cases, and its workload may not exercise your change. Use /rerun-test to run the tests your change touches, or copy this prompt for an agent:

Find the registered tests this PR affects and run them with /rerun-test, following https://github.com/sgl-project/sglang/blob/main/.agents/skills/rerun-test/SKILL.md

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@mintlify

mintlify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
sglang-doc 🟢 Ready View Preview Nov 3, 2026, 3:16 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@hnyls2002
hnyls2002 force-pushed the lsyin/indirect-import-lint branch from c0ed610 to 4d14ef6 Compare November 3, 2026 03:13
@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

npu run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant