mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
![]() ### Motivation
In #5099 was introduced the logic where all RC files are loaded in
interactive and non-interactive modes. This logic is not working good
for home based `~/.xonshrc` file.
First of all `~/.xonshrc` is the buffer/accumulator of settings focused
on interactive mode. Most tools with integration with xonsh (e.g.
`conda`, `zoxide`, etc) offer to just do `echo "init_tool()" >>
~/.xonshrc` (`conda` has around 20 lines of init code) to start using
the tool and users are doing this without any doubts.
But because of after 5099 `~/.xonshrc` is executed in non-interactive
mode the adding code to it leads to unexpected and unintended side
effects:
* If you run a script with shebang (e.g. `#!/usr/bin/env xonsh` or
[xonsh-awesome-cli-app](https://github.com/anki-code/xonsh-awesome-cli-app))
or just from `xonsh script.xsh` the code will be unexpected and
unintended slower.
* If you're using xonsh-based tools (e.g. you install them using pip)
and run them in environment that has no packages that initiated in
`~/.xonshrc` you will see epic errors.
* Additional context:
* Bash and Zsh do not load `~/.bashrc` and `~/.zshrc` in non-interactive
mode by the same reasons.
* We have welcome message `Create ~/.xonshrc file manually or use xonfig
to suppress the welcome message` and we don't want to make the process
of creating this file complex.
All of this leads to bad unexpected and unintended experience. This PR
is to fix this.
### Expectation
By doing this fix we assume that experienced user who wants to build
good repeatable run control files will use another ways to create config
files and this has [reflection in
docs](
|
||
---|---|---|
.. | ||
aliases | ||
bin | ||
completers | ||
histories | ||
man1 | ||
procs | ||
prompt | ||
scripts | ||
test_lib | ||
xoreutils | ||
xpack | ||
.somedotfile | ||
bashrc.sh | ||
batch.bat | ||
conftest.py | ||
run_pwd.xsh | ||
sample.xsh | ||
test_aliases.py | ||
test_ansi_colors.py | ||
test_ast.py | ||
test_base_shell.py | ||
test_builtins.py | ||
test_cli_utils.py | ||
test_color_tools.py | ||
test_commands_cache.py | ||
test_completer.py | ||
test_completion_context.py | ||
test_contexts.py | ||
test_dirstack.py | ||
test_dirstack_unc.py | ||
test_environ.py | ||
test_events.py | ||
test_execer.py | ||
test_foreign_shells.py | ||
test_history_dummy.py | ||
test_history_json.py | ||
test_history_sqlite.py | ||
test_imphooks.py | ||
test_integrations.py | ||
test_jobs.py | ||
test_jsonutils.py | ||
test_lazyasd.py | ||
test_lazyjson.py | ||
test_lexer.py | ||
test_main.py | ||
test_man.py | ||
test_news.py | ||
test_parser.py | ||
test_pipelines.py | ||
test_platform.py | ||
test_pretty.py | ||
test_ptk_completer.py | ||
test_ptk_highlight.py | ||
test_ptk_history.py | ||
test_ptk_multiline.py | ||
test_ptk_shell.py | ||
test_pyghooks.py | ||
test_readline_shell.py | ||
test_shell.py | ||
test_tools.py | ||
test_tracer.py | ||
test_virtualenv_activator.py | ||
test_wizard.py | ||
test_xonfig.py | ||
test_xonsh.xsh | ||
test_xontribs.py |