xonsh/xontrib-template

Example of an autoloaded xontrib with this template with working poetry tests

eugenesvk opened this issue · 3 comments

upd: This seems to be another issue with autoloading, the tests simply fail with xontrib_x folder structure this template creates by default, they can only load from xontrib/x.py due to some hardcoded names in the load_xontrib function and maybe other reasons

I've decided to check why the CI from this template was failing despite the installation of xontribs working fine and discovered that running poetry run pytest fails with tests/test_xontrib.py::test_it_loads - Exception: Failed to load xontrib: The following xontribs are enabled but not installed:['cd']

Strangely enough, when I load xonsh directly from the pytest path with ~/Library/Caches/pypoetry/virtualenvs/xontrib-cd--vcGhuku-py3.11/bin/xonsh --no-rc (from a non-xonsh shell to avoid any environment contamination) I can load it just fine

from xonsh.xontribs import xontribs_load
xontribs_load(['cd'])
# (None, None, <ExitCode.OK: 0>)

So I don't understand what's going on

Do you maybe have an example of a xontrib that uses this template and also has working tests? I've looked through a bunch of awesome xontrib list, but they either don't use the template, or don't use poetry.
Or maybe you know what's wrong

This seems to be another issue with autoloading, the tests simply fail with xontrib_x folder structure this template creates, they can only load from xontrib/x.py due to some hardcoded names in the load_xontrib function
Jupyter has a xontrib/jupyter.py, so unfortunately that doesn't help

I think load_xontrib also accepts a module path. So you can pass the fully qualified python module path