Skip to content

Sharper pyxle check: semantic analysis, duplicate-export detection, accurate JSX lines#6

Merged
shivamsn97 merged 1 commit into
mainfrom
fix/pyxle-check
Jul 2, 2026
Merged

Sharper pyxle check: semantic analysis, duplicate-export detection, accurate JSX lines#6
shivamsn97 merged 1 commit into
mainfrom
fix/pyxle-check

Conversation

@shivamsn97

Copy link
Copy Markdown
Member

Hardens the pyxle check flagship command, which caught only syntax before.

  • Semantic layer (pyflakes). Flags undefined names — e.g. a handler that raises a symbol it never imported — plus unused imports and redefinitions. Opt-in validate_semantics on the parser (mirrors validate_jsx); compiler-injected runtime names are whitelisted so the idiomatic decorators/error classes never read as undefined. pyflakes added as a lazily-imported dependency; verified no false positives on the pyxle.dev site.
  • Duplicate export default is now flagged at check time. @babel/parser accepts two default exports though esbuild rejects them at build — so a build-breaking mistake used to pass check. (Detection ships in the JSX extractor — pyxle-langkit.)
  • Accurate JSX error lines. _validate_jsx_syntax used to report the JSX block's first line for every error; it now maps Babel's real line. Babel's misleading "Unterminated regular expression" also gets a plain-language hint.
  • Auto-inject LoaderError + invalidate_routes (parity with ActionError/ValidationActionError) — raise LoaderError(...) works with no import.
  • pyxle install --break-system-packages for externally-managed (PEP 668) environments.

Docs: AGENTS.md, runtime-api, CLI reference, changelog 0.6.1. Full suite green (coverage ≥ 95%).

…lines

`pyxle check` now catches classes of mistake it used to wave through:

- A semantic layer via pyflakes over the Python section — undefined names
  (e.g. a symbol you `raise` but never imported), unused imports, and
  redefinitions, past the existing syntax check. Opt-in `validate_semantics`;
  compiler-injected runtime names are whitelisted. Adds pyflakes as a
  lazily-imported dependency.
- Duplicate `export default` is now flagged at check time (@babel/parser
  accepts it, esbuild rejects it — so it used to pass check and only break at
  build). The JSX extractor detects it; the extractor change ships in
  pyxle-langkit.
- JSX syntax errors now report the real source line instead of the JSX block
  start, with a plain-language hint for Babel's "Unterminated regular
  expression" (its guess for an unclosed `{ }`).

Also: auto-inject `LoaderError` and `invalidate_routes` (parity with
`ActionError` / `ValidationActionError`) so `raise LoaderError(...)` works with
no import; and `pyxle install --break-system-packages` for externally-managed
(PEP 668) environments.

Bumps 0.6.0 -> 0.6.1.
@shivamsn97 shivamsn97 merged commit e801341 into main Jul 2, 2026
5 checks passed
@shivamsn97 shivamsn97 changed the title fix: pyxle check — semantic analysis, duplicate-export, accurate JSX lines Sharper pyxle check: semantic analysis, duplicate-export detection, accurate JSX lines Jul 7, 2026
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.

1 participant