I use this following directory structure to install and use xonsh with ease. It enables adding new xontribs easily and keep the user packages in single place in a maintainable way.
My xonsh config folder - ~/.config/xonsh
looks like this
~/.config/xonsh 🤖noor🖥firefist 🕰️ 12:36:51P
🐍xonsh $ tree -L 1 -a
.
|-- .gitignore # like in anyother Python project. This is important since I track this folder using [yadm](https://yadm.io/)
|-- .idea # I use pycharm to edit the xonsh config files. this contains certain interpreter settings.
|-- .local # scratch files
|-- .venv # the xonsh installation directory
|-- .vscode # *.xonsh file type settings
|-- abbrevs.py # loaded by main main rc.xsh
|-- aliases.py # loaded by main main rc.xsh
|-- poetry.lock
|-- poetry.toml # configures the virtualenv location
|-- pyproject.toml # tracks the dependencies for my xonsh setup
|-- rc.xsh # the entry point loaded by xonsh on startup
|-- readme.md # I track my todos here
|-- scripts # some system scripts
|-- snippets # some useful snippets for rememberance
|-- user_xsh # the package that is importable from xonsh shell. this installed when running `poetry install`
|-- user_xsh.egg-info
|-- variables.py # environment variables
`-- xsh-src # xonsh source code - `git clone https://github.com/jnoortheen/xonsh xsh-src`
10 directories, 9 files
Here I have posted certain files that might be interesting.
After doing a poetry install
I am good to use the xonsh binary by creating a symlink
ln -s ~/.config/xonsh/.venv/bin/xonsh ~/.local/bin
$PATH already contains ~/.local/bin
and I can start calling xonsh from bash like this
# excerpt from ~/.bashrc
# ...
# ############ ssh agent config ###############
eval $(keychain --eval id_ed25519)
# this should be the last point
if [[ $(ps --no-header --pid=$PPID --format=comm) != "xonsh" ]]
then
exec xonsh
fi