Why is qubes-os using python scripts?

hey,
were looking at the /bin/ folder and saw most tools are python based. im just wondering why most things are based on python?
there should be a reason behind it? maybe some things arent possible with bash?
i mean dont get me wrong, but things ive could do with bash, i would write in bash.
i also were a python fan but since my work colleague and me did a challenge i see that bash would be much faster.
my python script were in fact 2 - 3 seconds slower than his bash script and it was a very basic script (checking how much load our compute nodes got).
and what about security?
sure you got python on almost every system but sometimes only 2.x and not 3.x.
there are reasons why they created version 3.x.

1 Like

The API is written in Python

https://dev.qubes-os.org/projects/core-admin/en/latest/qubes.html

1 Like

oh gotcha. thanks, didnt noticed theres an api. :slight_smile:
but what about the performance? wouldnt be there a performance lack because of the api?

Compared to what?

I doubt you could get a massive performance improvement by using C, but you would need to handle the security implications of using C.

Rust or Go could be an option, but maybe the API could predate both, or at least could have been started when both were a lot less mature than they are today.

1 Like

compared to bash.
i see. :slight_smile:

Bash would still need some way to control the system, shell scripts are just a way to execute a sequence of commands, the commands themselves need to be implemented in some sort of programming language.

1 Like

From the Qubes OS documentation:

4 Likes

BASH is not a proper language. It has so many pitfalls, it’s so crazy, bad in so many ways, so untrustworthy that it’s even strange to consider it as alternative. There are millions of bugs that are caused ONLY by BASH itself, that kind of bugs that are not possible in Java nor C# by design.

In fact, I am not sure if anybody writes proper scripts in BASH, majority of ones that go with GNU/Linux distros are full of bugs, unless they are 10 lines short.

Python is not great (no strong typing and other issues) but it’s popular, solid and interpreted (easy to modify code) language after all.

About Python 2 vs Python 3.
Python 2 is dead. Can you name popular GNU/Linux distos that still have Python 2 instead of Python 3 in the current version? Also Python 3 is better. It is going in a right direction of proper languages with type hinting and all.

2 Likes

gotcha, thanks. :slight_smile:
oh didnt realized that, thought centos still does have python 2. yeah i know, centos is dead but too many companies are still on centos because of some reasons.
were unsure if fedora 32 also already got python 3 - didnt looked that up before - sorry.
just thought i would create here a nice discussion about python but seems like, this were a dumb idea because there are too many reasons why python. :slight_smile:

not sure if im allowed to ask here anything offtopic but… afaik the claim of qubes os were always, if they got more money, development would get faster.
is there now an eta of when we get qubes os 4.2? and what about the new start menu? and what about the sys-gui?
dont missunderstand this question: never want to blame anyone or anything, just asking.
i know, capitalism is not the best… and i know, devs have to watch out how they could effort theyr living rooms and bills,…
but with the proton fundraiser they got almost 70k, so, you could use it for minimum 1 person for a year or 2 for 6 months,…
im just too excited of the future of qubes os.

1 Like

CentOS probably has Python 2 because of legacy third-party scripts that never were updated and never will be. It’s not a fair choice of 2/3, it’s because those scripts were written when Python 3 was not released, probably.
Also, Python 2 is already out of support if I’m not mistaken. So yes, Python 2 is obsolete and no one should start anything new using it instead of Python 3.

Sorry, if my previous answer was too direct or sharp. I have experience with BASH, Python and many other languages and I consider BASH to be the worst one by design (and by far), that’s why I was that straight :slight_smile:

Are there any rewrites planned? Rust sounds cool.

If time weren’t limited and there weren’t other priorities to consider, I think @Demi would relish the opportunity to rewrite practically everything in Rust. :grin:

4 Likes

I’m now imagining Marek’s face as the torrent of peer-review requests came in…

B

1 Like

sorry for being away a while.
yep its eol.

oh it wasnt too direct or too sharp, just thought this thread wasnt a good idea, but it seems like, its going forward! :slight_smile:
but btw.:
did you got some sources about bugs in bash?
would be interested in, how buggy bash can be :slight_smile:

Not in bash, but in almost all programs written in bash.
Yep, here it is: BashPitfalls - Greg's Wiki

For ones who still decide to use BASH, here is a great FLOSS piece of software: https://www.shellcheck.net/

2 Likes

this is pure gold, many thanks <3

1 Like