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](
|
||
---|---|---|
.. | ||
_static | ||
_templates | ||
api | ||
extensions | ||
advanced_events.rst | ||
aliases.rst | ||
appimage.rst | ||
bash_to_xsh.rst | ||
changelog.rst | ||
comparison.rst | ||
conf.py | ||
contact.rst | ||
containers.rst | ||
contents.rst | ||
contributing.rst | ||
customization.rst | ||
development.rst | ||
devguide.rst | ||
editors.rst | ||
envvars.rst.jinja2 | ||
events.rst | ||
faq.rst | ||
guides.rst | ||
installation.rst | ||
intro.rst | ||
keyboard_shortcuts.rst | ||
links.rst | ||
Makefile | ||
packages.rst | ||
platform-issues.rst | ||
python-versions-support-policy.rst | ||
python_virtual_environments.rst | ||
quotes.rst | ||
serve_docs.py | ||
setup.rst | ||
subproc_types.rst | ||
talks_and_articles.rst | ||
todo.rst | ||
tryitnow.rst | ||
tutorial.rst | ||
tutorial_completers.rst | ||
tutorial_events.rst | ||
tutorial_hist.rst | ||
tutorial_history_backend.rst | ||
tutorial_macros.rst | ||
tutorial_ptk.rst | ||
tutorial_subproc_strings.rst | ||
tutorial_xonsh_projects.rst | ||
tutorial_xontrib.rst | ||
xonshconfig.json | ||
xonshrc.py | ||
xonshrc.rst | ||
xonshrc.xsh |