Sharper pyxle check: semantic analysis, duplicate-export detection, accurate JSX lines#6
Merged
Merged
Conversation
…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.
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.
Hardens the
pyxle checkflagship command, which caught only syntax before.raises a symbol it never imported — plus unused imports and redefinitions. Opt-invalidate_semanticson the parser (mirrorsvalidate_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.export defaultis now flagged at check time.@babel/parseraccepts two default exports though esbuild rejects them at build — so a build-breaking mistake used to passcheck. (Detection ships in the JSX extractor — pyxle-langkit.)_validate_jsx_syntaxused 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.LoaderError+invalidate_routes(parity withActionError/ValidationActionError) —raise LoaderError(...)works with no import.pyxle install --break-system-packagesfor externally-managed (PEP 668) environments.Docs: AGENTS.md, runtime-api, CLI reference, changelog 0.6.1. Full suite green (coverage ≥ 95%).