r/Python • u/nannigalaxy • Aug 17 '24
Showcase Standalone GUI app that executes python scripts: Run py scripts without any installations*
Announcing an app (portable executable) I build which is a solution for running Python scripts without any prerequisites or external system dependencies, eliminating the need for Python installation on the systems. Catch is that the packages which script uses should be bundled during app build process, so a new app should be build respectively. there is a plan to provide option to include local package path if exists on system.
What My Project Does
Runs python script out-of-the-box provided the packages that are used by script are add during build pipeline.
isolated from system. meaning doesn't affect any changes in system or python, don't need to fiddle with paths and packages
Output of script are displayed on terminal like console
Target Audience
This was build to help run scripts consistently across systems with any breakage from python or packages.
imo this can also help make non-technical people's life easy.
Comparison
This works like python interpreter without the hassle of setup and management
Limitations
Script execution fails if the required package is not already bundled in the app.
Python and Packages are immutable, they cannot be modified including versions.
App size and initial load time increases as more number of packages are added.
Pyinstaller is pain to work with (imo), and any windows os change might break the app.
https://github.com/Nannigalaxy/PyScript-Engine
let me know if you have any thoughts on this.
15
u/denehoffman Aug 17 '24
Don’t include optional dependencies or dependencies of dependencies in requirements.txt. That file should include only the packages necessary to run your scripts.
-31
u/nannigalaxy Aug 17 '24 edited Aug 17 '24
I was lazy, hence the comment. and wanted to show the scope
6
u/denehoffman Aug 17 '24
What’s the difference between this and running python myscript.py in a command line? You still need to install dependencies, and if running a python script in the manner I just described is too technical for people, then this will probably be as well. Also, you made it windows-only and I honestly can’t see a reason why, other than using windows path objects?
-4
u/nannigalaxy Aug 17 '24
no, this app does require anything to install on the system. no python or package, this'll already be bundled in the app. you just share this app to user, they open and execute the script. hope this clears the usecase
6
u/w8eight Aug 17 '24
What if the user has some dependencies in the script, that aren't installed?
0
u/billsil Aug 18 '24
Drop the files from the package into the python path. I've hacked new packages into Abaqus CAE and Paraview. It's just a matter of finding compatible versions of packages based on the version of python and other dependencies they're running. Generally you can just look at when packages were released (by checking PyPi) and trying versions from around then. Bisect from there to try and find the newest possible version.
0
u/w8eight Aug 18 '24
But this solution doesn't require python installed (I assume it's in the executable)
And manipulating packages manually kinda defeats the purpose of this program, don't you agree?
0
u/billsil Aug 18 '24
I don’t understand your use case, so defeating the purpose of your project is not my aim, but people have been trying to use python without installing python for all 18 years I’ve been using python for various reasons. People find workarounds.
You’re on windows. Why not use the Microsoft Store? It’s really hard to mess that one up.
PyInstaller sometimes works and regularly breaks when new versions of Windows comes out. Installing python is the best solution.
1
u/w8eight Aug 18 '24
Dude, I'm not the owner of this project, I just mentioned the caveats of it to the op (besides the obvious ones that come with usage of pyinstaller)?
I personally would never use stuff like this project, just wanted to point out the shortcomings to the op. Either learn to read the comments you respond to, or simply don't respond.
0
u/billsil Aug 18 '24
Sure seemed like you were based on your questions to me. Why did you assume my questions were to you and not OP? You did the same thing.
It seems like we both don’t understand the use case.
-1
u/w8eight Aug 18 '24
Well usually when you respond to someone's comment, you want to interact with that person, I don't know why I should explain that to you...
If you want to point things out to the OP, maybe respond to the post next time.
0
u/billsil Aug 18 '24
You asked a straightforward question that I responded to. You responded with questions and then I thought you were OP. You did the exact same thing as me.
→ More replies (0)-7
4
u/Specialist-Arachnid6 Ignoring PEP 8 Aug 17 '24
uhmm so basically pyinstaller exe with more steps or is my dumbass missing something here?
0
u/nannigalaxy Aug 17 '24
let me give you more context why i built this. in my workplace people run python scripts manually for some tasks. they are not programmer. very agile code expect for package and versions, they remain more or less the same. so had to install and manage on many systems. sometimes something changes in path and it breaks. also people had hard time navigating to script to run via terminal, not much standard was set.
6
u/denehoffman Aug 17 '24
Why not just put python scripts in users’ $PATH, chmod +x them, and add a shebang at the top with a venv or the system Python with the packages installed? Then they don’t have to search for scripts at all and they also don’t have to open a GUI to run a Python script
3
8
4
u/djdadi Aug 17 '24
I am a little confused who the target audience of this would be. I use PyInstaller all the time at work; making an executable that techs can use without understanding what a "pip" or a "venv" is. But my build pipeline would freeze everything and make it so they really can't use that executable for anything other than that specific thing.
So, is this for people like me building the packaged apps, or people like the techs I work with who consume those apps?
0
u/nannigalaxy Aug 17 '24
for people like you who build apps so others in your work use. goes both ways ¯_(ツ)_/¯
6
u/djdadi Aug 17 '24
I guess I am not sure of the value-add in that case. Right now I run a
build.pyscript that I made that generates a docker image tarball, a.specfile, cleans up the filesystem, then builds the solution via PyInstaller. This delivers an executable that is essentially a portable Python with all deps; users can run it and see the output, interact, etc.I am not sure where something like this fits in: it would make my life harder, and it would not make my users life any easier. Congrats on the project, seeing something through all the way is more than I can muster sometimes. Perhaps targetting either delivery OR consumption (but not both) would make this more useful.
3
u/pyhannes Aug 17 '24
You can run any Python script including needed dependencies (included in a special comment-forgot which PEP this was) already using Hatch and Astral's UV...
2
u/nannigalaxy Aug 17 '24
sorry I didn't get it, on quick read here's what I understood, those are python management tools. even these need to be installed on the system, which I wanted to avoid altogether. app's moto: download the app, open the app, run the script.
2
u/pyhannes Aug 17 '24
As easy for UV and hatch. E.g UV https://docs.astral.sh/uv/guides/scripts/ . Just install the latest UV executable and run:
uv run script.py1
7
4
u/cowrevengeJP Aug 17 '24
Pass. This adds no value. Anyone who is running python scripts should know how they work in the first place.
2
u/glaucomasuccs Aug 18 '24
No disrespect intended, but you're trying to reinvent the wheel. If you're building distributable code, you should do so knowing 1) the user can run it with python, or 2) you can make an easy executable, with pyinstaller that the user can just run. Your program is an unnecessary dependency.
3
u/benefit_of_mrkite Aug 17 '24
I would have loved finding something like this on someone’s system back when I was a pen tester
-4
u/juanfnavarror Aug 17 '24 edited Aug 17 '24
I think this is amazing. Often at work there are instances where I want to make one-off scripts for other people but its hard to get 5 minutes on their machine to set up python/venv so they can run it. And using pyinstaller is cool but it needs a lot of boilerplate setup, and its never enough because the lack of msi/setup tools. Dont get me started with windows defender crapping all over “one-file” mode.
Just getting a python runner their machine and they can run the one-off scripts from the shared drive is amazing.
0
u/juanfnavarror Aug 17 '24
Two features that would be golden on this (kick ass), ability to get stdin from the runner window, and support for colored/ANSI logging, and build in scripts (presets).
32
u/riklaunim Aug 17 '24
"PyScript" already exists and is probably a trademark as well.
Not sure what would be the use-case of this. It's just replaces the GUI and you still have to pre-build it.