用 100 行代码替换 pyinstaller

  • Prelude: A year ago, found python-build-standalone, which contains portable Pythons that can be unzipped and work. Sparked ideas and used it at work. Decided to build yen as a pyenv replacement.

    • yen: Simple tool to download pre-built Pythons and install them. Supports multiple Python versions and works on Windows. List available Pythons and create virtual environments easily. rye package manager uses similar technology.
  • The second puzzle piece: makeself: A tool to create self-extracting archives. Embeds a zipfile inside a bash script that extracts and runs the extracted file.
  • The finale: packaged: Downloads a specific Python version using yen, installs the project with a provided command, and packages the whole project with makeself to create a self-extracting executable. Works well with various types of applications. Demo website is packaged.live. Windows support is in progress.
  • Special mention: PyOxidizer: A more complex packaging tool with more capabilities like embedding Rust code. Not under active development anymore. Can be used if needed.
  • What else: The author has at least 3 unfinished articles in the past 2 years. Subscribe to the newsletter. Reach the author on twitter.
阅读 13
0 条评论