mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +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](
|
||
---|---|---|
.. | ||
5477.rst | ||
appimage_py311.rst | ||
env_completion.rst | ||
env_detype_all.rst | ||
fix_dircolors.rst | ||
fix_interactive_suspended_subproc.rst | ||
fix_io.rst | ||
fix_nix.rst | ||
fix_noaccess.rst | ||
fix_print_exception.rst | ||
fix_process_traceback.rst | ||
fix_redir.rst | ||
funcalias.rst | ||
history_save_unload.rst | ||
jobs_catch_no_process.rst | ||
jobs_repr.rst | ||
jupytext.rst | ||
last_cp.rst | ||
main_d.rst | ||
mini_refactor.rst | ||
no_env.rst | ||
popen_name.rst | ||
prompt_env_name_yel.rst | ||
prompt_superuser.rst | ||
refresh_specs.rst | ||
shell_type.rst | ||
sig_exit_fix.rst | ||
sigint_save_hist.rst | ||
subproc_output_format.rst | ||
TEMPLATE.rst | ||
thr_unthr.rst | ||
trace3.rst | ||
trace_subproc.rst | ||
tutorial_callias_capturing.rst | ||
typerr.rst | ||
unpin_ptk.rst | ||
waitpid_returncode.rst | ||
xonfig_env.rst | ||
xonshrc.rst | ||
zulip.rst |