Skip to content

lambda-abstraction/xonsh

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11,406 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

xonsh

Xonsh shell icon.

Xonsh (sounds like "consh") is a modern, full-featured and cross-platform Python-based shell. The language is a superset of Python 3 with seamless integration of shell functionality and commands. It works on all major systems including Linux, OSX, and Windows. Xonsh is meant for the daily use of experts and novices.


Xonsh is the Shell Xonsh is Python
cd $HOME

id $(whoami) > ~/id.txt

cat /etc/passwd | grep root

$PROMPT = '@ '
2 + 2

var = "hello".upper()

@.imp.json.loads('{"a":1}')

[i for i in range(0,10)]
Xonsh is the Shell in Python Xonsh is Python in the Shell
len($(curl -L https://xon.sh))

$PATH.append('/tmp')

p'/etc/passwd'.read_text().find('usr')

$(@json podman ps --format json)['ID']
name = 'snail'
echo @(name) > /tmp/@(name)

with p'/tmp/dir'.mkdir().cd():
    touch @(input('File: '))

aliases['e'] = 'echo @(2+2)'
aliases['a'] = lambda args: print(args)
Xonsh is Everywhere Xonsh is an Ecosystem
$PATH
# ['/bin', '/sbin']           # Linux
# ['/homebrew/bin']           # macOS
# ['/nix/store/0-python/bin'] # Nix
# ['/mnt/c/Windows/System32'] # WSL
# [r'c:\Windows\System32']    # Windows

$PATH = ['/my/own/path']
xontrib load term_integration \
             prompt_starship  \
             powerline        \
             dracula          \
             chatgpt          \
             django           \
             jupyter          \
             1password        \
             github_copilot   \
             history_encrypt
Xonsh is a Meta-Shell Xonsh is User-extensible
xontrib load sh \
             fish_completer

def nudf(cmd):
    return @.imp.pandas.DataFrame(
      @.imp.json.loads(
        $(nu -c @(cmd+'| to json'))))
nudf!(ls -la)

aliases['ai'] = 'ollama run llama3'
ai! how to remove images in podman
@events.on_ptk_create
def custom_keybindings(bindings, **kw):
    @bindings.add(Keys.ControlI)
    def say_whoami(event):
        echo $(whoami)

@events.on_postcommand
def _prompt_err_cmd(cmd, rtn, out, ts):
    if rtn != 0:
        $XONSH_PROMPT_NEXT_CMD = cmd.rstrip()

If you like xonsh, ⭐ the repo and spread the word about xonsh.

Join to xonsh.zulipchat.com repology.org hub.docker.com AppImage GitHub Actions codecov.io

First steps

  • Installation - isolated environment, package, container or portable AppImage.
  • Tutorial - step by step introduction in xonsh.
  • Cheat sheet - some beginners may find this a helpful place to start.

Extensions

Xonsh has an extension/plugin system. We call these additions xontribs.

Projects that use xonsh or compatible

  • conda and mamba: Modern package managers.
  • Starship: Cross-shell prompt.
  • zoxide: A smarter cd command.
  • gitsome: Supercharged Git/shell autocompleter with GitHub integration.
  • xxh: Using xonsh wherever you go through the SSH.
  • kash: The knowledge agent shell.
  • Snakemake: A workflow management system to create reproducible and scalable data analyses.
  • any-nix-shell: xonsh support for the nix run and nix-shell environments of the Nix package manager.
  • lix: A modern, delicious implementation of the Nix package manager.
  • x-cmd: x-cmd is a vast and interesting collection of tools guided by the Unix philosophy.
  • rever: Cross-platform software release tool.
  • Regro autotick bot: Regro Conda-Forge autoticker.

Jupyter-based interactive notebooks via xontrib-jupyter:

  • Jupyter and JupyterLab: Interactive notebook platform.
  • Euporie: Terminal based interactive computing environment.
  • Jupytext: Clear and meaningful diffs when doing Jupyter notebooks version control.

Compiling, packaging, or accelerating xonsh:

Welcome to the xonsh shell community

The xonsh shell is developed by a community of volunteers. There are a few ways to help out:

We welcome new contributors!

Credits

About

🐚 Python-powered shell. Full-featured, cross-platform and AI-friendly.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 99.7%
  • Other 0.3%