[pypy-dev] How to compile a file with rpython

Matti Picus matti.picus at gmail.com
Sun Nov 21 16:38:31 EST 2021


On 21/11/21 9:16 pm, M A wrote:

> How do I make a program using rpython?
>
> Say I have this file:
>
> def main():
>      for i in range(100):
>          print("hello world"),
>      
> if __name__ == "__main__":
>      main()
>
> How would I turn it into an executable file using rpython?


The canonical starting place for rpython is this page [0] in the rpython 
documentation. It is a bit old, so please raise an issue if something 
does not work right. There are some examples in 
rpython/translator/goal/, the targetnopstandalone.py one is close to 
what you are trying to do. If you call


python2 rpython/bin/rpython -O2 
rpython/translator/goal/targetnopstandalone.py


you will get an executable in 
$tmp/usession*/testing_1/targetnopstandalone-c that will print "hello world"


Matti


[0] https://rpython.readthedocs.io/en/latest/getting-started.html



More information about the pypy-dev mailing list