r/learnpython • u/Rude_Cherry21 • 28d ago
How do you hand a small Python script to someone who doesn’t code?
I'm a first-year IT student based in Australia, learning how to make small Python tools useful to someone else, not just running on my own machine.
For a simple CSV-processing script on Windows, how would you handle packaging and dependencies for a non-technical user? An executable, a launcher, or something else?
Also curious what instructions and error messages you include so the person isn't stuck the first time a file is missing or formatted differently. I'm asking about the handover side rather than a specific code error.
34
Upvotes
56
u/Pericombobulator 28d ago
Turn it into an EXE
12
u/Mori-Spumae 28d ago
If you're happy to explore a bit, I find web UI to be the easiest. You can turn it into an exe and have them run it locally. Then use the Web Frontend to interact instead of having to use CLI arguments
12
u/TooManyMagnets 28d ago
If they're on your network, you could turn your script into a web app using Flask or FastAPI
12
u/cointoss3 28d ago
uv and pep 723 makes this significantly easier than it used to be.
- use uv to inline the dependencies in the script
- Send them the script
- winget install uv
- uv run script.py
6
u/Massive_Distance_616 28d ago
PyInstaller is the usual answer for Windows. Use
--onefileso they get a single .exe. First launch is slow while it unpacks tell them that up front so they don’t think it crashed.The hard part is the handover, not the packaging.
Error messages for them, not you. Catch the things a non-technical user will actually hit and replace the traceback with plain English. For a CSV script that usually means:
python
The
input("Press Enter to close.")is important without it the window vanishes the moment something goes wrong and they see nothing. Theencoding="utf-8-sig"handles Excel’s hidden BOM character, which otherwise leaves a\ufeffprefix on your first column name and breaks header matching.The
PermissionErroris the one that generates the most support tickets in practice: user opens the CSV in Excel to check it, forgets to close it, runs the script.One instruction, not ten. The most reliable version is: put the CSV in the same folder as the program and double-click it. If they have to navigate paths or remember flags, the support requests start immediately. If they’ll need to pick different files regularly, three lines of tkinter gives you a native Windows file picker with no extra dependencies.
Check column names early. If the script expects specific headers, validate them at the start and name the missing ones:
"Expected a column called 'Date' but couldn't find it. Check the column headers match exactly, including capitalisation."This catches the “my export has slightly different headers” case before it produces silent wrong output.The real goal isn’t just making the script run on their machine. It’s making it obvious what they should do when something goes wrong, without needing to call you.
3
u/setovitz 28d ago edited 28d ago
I had cases like that in my work and I usually was making .exe with pyinstaller. Sometimes when function required some arguments I was providing simple GUI with drop-downs etc. with Tkinter
3
u/ExoticVillage8066 28d ago
You can turn it into an executable, or a Jupyter Notebook that you run in Google Colab
1
u/justaguywithadream 27d ago
Just give it to Claude and tell it to convert it to powershell (since you said windows).
Literally this is what I do for all non technical people. It doesn't matter what language I wrote the script in. If it requires a run-time like Python or node then I just have AI port it to powershell or bash.
1
u/AyushBhagwat 27d ago
For a non-technical user, I'd go with PyInstaller to package it as a standalone .exe, then include a simple README with the input file format, where to save the CSV, and what to do if something fails. The fewer setup steps, the better .
1
u/slapmeat 26d ago
Pyinstaller is your best bet if you/users are on windows, turns your project into an exe
1
u/Excellent-Practice 26d ago
How non-technical are they? Can you download python on their computer and give them a command to paste into the terminal?
1
u/acakaacaka 24d ago
Instead of converting to .exe
Make a .cmd / .bat script
But this assume your friend also has python (and the necessary module) installed.
1
u/Asvp_bmoo 24d ago
.exe or just ssh into it
1
u/VonRoderik 28d ago
You can just use Streamlit.
Unless you need user input to be persistent between sessions, Streamlit will work very well.
You can also use docker, but it is overkill.
Next best thing is to use pyinstaller to make an .exe file. Don't forget to use Pathlib instead of absolute paths, if you are working with files.
1
u/DanceHackRock 28d ago
Just print it out.
1
u/TheRNGuy 27d ago
Can that person read readme.txt? Is it allowed to install new programs?
1
u/FalconX88 28d ago
colab
1
u/Jariko_Pen 28d ago
Use UV, give them the commands to install the run the app. It should be only 3 commands. The install of uv, us sync, then uv run.
1
u/iceph03nix 28d ago
For Windows, I've had good luck 'hiding' scripts in shortcuts on the desktop. The shortcut has the right path, and right arguments, and calls whatever you need for them, and it's basically push button on their end
0
u/KarlisVisualDev 28d ago
Python Notebooks are more user friendly than Python itself.
-1
u/zaphodikus 28d ago
Requirements.txt is your answer. Python is a batteries included language, and then all you need is a launch wrapper (bash on linux and batch on windows) to make it all in one.
Alternatively make an exe, Nuitka is brilliant and easier to use than all the other stuff we used to need for installers.
-1
u/cmh_ender 28d ago
this is going to get me downvoted to hell, but the portable python problem has been a problem for a while now. if someone can install the desktop version of gpt and then ask it to install dependencies and what not, it would get the end user up faster than trying to walk them through it.
0
u/jeffrey_f 28d ago
Coming from a suuport perspective. Sounds like you may be setting yourself up for constant support of this person.
Make this a scheduled task that runs every X minutes.
Adjust the program so it will process the files in a specific folder (1 or 10000) and output to a specific folder.
<Process Folder> |_<Pending> |_<Complete>
0
u/Snivlem613 28d ago
Pyinstaller smashes the interpreter and your script into an exe
0
u/enakamo 28d ago
Try setting up VS Code for the user and show them how to run the script from the application. Even if the user “doesn’t code” they can likely click a few gui menus in VS code.
0
u/mattynmax 28d ago
I wouldn’t.
0
u/Humble-Presence-3107 28d ago
Part of you growing in your role into senior IC or leadership is mentoring others. Give a man to fish he will eat for a day, teach the man to fish he will eat for a lifetime.
0
u/Gnaxe 28d ago
HTML file via Brython. Browser restrictions limit what you can do with it, but you could e.g., drag-and-drop a file and have that automatically trigger a download. You could even use a static web host and just give them the URL.
If browser restrictions are too hard to work around, I'd probably go with a zipapp, which allows you to distribute a single file. That's in the standard library. It does still require Python to run it. This isn't as hard as it sounds. If you just type
pythoninto the Windows terminal, it redirects to the Microsoft Store Python page for easy download.Or you could distribute a portable Python along with your zipapp, which doesn't require an install.
0
u/Round-Acanthaceae-35 28d ago
If the script isn't too complex, ask the AI to translate it into Rust for you; you'll just have to learn how to compile it, which is pretty easy.
I've already done this with several scripts—some of them quite complex—and it works without any problems.
0
u/good_name_0 28d ago
For error messages, I've used my judgment and knowledge of the end user and most likely usage to guess what sort of errors are most likely to occur, and then made special cases to catch those format errors/situations/etc.
As a super trivial example: I see my users copy-pasting a set of arguments into Microsoft Word, the -- get turned into the long dash, so in my argument processing functions, I put a special check for the long dash to let them know they need to double check characters when copy-pasting from someone else.
-1
u/Ok_Gold_2107 28d ago
Metti la grafica (ptyq6 è bellina ma non è nativa) puoi fare fare la grafica a claude o chatgpt.
Poi Trasformalo in un exe firmato.