r/programming • • Aug 26 '22

Please do not use Python for tooling

https://borud.no/dev/2022/embedded-tooling/
0 Upvotes

18 comments sorted by

64

u/flavius-as Aug 26 '22

The author has some problems with specific tools written in python for embedded development, then goes into full rant mode about the language as a whole.

He does not propose any changes around those tools to improve this part of the ecosystem.

There, I saved you minutes of your life.

8

u/teerre Aug 26 '22

Specifically, the problem is that python doesn't compile to a single binary.

Which, sure, I'm - mostly - a fan of static libraries, but considering how Linux works like, at all, this seems like a weird complain

That said, it does surprises me that there are tool for obscures embedded systems written in python. Python's runtime is huge, seems like a weird choice of language

2

u/acdha Aug 26 '22

The other thing I was hoping for was some awareness that you're changing one set of problems for another: for example, it sounds like they sometimes do major upgrades without testing and then their Python dependencies break. From the minimal details in that post, I don't know if that's the equivalent of apt/yum updates but if it is, a single binary might help with that or it might mean that all of your stuff breaks with a linker error for major version changes, and it definitely means that you have to be on top of shipping security updates for anything you statically link.

It's certainly quite valid technically to favor a compiled binary, especially for embedded work, but I don't get the impression that he was fully aware of the root problem being the “we make large unmanaged changes without testing” culture.

0

u/Feeling-Departure-4 Aug 26 '22

He wishes Python were Go? Pretty convinced maybe Python is the wrong language for him, and that's ok, there are a lot of PL out there.

-7

u/bert8128 Aug 26 '22

You can easily compile a Python program into a single binary, eg https://www.py2exe.org/

12

u/teerre Aug 26 '22

That doesn't compile anything, it simply bundles an interpreter + libraries into a zip file and sets up some relative environment variables

It's also not how python is supposed to be distributed, if you really want this feature, you should use a different language

6

u/goranlepuz Aug 26 '22

(tangential) you said "compile", so it is somewhat unfair that you complain about their use of the word.

The pertinent point though, is that bundling a python program into something simple and not depending on the state of the system is not that hard.

It's also not how python is supposed to be distributed

Do you mean a python program? If yes, we'll, why the heck not? That's just taking choice out of the user's hands, IMNSHO.

5

u/bert8128 Aug 26 '22 edited Aug 26 '22

Sorry, missue of the ambigous term "compile". I didn't mean it turns it into a compiled binary. It creates a bucket of stuff that looks like an exe to Windows and will just run, whether you have python installed or not, and has all the libraries at their correct versions.

I don't understand your second comment - it doesn't, and doesn't claim to, distrubute Python - it makes your program easily distributable. So it achieves the aim of being just one thing - simple to install and run.

1

u/bloody-albatross Aug 26 '22

That's Windows only, though. Do people even use Python on Windows a lot?

7

u/bert8128 Aug 26 '22 edited Aug 26 '22

I can't speak for "people", but in my company, yes - python is excellent on Windows. And one of the reasons we use it is becuase it works so well on both Windows and Linux - not many instances of "if windows ... " or "if linux ..."

And I am lead to believe that https://pyinstaller.org/en/stable/ does similar stuff but is cross platform (I have no experience of it though so can't offer guidance).

2

u/MordecaiOShea Aug 26 '22

Everywhere in the finance world

4

u/sally1620 Aug 26 '22

Just use Rust or Go.

0

u/[deleted] Aug 26 '22

[deleted]

5

u/flavius-as Aug 26 '22

Who the fuck talks like this?

Bjørn Borud

2

u/wineblood Aug 26 '22

I have invested a lot of time in Python, I use it at work and it pays for all my stuff. I also don't care how others feel about it.

1

u/tlm2021 Aug 27 '22

"Let me point directly at this hole and clearly call it out...then step in it."

1

u/SpaceCadet87 Aug 27 '22

This almost reads as though the author is unaware that there are other scripting languages other than python.

It could be better phrased as "don't use a scripting language to do the job of a compiled language"

I would also add "don't use a compiled language to do the job of a scripting language"

I've seen plenty of both.

1

u/[deleted] Aug 27 '22

Calling Perl fashionable while there are people who spent their entire career writing in it...

Also, Perl never gained as much popularity as Python has today, nor such a broad application, so I fail to see the comparison.