24 ms·
Xonsh: Python-powered, cross-platform, Unix-gazing shell
- whoomp12341 3y agowhats the advantage to using this over interpretted python?
- two_handfuls 3y agoYou can mix shell commands and python.
- ultra_nick 3y agoXonsh by itself is pretty cool and I hope it continues to grow. However, I feel like Xonsh needs a killer app to really demonstrate the advantages of the semantics Xonsh provides. Maybe something like Rawdog (https://github.com/AbanteAI/rawdog https://github.com/AbanteAI/rawdog) + Xonsh?
- deleted 3y ago[deleted]
- phrotoma 3y agowtf does "unix gazing" mean?
- unixhero 3y agoGAZING, it's like gassing but said with an easter european slang, try to read the word and say it slowly "gazing". I am "gazing".
- TristanDaCunha 3y agoThis reply doesn't help me at all
- TickleSteve 3y agoRead it as "with an eye towards Unix", i.e. targetted at Unix users.
- BeetleB 3y agoActually, I'd say it's targetting Unix users who have to use Windows :-) I initially installed xonsh on my work laptop so I could have a bash-like shell in Windows.
- overbytecode 3y agoThe age-old question, do I strive to learn new tools that are better designed (Xonsh, Nushell, Fish)? Or old tools that are omnipresent (Bash/Posix)? I like Xonsh, it’s pretty nice to work with, but it makes going back to Bash, when I have to, even more painful.
- int_19h 3y agoI don't think Fish counts as "new" at this point, given that it's been around for almost 20 years now. "Boutique", perhaps?
- aphexairlines 3y agoTake a look at https://github.com/xonsh/xonsh/issues https://github.com/xonsh/xonsh/issues before deciding to abandon the devil you know. I prefer sticking with bash where necessary (where a script is the only thing that will reasonably work), and elsewhere using a programming language with testing, type checking, modularity, and compilation into something with zero or minimal runtime dependencies.
- eviks 3y agoBetter to live in paradise most of your life even if you have to go back to bash hell once in a while rather than endure that pain all the time
- Aerbil313 3y agoSeconded. I am very young, never bothered to learn bash, went straight for fish. ChatGPT is there to help if I ever encounter unintelligible “$@“&2>?!¿… Gonna try nushell soon as that seems even more productive.
- arcanemachiner 3y agoI also never bothered to learn Bash... `#!/bin/sh` all the way!
- 3y ago
- RcouF1uZ4gsC 3y agoPython has issues with dependency management. I don’t know that having your shell be based on Python is such a great idea as you could easily get yourself to weird situations.
- roblabla 3y agoThat's a weird take given bash doesn't have _any_ dependency management. At least with XonSH you get something? Also, I'm not sure what issues you're hinting at - my experience with python dep management is that, although the tooling is terrible, the core import system works fine.
- PurpleRamen 3y ago> That's a weird take given bash doesn't have _any_ dependency management. I guess that is the point here. With bash there won't be installation or maintenance-problems because of some strange dependencies or unexpected changes. Though, xonsh seems to only have 3 dependencies, of which one is for unit tests, one for syntax highlighting and something for the prompt. So I guess the danger is kinda low to run into problems.
- Grimblewald 3y agoNo errors printed means no errors exist. Unrelated, why won't my script work?
- PurpleRamen 3y agoWhat?
- BeetleB 3y agoTo move from the abstract to the concrete: I've been using it for almost 6 years and this has not been a problem. OK. I lied. Since I installed xonsh and its dependencies in my user directory and not system wide, every time I upgrade my Python to a new major version I have to reinstall xonsh. Usually just one command will do it. And it's not even in a virtualenv.
- schaum 3y agoI wonder if this could be any good as a bash replacement in GitHub actions
- h0p3 3y agoI hate to say it, but I've completely stopped using Xonsh (which I adore) since ChatGPT-4 (whom I also adore) came out. Xonsh lowered the friction and cognitive load to get some jobs done in an elegant or at least sufficiently rapid way for me, and I am grateful. I can still see LLMs, many of which are benefactors of significant RLHF of the two parent languages, making great use of such a tool - especially paired with a nix-style approach to handling dependencies and environments.
- Geezus_42 3y agoI haven't tried ChatGPT-4, but all of the local models I have tried have been garbage at writing Nix. I only recently started playing with them, so I'm sure there are improvements I can make, figuring out langchain to import documentation seems promising. I'm hoping some Nix Nerd with enough compute will train a model specialized for Nix, but I know that is unlikely, however.
- dmd 3y ago"I need to build a skyscraper. I haven't tried using steel, but using wet spaghetti has been garbage."
- h0p3 3y agoThe vast majority of humans on the planet haven't been able to afford to work with ChatGPT-4 (and I don't consider M$'s offerings of it to have nearly the same range of use). Perhaps there are good reasons our interlocutor hasn't tried ChatGPT-4. I also admire that someone has been testing with local models; we benefit from their experience as well.
- dmd 3y agoTrue, but we're not talking about "the vast majority of humans on the planet", we're talking about the sort of person who plays around with Nix - who can probably afford gpt4's $0.03 / 1K tokens. But I absolutely agree with your 2nd point!
- a-french-anon 3y agoObligatory mention of scsh (https://scsh.net/about/what.html https://scsh.net/about/what.html) and somewhat Tcl (https://www.tcl.tk/man/tcl8.5/tutorial/Tcl26.html https://www.tcl.tk/man/tcl8.5/tutorial/Tcl26.html, it'd benefit from some DSL work to abstract <@ and >@).
- AeroNotix 3y agoInteresting. I've been mulling around in my head a shell which embeds a Lisp. Well aware the idea isn't particularly ground breaking but I do love the idea of better languages embedded right within the shell, but not quite a REPL for that language.
- thesuperbigfrog 3y ago>> I've been mulling around in my head a shell which embeds a Lisp. There are several projects with the same idea: https://www.cliki.net/Lisp%20as%20a%20shell https://www.cliki.net/Lisp%20as%20a%20shell
- AeroNotix 3y agoOh, I know they exist already.
- globular-toast 3y agoEmacs has eshell which is just that!
- roger_ 3y agoLove the Python syntax so I’m tempted to try this, but I wish it incorporated some of the ideas in nushell (e.g. structured data).
- geophile 3y agoCheck out marcel (https://marceltheshell.org https://marceltheshell.org). It's yet another pipe-objects-instead-of-strings shell (like nushell). Unlike nushell, you pipe Python values. Marcel has no sublanguages (like awk, sed, ...). Instead, when logic is needed, you write Python code, delimited by parens. So: (USER) prints the value of the USER environment variable. (f'Hello {USER}') evaluates the expression inside the parens and prints "Hello jao" (for me). ls | select (f: time.time() - f.mtime < days(2)) ls finds files in the current directory, pipes them to select, which keeps the files that were modified in the last two days (days is a builtin function). Lots of examples on the website.
- madspindel 3y agoCan I use marcel on Windows? If not, any plans on supporting it in the future? And even better, if I could install it with: winget install marcel
- geophile 3y agoNo, it does not run on Windows. I'd love someone to help port it to Windows ...
- weinzierl 3y agoI wish there was a comparison table with xonsh, fish and nushell. Maybe also bash and zsh as baseline.
- marktucker 3y agoIt’s a cool shell. I used it for a half a year. And then it started crashing on me every ten minutes or so. That’s when I came to appreciate how important the stability of such a tool is.
- deleted 3y ago[deleted]
- pletnes 3y agoI had the same timeline. Less instability, more that it had a few non-bash/zsh quirks so it was hard to adapt. Loved many things about it though.
- inshellwetrust 3y agoThere is known issue that is related to prompt-toolkit. You need to downgrade ptk version. Look here - https://github.com/xonsh/xonsh/issues/5241#issuecomment-1961889489 https://github.com/xonsh/xonsh/issues/5241#issuecomment-1961...
- gatane 3y agoThe rc shell [2] from plan9 seems more simpler (and saner) than bash. At least you can read the mapage of it[1]. [1] https://www.mankier.com/1/rc https://www.mankier.com/1/rc [2] https://github.com/rakitzis/rc https://github.com/rakitzis/rc
- yitchelle 3y agoThis bring back memory of my younger self playing with the BASIC Interpreter cartridge in my old Atari 800. With this setup, you can... * create a BASIC program right at the command prompt * execute instructions to read and write to mass storage. * debug your BASIC program at the command prompt * direct access to memory addresses via peek and poke commands
- inshellwetrust 3y ago[dead]
- sigmonsays 3y agowhy not just run interactive python when you need it? A shell should be interoperable between users. If everyone on your team uses xonsh, then great, by all means. Otherwise, you're in your own little esoteric world. a shell has to be stable, a python environment is not. There is just too many ways a python package can break. If python had a good package system perhaps it'd bring something to the table.. but python is by far the winner of the programming language with the worst packaging ecosystem i've seen and used.
- globular-toast 3y agoYou can use your own tools in addition to those necessary for team stuff. In fact, I'd recommend it. There's no point using the same tools and rigour that you would with a team. Use a different version control system. Use a different shell. Have fun with your computer!
- BeetleB 3y ago> why not just run interactive python when you need it? Because writing shell scripts in Python/xonsh is much more pleasant than in Bash.
- sigmonsays 3y agoYou can run the bash shell interactively and write python scripts why limit yourself to just one. I'm just talking about the interactive shell here..
- BeetleB 3y ago> why limit yourself to just one? That's precisely the rationale behind xonsh! You're not limited to Python. You're not limited to Bash. For the most part, you get the best of both worlds. And you can still run Bash scripts in xonsh.
- ledauphin 3y agoan interactive shell really _doesn't_ need to be interoperable between users in the first place, but even a scripting shell doesn't need this either. This is what the shebang in your scripts is for. If you need to write a script that is going to get shared, you have (at least) two perfectly good options: - use bash (or some lowest common denominator) - use a fancier (better?) shell, like fish/xonsh/nushell/oil and just require that everyone have that shell installed (they don't have to use it as a daily driver). xonsh is not really any different from other shells - it can be installed as an isolated environment with its own runtime (in this case Python) A third and usually better option is to use a dedicated scripting language - this is of course an opinion, but many people have recognized that anything longer than ~50 lines and that will need to be iterated upon in the future is a bad fit for a shell-like language.
- nrabulinski 3y agoObligatory mention of rash[0] which I absolutely adore but because it never got the love it desires, the REPL experience is quite lacking. The scripting however is genuinely pretty delightful [0] https://rash-lang.org/ https://rash-lang.org/
- ok123456 3y agoI tried it a while ago and encountered problems with ncurses-based applications not rendering right. I ended up going back to zsh and then later fish.
- BeetleB 3y agoI believe they solved that problem and made it the default years ago. And there was a fix for it as far back as 2018, when I started using xonsh.
- efitz 3y agoWhat I really want is all the shell commands to have an object (e.g. json) output mode. Then all my "glue" between tools becomes less bespoke and more standardized, e.g. jq. Instead of analyzing output to build weird grep and awk statements, I would just need to remember a couple of jq patterns, take a quick look at the output, and use one of my patterns to extract the data to stream to the next command.
- wredue 3y agoSounds nice. But I think we all know how that would go (insert xkcd on competing standards)
- jijijijij 3y agoNushell? https://github.com/nushell/nushell https://github.com/nushell/nushell
- epr 3y agoI have a recurring nightmare where web developers create a one world government where they enforce a law requiring all data be converted to JSON before transmission. Existing network protocols are replaced with JSON-compatible versions, and specialized JSON parsing ASICs become a necessity in network devices. The nightmare ends with the collapse of civilization.
- efitz 3y ago
- brumar 3y agoI use xonsh as a shell for few years but I think I will go back to another shell as I am too frustrated with incombatibilities. That's being said, my xonsh scripts are there to stay, I still think that's an excellent way to build scripts.
- qwertox 3y ago> xonsh is Bash-wards compatible in the ways that matter, such as for running commands, reading in the Bash environment, and utilizing Bash tab completion What does in the ways that matter mean? It would matter to me that it is 100% Bash compatible, else I won't use another shell in addition to `zsh`.
- honkycat 3y agoI'm a DevOps engineer and I agree with the mission of Xonsh. The shell is broken. Make sucks, it is a c build tool we have Frankenstein'd into a task runner. Bash is missing a huge amount of features of modern programming languages, and has a bunch of foot-guns baked in by default ( not setting -e, etc. ) I would love to see a modern language that: - has a similar mental model a d syntax to other programming languages - built in argument parsing, declaration, and help string generation - designed for "scripting" - calling out to other binaries and gluing tools together
- hnlmorg 3y agoThere are a few: - Elvish: https://elv.sh https://elv.sh - Murex: https://murex.rocks https://murex.rocks - Nushell: https://www.nushell.sh https://www.nushell.sh Each have their own strengths and weaknesses
- BeetleB 3y agoI've been using xonsh since 2018 - on both Windows and Linux. I love it. It's not as responsive as a C based shell (e.g. Bash), but you get over it and the pros heavily outweigh the cons. If you love Bash scripting, xonsh isn't for you. For everyone else, xonsh is. The only serious headache I have with it - very poor compatibility with fzf. None of the main developers use fzf so they don't feel the pain. As an example, doing: git checkout $(git branch | fzf) doesn't work because the result of the fzf command has a newline. So you need something like @$(...). What I really want is to swap the default TAB autocompletion with an fzf selection, and there's no easy way to do it. You have to get deep into the underlying prompt_toolkit library and do a lot of surgery. It's doable, but I haven't had the time.
- antongribok 3y agoI've been using Xonsh as my main shell for about the same time. I love it as well. However, I feel like your criticism re fzf is not really fair, because I run into this with other tools quite often. So often in fact that it took me only a second to convert your command in my head to this: git checkout @($(git branch |fzf).strip())
- BeetleB 3y agoAs I said, it's doable, but painful. If I show your command to most non-Xonsh users, it would be an immediate turnoff. Do they really have to put strip at the end of each command? Or keep track of which need it and which don't? It's very unergonomic. And the history of fzf support in xonsh has been much worse. Until recently, the command you wrote was not guaranteed to work, because doing anything with fzf under $() would (seemingly) randomly not capture the results of fzf (it would often be any empty string). This was a long standing issue for years, until we finally had a user who knew the xonsh internals well enough to go and debug it. So people like me had to find alternative ways to use fzf (e.g. attach it to a custom keybinding for specific tasks). I had to modify xontrib-fzf-widgets (because that itself failed often). Take a look at these issues: https://github.com/xonsh/xonsh/issues/5190 https://github.com/xonsh/xonsh/issues/5190 https://github.com/xonsh/xonsh/issues/5189 https://github.com/xonsh/xonsh/issues/5189 https://github.com/xonsh/xonsh/issues/2404 https://github.com/xonsh/xonsh/issues/2404 (note that it took 4 years to fix this - and until then your command would not reliably work). https://github.com/xonsh/xonsh/issues/3548 https://github.com/xonsh/xonsh/issues/3548 https://github.com/xonsh/xonsh/issues/3035 https://github.com/xonsh/xonsh/issues/3035 (probably a clone of 2404). The reality is: If people want to use fzf in xonsh the way they do in bash/zsh, they will be in for a lot of pain.
- tetris11 3y agoI wonder how does the `import` command work. Does it first check if `imagemagick` is installed first and then performs a screenshot?
- hawski 3y agoDo those more object oriented shells expose more substitution and streaming goodies? For example do they have process substitution - i.e. <(foo | bar)? Or do they use memfd instead of temporary files on Linux? Do they have first class fd, processes and pipelines manipulation? For example the thing that turned me completely off PowerShell is that its pipelines are sequential not parallel. I use shell a lot, because it has streaming built-in. Many (also standard) libraries do not work around streaming, which I find is the reason why they often crumble when there is more data. For example Python's ZipFile or TarFile work around listing members should have been iterators.
- ksaj 3y agoI use xonsh. Doing simple math on the command line reminds me of my QNX days back in the 80's. And being able to do python on the commandline is awesome. Also, the rc file is way easier to read and manage. I don't know why they advertise as being like bash. It's absolutely not like bash except that their default prompts look similar on the command line. The similarities pretty much end there.
- eternityforest 3y agoUsed to use this! It's a great shell but I'd have to be using the CLI like 20 times more than I do to justify it. Using the same tool everywhere is nice because... that way I don't forget how to use BASH when I eventually need it.