Skip to content

Add CI: ASCII source check and IronPython 2.7 compile/import checks#22

Merged
gsokoll merged 1 commit into
mainfrom
ci/ironpython-checks
Jun 12, 2026
Merged

Add CI: ASCII source check and IronPython 2.7 compile/import checks#22
gsokoll merged 1 commit into
mainfrom
ci/ironpython-checks

Conversation

@gsokoll

@gsokoll gsokoll commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Adds a CI workflow with two jobs, run on every PR and push to main:

  • ascii-check (Ubuntu, seconds): fails on any non-ASCII byte in 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.
  • ironpython (Windows, ~2 min): downloads IronPython 2.7.12 (the engine family CODESYS ScriptEngine embeds), compiles every src file (Python 2 syntax errors), and imports every library module against a stubbed 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's compile() 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.

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).
@gsokoll gsokoll merged commit 541aecc into main Jun 12, 2026
2 checks passed
@gsokoll gsokoll deleted the ci/ironpython-checks branch June 12, 2026 01:33
@gsokoll gsokoll mentioned this pull request Jun 12, 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