The Python subset
The Python subset
pyscriptc compiles a deliberately strict subset of Python.
When a construct is not supported, compilation stops with a PSxxxx fence that names the exact line, it never guesses.
This page is the practical summary; the full contract lives in docs/supported.md in the repo.
Everyday Python that compiles
print(...), includingsepandendsys.argvaslist[str],sys.platform,sys.exitwith open(path) as f:andf.read(),f.write(...)foroverrange, lists, dict keys, and tuple literals;breakandcontinue- Slices, including negative steps (
s[::-1]) sorted(xs, key=lambda x: ...)for the common key casesif/elif/else, mixedand/orin value position- Comprehensions over one
forwithout filters - f-strings with simple interpolations,
%sand%dformatting try/except ValueError:andexcept Exception:(the exception model is growing milestone by milestone)- Single-file programs and directories resolved as a package
- A broad set of
str,list,dict,int,float,bytes, andpathlib.Pathmethods, plus scalar casts likeint("42")
What stays fenced
argparse,requests, and most imports outside the lowered stdlib table**kwargs, user decorators,super(), multiple inheritance, starred callsfinally,except ... as e(for now)withstatements other thanopen(...)andimportlib.resources.as_file(...)- Non Latin-1 string literals
- Async, threads, dynamic
getattron non-literal names,eval/exec
Checking your own code
Run pyscriptc coverage FILE to get a per-line fence report before compiling, or pyscriptc explain PS2001 to look up what a fence code means and the smallest rewrite that clears it.