Repository navigation
cli: pyfun build --native compiles a program with mypyc - #156
Merged
Merged
Conversation
pyfun build --native <file> -o <dir> compiles the program natively (ladders and annotations), runs mypyc on it with --allow-redefinition-new and --local-partial-types, removes the Python source so an import finds the extension, and writes a __main__.py, so the result runs as python <dir>. It needs mypy and a C compiler in the interpreter's environment and says so when mypyc fails. Single file for now. bench/mypyc_run.py now builds its mypyc variant with this command, so the native-bench job exercises it.
This was referenced Sep 28, 2026
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.
The build step the ROADMAP lists after typed emit (#155).
pyfun build --native <file.pyfun> -o <dir>:python -m mypyc --allow-redefinition-new --local-partial-types <module>.pyin<dir>(interpreter fromPYFUN_PYTHONor PATH),build/scratch,__main__.pyimporting the module, so the result runs aspython <dir>.It needs
mypyand a C compiler in that environment; when mypyc fails the error says so.--nativeis required for now, since native is the only build there is. Single file for now (projects error clearly).bench/mypyc_run.pynow builds its mypyc variant withpyfun build --native, so this PR'snative-benchrun exercises the command end to end on Linux. Locally on Windows it reaches mypyc'sbuild_extand stops for lack of the MSVC Build Tools, with the intended error message.DESIGN §5.6 and ROADMAP updated.