Live data from Hacker News

Xonsh: Python-powered, cross-platform, Unix-gazing shell

xon.sh

81–90 of 97 posts

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#81
post #72

Sometimes I wonder which languages people use for system tools. I mean, it is hard enough that C programs (with dynamic linking) break sometimes, but building a shell on top of Python seems like a particualar bad choice to me (similar to building a package manager with python). In my opinion, such few-dependency, high-importance tools should linked statically.

> building a shell on top of Python seems like a particualar bad choice to me

can you say why? Python's stdlib handles a lot of cross-platforminess, Python is mostly easy to write, and is available as or more easily than a C compiler on many platforms.

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#82

Love xonsh!! And gets more and more stable with every release. it's the shell I always wanted. And cross platform to boot. Alias ls -l? aliases['ls'] = "ls -l" Oops no I don't want that any more: del aliases['ls'] Add dir to path: $PATH.append('/foo/bar') Just the awesome python syntax sugar and readbility right in the May I never right a bash script again.

del aliases[‘ls’] seems like a step back from unalias ls.

no the point is that if you know Python, you know how to do it without looking it up

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#83

XonSH has been my main shell for a solid two years now. The concept is awesome, but unfortunately it has many flaws. * Nesting bash and python scripts makes performance terrible compared to using python's subprocess module directly. I have a xonsh script at [0], with an equivalent written in straight bash. The python scripts ends in less than a second, the xonsh script takes ages. - As a sub-problem of the above: You…

I use zsh daily but type `xonsh` any time I do something in the shell that would normally require a google. “Uh ok so I have this JSON file. When I pipe this to `jq` I forget: to pivot an array of objects to an object keyed by array[x].id is it like `to_entries` then chain it to `map`? Uhh let’s look at the docs...” However in Python I can write that function at the speed of thought. It may be a couple more lines of…

> I use zsh daily but type `xonsh` any time I do something in the shell that would normally require a google.

Personally, I stopped using `jq` in favor of python oneliners, they a bit more verbose but also cross-compatible, works out of the box (not everyone has jq, but most of people have python (pre)installed on their machines) and it is easy to implement a oneliner, i.e.:

   curl -X GET "https://httpbin.org/json" -H "Accept: application/json" | python -c 'import sys, json; print(json.load(sys.stdin)["slideshow"]["author"])'
Do xonsh helps you write a tar command without googling [0] or browsing a man?

[0]: https://xkcd.com/1168/

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#84
post #74

Earlier quoted context omitted.

ehh.. I keep wanting to call it "nosh" or spell it "xnosh" but I'm sure if it catches on people will remember. Plus it's easy to use with a search engine, unlike "Go" or "Rust." I will say I prefer names that can be searched for on their own (e.g. with Go people typically search for "Go lang"). And as much as I love Void Linux, it's better named than all the xbps-* package manager commands.

http://jdebp.eu./Softwares/nosh/ http://jdebp.eu./Softwares/nosh/guide/nosh.html (-:

oh yes! I forgot about nosh, the process manager/supervisor.

:)

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#85
post #72

Sometimes I wonder which languages people use for system tools. I mean, it is hard enough that C programs (with dynamic linking) break sometimes, but building a shell on top of Python seems like a particualar bad choice to me (similar to building a package manager with python). In my opinion, such few-dependency, high-importance tools should linked statically.

> building a shell on top of Python seems like a particualar bad choice to me can you say why? Python's stdlib handles a lot of cross-platforminess, Python is mostly easy to write, and is available as or more easily than a C compiler on many platforms.

It's about stability. It is much easier to break a dynamically linked or interpreted script than a statically linked binary. The worst case of fixing a system with a software failure is booting a live-cd and replace the files which cause trouble, but a broken shell and sometimes also a broken package manager are precisely those cases when you have to boot a live-cd.

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#86
post #74

Earlier quoted context omitted.

http://jdebp.eu./Softwares/nosh/ http://jdebp.eu./Softwares/nosh/guide/nosh.html (-:

oh yes! I forgot about nosh, the process manager/supervisor. :)

nosh is the non-shell script processor.

pen2l will be reassured to learn that the process supervisor is straightforwardly named. (-:

* http://jdebp.eu./Softwares/nosh/guide/service-manager.html

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#87
post #67

what exactly does "Unix-gazing" mean?

Since the start of the project there has been a desire to point out that most things that work in Bash also work in Xonsh.

The motto started out as "BASHwards-compatible", but that was unsatisfactory because on one hand it sounds like nonsense, and on the other hand, it's not actually compatible with Bash. So that devolved over time into what we have now.

https://github.com/xonsh/xonsh/blame/ebd4e597a3cf063b124e5a5... https://github.com/xonsh/xonsh/blame/82cac3fff08b5cc26e421f1... https://github.com/xonsh/xonsh/blame/bd964ce552282334c881181...

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#88
post #72

Sometimes I wonder which languages people use for system tools. I mean, it is hard enough that C programs (with dynamic linking) break sometimes, but building a shell on top of Python seems like a particualar bad choice to me (similar to building a package manager with python). In my opinion, such few-dependency, high-importance tools should linked statically.

Gentoo's portage package manager is written in Python. https://github.com/gentoo/portage/

And that is probably one of the reasons why projects like Paludis were started years ago.

The funny thing about Portage is though that Python doesn't cause any performance issues as Portage/Emerge is slow by design. So while Paludis is written in C++, it isn't much faster, as it still has to interpret all those thousands of bash-style ebuilds/exheres.

This might sound as if I wouldn't like Gentoo/Exherbo et al. but in fact, my desktop PC is running Gentoo or Exherbo for the last 10 years at least. But it was exactly that experience which made me conclude that system tools like package managers, shells, etc. should be written in statically linked languages.

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#89
post #72

Sometimes I wonder which languages people use for system tools. I mean, it is hard enough that C programs (with dynamic linking) break sometimes, but building a shell on top of Python seems like a particualar bad choice to me (similar to building a package manager with python). In my opinion, such few-dependency, high-importance tools should linked statically.

I think that anyone who is trying to imagine "the next shell" owes it to themselves to try PowerShell. It's .NET based and very, very different from the sh lineage, but I absolutely love its ability to use objects instead of strings as the underlying transmission medium between "processes". E.g. ls gives you file descriptors, ps gives you process descriptors, etc.

I was just about to ask if it is available for Linux, but then I saw that the official page advertises its cross-platform properties [1] :D

I know about the different concept of Powershell for quite a while now, but since it is MS tech I didn't expect it to be available for Linux. Maybe I will try someday how it feels, but I am sceptical as the thing I like most about POSIX shells is that everything is just text and I wonder how Powershell will integrate with other *nix tools.

[1]: https://github.com/powershell/powershell

Re: Xonsh: Python-powered, cross-platform, Unix-gazing shell

#90
post #72

Sometimes I wonder which languages people use for system tools. I mean, it is hard enough that C programs (with dynamic linking) break sometimes, but building a shell on top of Python seems like a particualar bad choice to me (similar to building a package manager with python). In my opinion, such few-dependency, high-importance tools should linked statically.

I think that anyone who is trying to imagine "the next shell" owes it to themselves to try PowerShell. It's .NET based and very, very different from the sh lineage, but I absolutely love its ability to use objects instead of strings as the underlying transmission medium between "processes". E.g. ls gives you file descriptors, ps gives you process descriptors, etc.

I've heard of it but never heard a compelling reason to try it. Until your statement: I'm now very interested.
Post reply on HN