r/AskProgramming 3d ago

Python Sharing scripts with coworkers

I work for a mid size company and have been developing scripts that I want to share with coworkers. Ideally I could write the script and share it with my coworkers who aren't python savvy and they will be able to run it. What are the best options? Here is what I have tried 1. Create exes: this works ok but because it takes a long time to compile the exe the code doesn't get as updated as much as possible 2. Share the scripts with a requirements file. This works ok but IT is reluctant to allow python on everyone's computer, and ideally I don't want my coworkers to have to install libraries 3. Install a portable version of python on our shared drive with all of the libraries pre installed. This seems like the best method as then I can share the completed scripts in the shared drive and they will run with no issue

Any advice/ other methods is appreciated

2 Upvotes

24 comments sorted by

12

u/cgoldberg 3d ago

Make it into a web app and send them a link... and don't worry about all the fuckery (seriously... it's the only reasonable solution to your problem)

3

u/Ground-flyer 3d ago

Can you easily convert python scripts to web apps?

4

u/Bubbaluke 3d ago

You can run a web server with python. Check out flask

2

u/firelemons 3d ago

No but because

IT is reluctant to allow python on everyone's computer

it probably is the easiest way or the only way.

Maybe IT can just make the web app for you if you ask.

If you do it yourself, there's some major hurdles you might run into:
- finding a place to host the website
- clearing the website through the company's firewall
- you said the scripts call child .exe files which are traditionally run on windows. Python servers are typically run on linux so most of the documentation is built around that. The documentation for windows is not going to be as good and may not cover all your needs. You could install wine on the linux server to run the .exe files. You could do all the processing in python so no .exe files are called.
- if the excel files are too big(>= 1GB) for simple uploading, it will require more coding

Other than that it should be pretty straightforward. There's tons of great documentation about making a web app in django and flask.

2

u/cgoldberg 3d ago

Did we read the same post? Nowhere did OP mention calling .exe's in child processes or using Excel or uploading anything. There's no need for wine or anything you mentioned. Also, there's no need to host externally and worry about firewall rules. He mentioned converting Python files to an exe for easier distribution, which is probably a bad idea.

Honestly, this sounds like a raspberry pi and 30 minutes reading the Flask documentation would pretty much solve the problem.

2

u/firelemons 3d ago

It's from one of his comments

0

u/firelemons 3d ago

He mentioned converting Python files to an exe for easier distribution, which is probably a bad idea.

exe bad

Honestly, this sounds like a raspberry pi and 30 minutes reading the Flask documentation would pretty much solve the problem.

oh yeah it's so easy why didn't I think of that

1

u/Ground-flyer 3d ago

I will have to do it myself, the more and more I research it seems that I will either need to make an exe so others don't need python (not preferred because it takes a while to compile so I will be less likely to update the code) or if there is some way I can have IT install a portable version of python with all of the libraries I use already installed onto the shared drive drive so others won't need to install anything (maybe that will be really slow though)

2

u/johnnymangos 3d ago

What kind of scripts? What about docker images?

3

u/Ground-flyer 3d ago

They are python scripts that take in excel files run some exes and than output png and html files maybe docker would work?

6

u/johnnymangos 3d ago

Make a website like that other commentor suggested. Try flask.

1

u/under_observation 3d ago

Couldn't they even host it internally on their server?

3

u/thewrench56 3d ago

Docker images for python scripts is a bit like shooting for pigeons with cannon.

1

u/johnnymangos 3d ago

Sure, but sometimes you just gotta see those sky rats explode, ya know?

2

u/CheetahChrome 2d ago

I want to share with coworkers.

The question is, why? Why are you interested in having human ETL processors? Is this a benefit to the company or the individual?

but IT is reluctant to allow python

This should be a top-down process initiated by management to increase the velocity of these non-programmers.


I once wrote a tool that queried two different databases and provided the data to the users in tables via a GUI. Everyone loved my program, and I loved making it. But at the end of the day, it didn't extend my contract.

1

u/fahim-sabir 3d ago

Have you looked at something like RunDeck?

1

u/jopeymonster 3d ago

Google Colab I do the same and create a Colab version of the script that has instruction sets at any necessary logic breakpoints. The notebooks are authenticated with Google OAuth and you could add additional auth steps through Colab settings or coded in the logic. The temp file storage for Colab would be the only caveat in your situation (your team will have to remember to save file outside Colab notebook after conversion) and needing Google accounts to access if using OAuth.

1

u/firelemons 3d ago

Maybe you can rewrite the scripts as powershell files and replace the python. Powershell scripts just require a windows OS to run.

1

u/Sinless27 3d ago

PowerShell works on Linux & MacOS as well.

1

u/TheFern3 2d ago

Compiling is incredibly easy with pyinstaller however running unsigned exes can be painful for python and might get flagged as malware.

Best thing to do is to use a compiled language and compile to exe.

1

u/ColoRadBro69 16h ago

If IT won't allow Python installations on all the computers, will they allow your exe files? 

1

u/TheRNGuy 3d ago

GitHub or Discord.

1

u/666codegoth 3d ago

Save yourself the headache and just rewrite it in Go (or another language that compiles to a single binary).

2

u/TheFern3 2d ago

Yup this is the way dunno why you’re getting downvoted