- Set up it into an current Python interpreter. That is the most typical state of affairs, nevertheless it requires organising a replica of the interpreter. At finest, this implies a completely separate step, one fraught with complexity if Python variations exist already on the system. That is additionally the state of affairs folks wish to keep away from within the first place, as a result of they wish to make their app as straightforward to redistibute as attainable.
- Bundle the interpreter with this system and its dependencies. That is the method taken by tasks like PyInstaller and Nuitka. The downsides are that the deliverables are usually fairly massive, and creating them requires studying the quirks of those tasks. However they do work.
- Use a system like Docker to bundle this system. Docker containers introduce their very own world of trade-offs. On the one hand, you get completely every part you’ll want to run this system, together with any system-level dependencies. However, the ensuing container may be positively hefty. And, in fact, utilizing Docker means adopting a further software program ecosystem.
Among the newer options to the issue attempt to remedy one explicit ache level or one other, as a method to make the entire subject much less unpalatable. As an illustration, PyApp makes use of Rust to construct a self-extracting binary that installs the wanted Python distribution, your app, and all its dependencies. It has two massive drawbacks: you want the Rust compiler to construct it on your venture, and your venture should be an installable package deal that makes use of the pyproject.toml normal. The primary of those necessities is more likely to be the bigger hurdle; most Python tasks want a pyproject.toml of some sort at this level.
One other answer is one I wrote myself: pydeploy. It additionally requires the venture in query be installable through pip set up. In any other case, pydeploy wants nothing greater than Python’s normal library to generate a self-contained deliverable with the Python runtime included. Its massive downside proper now could be that it solely works for Microsoft Home windows, however in concept it might work on any working system.
Perhaps sometime
All of the latest main modifications being proposed for Python, comparable to the brand new native JIT and full concurrency or multithreading, are supposed to improve Python’s habits as a dynamic language. Any proposals designed to vary that dynamism basically would imply creating a brand new language with totally different expectations about its habits.
