xonsh is a Python-powered, cross-platform, Unix-gazing shell language and command prompt
0.9.25.dev3
@jwlynch_gitlab I think a non-login xonsh shell (e.g. from a subprocess line like
xonsh my_awsome_script.xsh
) will not read the .xonshrc, whereasxonsh -l my_awsome_script.xsh
will do so. However I haven't tested this explicitly.
Seems to be the same issue I see and my guess from the code is .xonshrc will not be read in either case - as a file is provided so XONS_INTERACTIVE is set to False and so rc not read
I'm trying to speed up my .xonshrc
and I've discovered that adding aliases is substantially slower than I expected - nearly 4000 times slower than just adding items to a dict:
from timeit import timeit
def thousand_aliases():
for i in range(1000):
str = f'echo{i}'
aliases[str] = 'echo'
def thousand_dict_entries():
d = {}
for i in range(1000):
str = f'echo{i}'
d[str] = 'echo'
timeit(thousand_aliases, number=1)
# 3.0883793910034
timeit(thousand_dict_entries, number=4000)
# 3.19940147199668
On my machine this is actually slow enough that my real list of aliases takes several seconds to apply. Is this known/expected behaviour?
fatal:unable to access '~/.gitconfig': interrupted system call
. The only thing ive been able to find that sort of matches this is this issue xonsh/xonsh#2358 but this was closed a couple days. should I add to that issue?
:octocat: Hi folks! I want to remember you some points that help xonsh community:
if you have xonsh related projects on Github please add the xonsh
or xontrib
topics to the repository "About" settings. This allows to search your solutions using Github Topics: xonsh or xontrib.
if you have useful scripts written on xonsh in Github Gists the better way is to create repository with README for them that allows create issues and fork the code.
if you have the code on BitBucket or similar the better way to create empty repository on Github with README that contains the link on original repository and tag it like in point 1.
Finally take a look at promotion guide that written for xontribs but actual for any xonsh repository.
:octocat: Xanks!
Hi everyone,
I'm having some weird internal parser issues when trying to load my xontrib xlsd, I'm not really sure where to look at to help me debug this.
cafehaine@galifeu ~ master $ $XONSH_SHOW_TRACEBACK=True
cafehaine@galifeu ~ master $ xontrib load xlsd
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 10835, in xontribs_load
update_context(name, ctx=ctx)
File "/usr/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 10780, in update_context
modctx = xontrib_context(name)
File "/usr/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 10746, in xontrib_context
m = importlib.import_module(spec.name)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 786, in exec_module
File "/usr/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 24307, in get_code
code = execer.compile(src, glbs=ctx, locs=ctx)
File "/usr/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 23992, in compile
tree = self.parse(input, ctx, mode=mode, filename=filename, transform=transform)
File "/usr/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 23952, in parse
tree, input = self._parse_ctx_free(input, mode=mode, filename=filename)
File "/usr/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 24076, in _parse_ctx_free
tree = self.parser.parse(
File "/usr/lib/python3.9/site-packages/xonsh/parsers/base.py", line 497, in parse
tree = self.parser.parse(input=s, lexer=self.lexer, debug=debug_level)
File "/usr/lib/python3.9/site-packages/xonsh/ply/ply/yacc.py", line 335, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/usr/lib/python3.9/site-packages/xonsh/ply/ply/yacc.py", line 1122, in parseopt_notrack
p.callable(pslice)
File "/usr/lib/python3.9/site-packages/xonsh/parsers/base.py", line 2643, in p_subscriptlist
elts=[p1.value] + [x.value for x in p2],
AttributeError: 'List' object has no attribute 'value'
Failed to load xontrib xlsd.
It looks like an error in xonsh's parsing, as I'm no longer using the List
type in the latest version of xlsd
I'm getting used to xonsh, just started playing w/ it last nite and had some questions about the .xonshrc file. Can I separate my .xonshrc file into multiple files and source them all in one location. it's getting a little hectic in here.
I was also wondering if there was syntax highlighting for sublime text?
stty
. See on StackOverflow "Why does stty cols 40
have different effects in the two shells bash and xonsh"). If anyone knows how to fix this, please answer. It has a bounty on it. 😄 Thanks!
Hello all, I've been tinkering around with my rc
file and I wanted to add a toggle_python
command.
Essentially, it would hide the prompt bar (which I think I can override the $PROMPT
). It would also look at all of the python variables I declare (like via def
or just variables) and delete them. I think I could do that via looking at locals()
and then removing everything that's extra.
The thing is, I don't know if the event triggers for a python command or I'm wondering if this is even a decent idea haha. Thanks all
╰─ (eu-de-2) ± xonsh
Traceback (most recent call last):
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/site-packages/xonsh/main.py", line 421, in main
sys.exit(main_xonsh(args))
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/site-packages/xonsh/main.py", line 459, in main_xonsh
shell.shell.cmdloop()
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/site-packages/xonsh/ptk_shell/shell.py", line 338, in cmdloop
line = self.singleline(auto_suggest=auto_suggest)
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/site-packages/xonsh/ptk_shell/shell.py", line 307, in singleline
line = self.prompter.prompt(**prompt_args)
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1013, in prompt
return self.app.run(set_exception_handler=set_exception_handler)
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 848, in run
return loop.run_until_complete(
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 815, in run_async
return await _run_async2()
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 791, in _run_async2
result = await _run_async()
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 669, in _run_async
self._pre_run(pre_run)
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 626, in _pre_run
c()
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1202, in pre_run2
pre_run()
File "/Users/i530566/.pyenv/versions/3.8.5/lib/python3.8/site-packages/xonsh/ptk_shell/formatter.py", line 69, in start_update
self.updator.start()
AttributeError: 'PTKPromptFormatter' object has no attribute 'updator'
Xonsh encountered an issue during launch
Failback to /bin/zsh