New shell packs power of Python and Bash

Xonsh offers a shell language and command prompt and compiles to Python

New shell packs power of Python and Bash
John Zander (Creative Commons BY or BY-SA)

Xonsh, now in development, provides a shell that combines the Python language with features of Bash Unix and the fish and zsh shells.

Pronounced "conch," the tool works with Linux, Windows, and Mac OS X, and it offers a shell language and command prompt. It compiles to a Python AST (Abstract Syntax Tree), features a superset of Python 3.4, and relies on the Python standard library and the PLY parsing tool.

"The first thing you'll notice about Xonsh is that it's really meant to be used as a general-purpose shell," lead developer Anthony Scopatz, associate professor in the nuclear engineering program at the University of South Carolina, said at this week's PyCon 2016 conference in Portland, Oregon. "But on the other hand, it really is Python, so you can do things like add two numbers together."

Xonsh is intended for both novice and expert usage. It features such capabilities as history, syntax highlighting, autosuggestion, and foreign-function aliases, and it adds shell-like primitives, such as a dollar sign operator to look up variable names.

The Python ecosystem and libraries are available to be meshed with command-line interfaces. This lets developers use regular expressions to glob files, curl a remote resource into json.loads(),  and stay on the command line to use pandas, NLTK, or numpy. The project's description calls Xonsh "the superglue that bonds Python to a command-line interface and other shells."

Scopatz said startup times for Xonsh are not good, but developers are working on improving them. Xonsh, whose development was motivated in part by a desire for transparency in scientific computing, offers an asynchronous history model for users to store output, which helps with handling error messages.

Copyright © 2016 IDG Communications, Inc.

How to choose a low-code development platform