Add CI: ASCII source check and IronPython 2.7 compile/import checks#22
Merged
Conversation
Two jobs on every PR and push to main: - ascii-check (ubuntu): fail on any non-ASCII byte in src/*.py. IronPython 2.7 enforces PEP 263 (ASCII source unless declared), so a stray em-dash makes CODESYS refuse to load the file. Caught live during v0.2.0 validation (1904590); Python 3 py_compile cannot see it. - ironpython (windows): download IronPython 2.7.12 (the engine family CODESYS ScriptEngine embeds) and (a) compile every src file, catching Python 2 syntax errors, and (b) import every library module against a stubbed scriptengine, catching module-scope errors. The import path uses the strict file tokenizer, so it also enforces PEP 263 for the library modules. Verified locally against IronPython 2.7.12 on Windows: all checks pass on current src, and a planted em-dash file fails ascii-check and the import path (IronPython compile() of a string is lax about PEP 263; noted in compile_all.py).
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.
Adds a CI workflow with two jobs, run on every PR and push to main:
src/*.py. IronPython 2.7 enforces PEP 263 (ASCII source unless an encoding is declared), so a stray em-dash or smart quote makes CODESYS refuse to load the file. This exact failure was caught live during v0.2.0 validation; Python 3 py_compile cannot see it.scriptengine(module-scope errors). The import path uses IronPython's strict file tokenizer, so it also enforces PEP 263 for library modules.Verified locally on Windows against real IronPython 2.7.12: all checks pass on current src; a planted em-dash file fails ascii-check and the import path. One subtlety documented in
compile_all.py: IronPython'scompile()of an in-memory string does not enforce PEP 263 (only the file-based execute/import paths do), so the encoding class is owned by ascii-check rather than the compile step.Once this is green, the two job names (
ascii-check,ironpython) should be added to the branch protection required status checks on main.