xonsh
Python-powered shell. Full-featured, cross-platform and AI-friendly.
What it is and what it does
Xonsh is a full-featured shell that treats Python 3 as its base language and adds shell syntax on top, rather than the reverse. You write commands using Python expressions, list comprehensions, and imports directly in the shell, and invoke external programs with shell-style syntax. It runs on Linux, macOS, Windows, BSD, and other platforms, and integrates with Jupyter notebooks.
The package is useful when you want to automate tasks, manage system operations, or explore data interactively without switching between a Python REPL and a traditional shell. It supports an extension system called xontribs for adding features like custom prompts, keybindings, and integrations with tools like Starship, ChatGPT, and GitHub Copilot. With no runtime dependencies, it installs cleanly and works out of the box.
Use it for:
- Write shell scripts that leverage Python's data structures, comprehensions, and standard library without subprocess calls.
- Interactively explore files and system state using Python syntax (e.g., p'/etc/passwd'.read_text()) alongside traditional commands.
- Automate DevOps tasks by mixing shell commands with Python logic in a single script without context switching.
- Build reproducible workflows in tools like Snakemake that need both shell commands and Python control flow.
- Extend the shell with custom keybindings and event handlers using Python decorators and event hooks.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Xonsh is a Python-based shell that merges Python 3 syntax with shell commands, letting you write scripts and interactive sessions using both languages seamlessly in one environment.
Yes. Xonsh is actively maintained, has no external runtime dependencies, and offers a genuinely novel way to combine Python and shell scripting. It's worth trying if you spend significant time in both environments and want to unify them. The permissive license and broad platform support make it low-risk to evaluate. Start with the tutorial at xon.sh/tutorial.html to see if the syntax and workflow fit your needs.
Install
xonsh on PyPI
pip
pip install xonshuv
uv add xonshpoetry
poetry add xonshInstalling xonsh
Before you install
Low friction install with wheels available for Python 3.11 through 3.14. Active maintenance with a recent release (14 days old) and steady community engagement (9600 GitHub stars). No runtime dependencies to manage.
License in practice
BSD 2-Clause License is permissive, allowing use in both open-source and proprietary projects with minimal restrictions beyond attribution.
Quickstart
pip install xonsh
# Start the shell
xonsh
# In xonsh, mix Python and shell:
echo @('hello'.upper())
var = $(ls -la)
print(len(var))
Requires Python 3.11 or later.
Verify before relying
- Whether xonsh works identically across all advertised platforms (Linux, macOS, Windows, BSD, Jupyter, Android, Raspberry Pi) or if some have limitations.
- Performance characteristics when running complex Python scripts or long-running shell sessions compared to traditional shells.
- Compatibility with existing shell scripts written for bash or zsh without modification.
Package facts
| License | BSD 2-Clause License (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 14 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 390,560/month — #7,021 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: xonsh-0.24.1-py311-none-any.whl; xonsh-0.24.1-py312-none-any.whl; xonsh-0.24.1-py313-none-any.whl; xonsh-0.24.1-py314-none-any.whl
Tags
More Terminals packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
richRich renders styled text, tables, progress…
permissive · top 100 on PyPI
coloramaColorama makes ANSI escape sequences for…
permissive · top 100 on PyPI
wcwidthMeasures the displayed width of Unicode strings…
permissive · top 1,000 on PyPI
ptyprocessRun a subprocess in a pseudo terminal (pty) and…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
bash_kernelEnables running and interacting with bash…
permissive · top 15,000 on PyPI
subprocess.runProvides a simplified interface to run shell…
permissive · top 15,000 on PyPI
poetry-plugin-shellA Poetry plugin that launches a subshell with…
permissive · top 15,000 on PyPI
bashlexbashlex parses bash shell syntax into an…
copyleft · top 5,000 on PyPI
dep-syncSynchronizes Python environments by managing…
unclear · top 15,000 on PyPI
expandvarsExpands Unix-style variable references in…
permissive · top 5,000 on PyPI
bashProvides a Python wrapper for running bash…
copyleft · top 15,000 on PyPI
plumbumPlumbum lets you write shell-script-like…
permissive · top 5,000 on PyPI
jupyter-server-terminalsAdds terminal support to Jupyter Server,…
permissive · top 1,000 on PyPI
whichcraftProvides a cross-platform, cross-Python…
permissive · top 15,000 on PyPI