3 ms·
I keep meaning to investigate how I can use your tools to create single-file executables for Python projects, so thanks for posting and reminding me.
by elbear 1y ago
I keep meaning to investigate how I can use your tools to create single-file executables for Python projects, so thanks for posting and reminding me.
- ahgamut 1y agoMy early contributions to https://github.com/jart/cosmopolitan https://github.com/jart/cosmopolitan were focused towards getting a single-file Python executable. I wanted my Python scripts to run on both Windows and Linux, and now they do. To try out Python, you can: wget https://cosmo.zip/pub/cosmos/bin/python -qO python.com chmod +x python.com ./python.com Adding pure-Python libraries just means downloading the wheel and adding files to the binary using the zip command: ./python.com -m pip download Click mkdir -p Lib && cd Lib unzip ../click*.whl cd .. zip -qr ./python.com Lib/ ./python.com # can now import click Cosmopolitan Libc provides some nice APIs to load arguments at startup, like cosmo_args() [1], if you'd like to run the Python binary as a specific program. For example, you could set the startup arguments to `-m datasette`. [1]: https://github.com/jart/cosmopolitan/commit/4e9566cd3328626d903de3d10c8abfd2daef12d9#diff-8069dfa7a386e941d414eaa8289e33f62c9c94e471a705bdf1ed047509fc9e88 https://github.com/jart/cosmopolitan/commit/4e9566cd3328626d...