• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

source-academy / py-slang / 30692388702
86%

Build:
DEFAULT BRANCH: main
Ran 01 Aug 2026 09:03AM UTC
Jobs 1
Files 134
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

01 Aug 2026 08:45AM UTC coverage: 86.121% (+0.08%) from 86.044%
30692388702

push

github

web-flow
Add local-file ("folder") imports for py2js (§2+) (#379)

* Add local-file ("folder") imports for py2js (§2+)

Copies js-slang's own "folder" treatment for local, relative imports
(`from .foo import bar`), scoped to the py2js engine. Local file
resolution goes through IRunnerPlugin.requestFile — already published,
already backed by the frontend's folder-mode file store — so this needed
no conductor protocol change.

Implemented as a genuine source-to-source transform
(src/modules/localImports.ts, engine-agnostic): every locally-imported
file becomes a `def __module_x__(): ...` wrapping that file's own
statements, returning a real SICPy linked list of (name, value) pairs;
the importer's own `from .foo import bar` becomes a plain lookup against
it via a generated `__access_named_export__` walk — line for line the
same shape as js-slang's own local-import prelude. The whole multi-file
program flattens into one ordinary Python source string before anything
is parsed/compiled, so it's exactly the artifact a student can be shown
via `print(__program__)`, and needs no per-engine runtime support.

Requires SICPy §2 or higher, mirroring js-slang's own restriction to
Source §2+ for the identical reason: the pair/list transfer structure
doesn't exist below that chapter. CSE, PVML, and the WASM engine reject
a relative import explicitly rather than silently mistreating a dotted
path as a Source Academy module name.

Also fixes a real, separate bug this surfaced: Py2JsEvaluatorBase never
supplied `__program__` at all, so referencing it crashed every chapter
with a raw ReferenceError instead of failing gracefully (or working).
Py2JsSession now keeps `__program__` current itself, automatically, from
whatever text it actually compiles for a given chunk — mirroring the CSE
machine's own internal handling — rather than relying on an external
caller to remember to wire it up.

See source-academy/py-slang#378.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Clau... (continued)

4583 of 5737 branches covered (79.88%)

Branch coverage included in aggregate %.

188 of 206 new or added lines in 12 files covered. (91.26%)

10222 of 11454 relevant lines covered (89.24%)

169653.88 hits per line

Uncovered Changes

Lines Coverage ∆ File
8
90.96
src/modules/localImports.ts
5
83.71
-1.83% src/engines/py2js/index.ts
3
84.21
-7.22% src/conductor/Py2JsEvaluator.ts
1
92.11
-0.32% src/engines/pvml/pvml-compiler.ts
1
89.66
-0.39% src/engines/wasm/builderGenerator.ts
Jobs
ID Job ID Ran Files Coverage
1 30692388702.1 01 Aug 2026 09:03AM UTC 134
86.12
GitHub Action Run
Source Files on build 30692388702
  • Tree
  • List 134
  • Changed 12
  • Source Changed 11
  • Coverage Changed 12
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #30692388702
  • 2c96aef4 on github
  • Prev Build on main (#30680727861)
  • Next Build on main (#30741646191)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc