Packaging my text-user-interface and its requirements.txt libraries into a "1-click" executable #4512
-
Hi Guys! I have built a pretty simple text-user-interface with textual for a third-party command line interface library I am utilizing. My current objective is to package the TUI as a binary/executable, I want the executable to be "1-click", meaning I don't need the end-user to install any libraries (the CLI or textual), or even python itself honestly (even though that should be very uncommon). The basic project hierarchy is like so:
The CLI I am building the TUI for is a part of the PyPi repository, and is including in my TUI requirements.txt, so it should be easy to add to the packaged executable. How would I go about doing something like this? I have already attempted using PyInstaller using the following command:
However, it doesn't seem to package the CLI with the TUI. When I attempt to run the TUI it hits my internal error check for whether the TUI can be called, and errors out. Does anybody have prior experience packaging a small textual project with additional python library requirements like this? If so, I would greatly appreciate some advice on whether a different packaging library worked better for you, or if I may be doing something wrong with PyInstaller. Any advice is much appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Today was my first time trying
What exactly is that code and the traceback? |
Beta Was this translation helpful? Give feedback.
-
I have used pyinstaller for other applications (Tkinter UIs) successfully and am now building an app using pyinstaller with Textualize (for the first time). Don't know if this will be helpful or prompt you to discover your specific solution but ran into an issue today where pyinstaller was missing a Textualize module. Generally pyinstaller is pretty good at discovering all the dependencies and if not there is a mechanism to force things. The runtime issue Traceback was:
To resolve this, I added the following to my pyinstaller Analysis():
Looking at the latest (0.67.1) textualize source it appears that "_tab_pane" is not referenced directly anywhere but perhaps I'm missing something. Currently, I'm only using a handful of widgets and containers so did not do a thorough search on other modules. Btw, I'm using pyinstaller 6.3.0 in folder mode (not onefile) and a .spec file. Hope that helps. |
Beta Was this translation helpful? Give feedback.
-
Another option here would be Nuitka, which can accomplish the same thing using it's |
Beta Was this translation helpful? Give feedback.
-
A little late here, but I've had great success using Shiv, from the LinkedIn devs. It works just like zip apps do, (PEP 441) but it includes all your dependencies, like PEX. It performs better than PEX, however and has some neat options such as |
Beta Was this translation helpful? Give feedback.
Another option here would be Nuitka, which can accomplish the same thing using it's
--onefile
mode, it should work out of the box, if it doesn't, reach out to me and i can help :)