How to embed a LaTeX engine in a standalone Python 3 program? - python

I have data that I need to analyze and then create a report on from a template using LaTeX. My intent is for the app to be a standalone executable which can run on any windows computer, even if it doesn't have a LaTeX distribution installed.
So my question is this: Can a minimal LaTeX distribution somehow be embedded in the executable generated by tools like PyInstaller, Py2EXE, etc.?

Related

Packaging PyInstaller app using Wix Toolset

I'm trying to figure out what would be the easiest way to create an Installer using Wix Toolset.
I'm building my app in Python and then creating an installer using PyInstaller as a One Folder (not one file) and then want to package it into .msi file. I saw elsewhere that I have to use heat.exe to create a list of all the files, but when I did that I got like 15,000 lines xml file that lists every single file. Not sure if that's the optimal solution or then could be some other way of properly packaging it.
You can start by using auto-py-to-exe to convert your project into an exe file:
pip install auto-py-to-exe
A .py to .exe converter using a simple graphical interface and PyInstaller in Python.
After this you can use any tool to generate the *.msi file such as Wix Toolset or Advanced Installer or other.

additional modules for python in tkinter issue

I'm making a tkinter app in python which requires a few python modules (for example paramiko) that need to be installed additionally.
When I will be done with the whole app and create an executable version of the app (.exe extension), and send this app to one of my friends' computer, can he run the app without having python, paramiko, etc. on his computer?
2nd question: What is the exe equivavelent in mac for that I could make my app runnable instantly (I think of some kind of portable version.)
Thanks!
You want Cx_Freeze
Yes the idea is to turn it into an application that can be run on computers without Python installed. If it does not run correctly then the script has not been properly "frozen".
Cx_Freeze works on all major platforms as described in their front page (see link above for details) but you must freeze it on each platform you wish to develop for (Windows on Windows, Mac on a Mac and so on) There is no executable that can run on all platforms.
There are alternatives such as Pyinstaller and Py2app. The latter works only for Python 2 and is no longer maintained. I would recommend Cx_Freeze or Pyinstaller because they are the only two still being maintained.
Pyinstaller is easier but cx_Freeze also offers a lot of options when building.

Future-proof Python GUI + file drag-and-drop + executable

I have a Python 2.7/Tkinter program that uses TkinterDnD2 and TkDnD (not part of the standard Python distribution) to provide file drag-and-drop in a Win7/Win10 environment. I have been using PyInstaller to create a single-file executable for ease of distribution within our organization. I hadn't touched it for a few years, but it's needing maintenance. Unfortunately, the current version of PyInstaller (3.2) does not produce a working executable with these Tk* modules. (I have a custom arcane hook-_tkinter.py that made it work with an older version of PyInstaller, but have not been able to port it to 3.2.)
I could try replacing PyInstaller; I could try a different GUI toolkit. I would like a solution that will work in Python 3. I need the file drag-and-drop capability. It's not clear whether the TkinterDnD2 and TkDnD are being supported any more.
What would be a viable combination of packages to build a Python 3 GUI with file drag-and-drop and distribute as a "portable" executable?
Python 3 + [tkinter|wxwidgets|pyside|??] + [pyinstaller|cx_freeze|py2exe|??]
I have successfully migrated my application to Python 3.4/PySide 1.2.4/Qt 4.8.7 running in Windows 10, and I can successfully package it into a single-file .exe with PyInstaller 3.2.
The packaging is much more straightforward than it was with Python 2.7 and Tkinter/TkinterDnD2/TkDnD. No custom hooks are needed:
pyi-makespec --windowed --onefile --noupx --icon=appicon.ico app.py
pyinstaller --clean app.spec
This produces app.exe. I use the --clean flag to clear out the pyinstaller cache each time to avoid any problems.
I am also very happy with Qt/PySide. It has solid support for drag-and-drop (which was my requirement from above), a mature set of widgets, and good documentation.
I also looked at the other GUI toolkit candidates, Tkinter and wxwidgets. Tkinter in Python 3 still does not support file drag-and-drop natively, and it did not look like TkinterDnD/TkDnD was being actively supported. Wxwidgets did not appear to support file drag-and-drop either.

Writing Windows GUI applications with embedded Python scripts

What would be the optimal way to develop a basic graphical application for Windows based on a Python console script? It would be great if the solution could be distributed as a standalone directory, containing the .exe file.
As far as I understand your question, you want to write a graphical windows application in Python, to do this I suggest using wxPython and then py2exe to create a standalone exe that can run on any machine without requiring python to be installed
The following tutorial shows everything step by step: Quickly Creating Professional
Looking Application Using wxPython, py2exe and InnoSetup
I would recommend that you use IronPython, which is Microsoft's implementation of Python for the .NET framework.
Tkinter is quick and easy to use. Tkinter is in the Python standard library.

Create single python executable module

Guys, I have much python code in modules which are resides in several python packages and now I need to create single python executable module or file which will include all these files, so it will be working on windows and on linux servers. What are possible solutions and how this can be done?
For windows use py2exe , for linux use pyinstaller and for Mac use py2app
Using these tools you can have a setup.py which based on os will build the final binary.
I have tried all three and they work well, or you can use cx_freeze they claim to be cross-platform
That's what egg files are for. Read this: What are the advantages of packaging your python library/application as an .egg file?
Maybe py2exe can help you ..
py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.
Tutorial > http://www.py2exe.org/index.cgi/Tutorial
You can kivy for python cross plat form application .
Kivy - Open source Python library for rapid development of applications
that make use of innovative user interfaces, such as multi-touch apps

Categories

Resources