4 ms·
I don't agree with this. If I give somebody a binary, I have to compile this binary for their operating system and architecture. If they don't know how to prog
by Levitating 2y ago
I don't agree with this.
If I give somebody a binary, I have to compile this binary for their operating system and architecture. If they don't know how to program they'll be confused as to why they cannot share this program with others.
If I share somebody a python script, they can still execute it as a program as long as a shebang is set. They can use this script on any operating system and can open it with at text editor to view it's inner workings.
This makes scripting languages like Python much more accessible for single-file scripts.
- greener_grass 2y ago> they can still execute it as a program as long as a shebang is set Not if you use any libraries.
- NoboruWataya 2y ago> If I share somebody a python script, they can still execute it as a program as long as a shebang is set. As long as they have the right version of Python and all of your program's dependencies installed, which they most likely won't. > They can use this script on any operating system and can open it with at text editor to view it's inner workings. Someone who doesn't know how to program most likely isn't going to be using multiple operating systems and isn't going to want to open the script in a text editor to view its inner workings. I agree with the parent comment that distributing binaries is way more seamless when your users are not very technical.
- wrenky 2y agoAND holy shit I have to install another venv to run special-snowflake-3 script I will literally lose it. I literally have a folder of all the venvs I need to run one-off shit people pass me. I get the lack of wanting to compile things but thats not a problem with modern build systems like Rust/Go have- Beyond trivial.
- awesomebytes 2y agoI have recently started to use uv, and you can just do "uvx tool" and it executes the tool (https://docs.astral.sh/uv/guides/tools/ https://docs.astral.sh/uv/guides/tools/). Sure, the tool needs to do something to be able to be executed like that, but it seems pretty easy. And there's also a way to embed the dependencies with a comment at the top of a python script: https://docs.astral.sh/uv/guides/scripts/#running-a-script-with-dependencies https://docs.astral.sh/uv/guides/scripts/#running-a-script-w... The venv created for this is ephemereal (it can not be if you want), so you don't need to keep in mind cleaning up stuff and so. Also uv is really fast in creating the venv and installing whatever is needed. Coming from using plain pip and venvs (and having pain setting up different python version interpreters for projects), and poetry just after that, I am pretty happy with the improvements.
- blackfawn 2y agoYeah, really... Python tries to hide some of the insanity behind venvs, conda, etc. but it often ends up some dependency nightmare that's barely holding together. Everyone that tells me "oh Python is so great, it just works" is either only using it for the absolute most basic tasks or kidding themselves. I'd often get a blank stare when I respond to that with "then why am I helping you fix this virtual environment with gigs of cruft for a 'simple task' that has suddenly and inexplicably stopped working for you?" The equivalent things in Go, Rust, etc are a breath of fresh air for sure
- pizza234 2y ago> If I share somebody a python script, they can still execute it as a program as long as a shebang is set. I'm not familiar with Python, but I presume its similar to Ruby, where besides trivial scripts, this is false - as soon as there are libraries required, you need to find a way to handle them, which in some cases may include handling multiple envs (I write and distributes such scripts). Compiling for multiple environments in a controlled environment is by far much more convenient than debugging scripts failing on end users' systems.
- pid-1 2y agoIMO it's far worse than Ruby. Since Python is meant to be a glue language, scripts can have every type of esoteric dependency, including binaries, os libs, java programs, etc...
- Levitating 2y agoRuby isn't any different
- stonemetal12 2y ago>If I share somebody a python script, they can still execute it as a program as long as a shebang is set. Since when has windows come with python installed and worked with a shebang? Mac OS doesn't come with python installed and clicking it won't run it. So anyone " confused as to why they cannot share this program with others." isn't going to be able to use your python script.
- ayhanfuat 2y agoThis would work in a language with better and more modern packaging (like Julia) but giving people Python files and expecting them to run them in correct versions might just be a bigger ask then asking them to compile C code.
- faangguyindia 2y agoUnlikely, you need to install virtualenv. As they may not have same python version, may have different python libraries (version) It's not simple to run a python script specially one which uses libraries (let's be honest how often your core is not using those popular libraries)