spyder-ide / spyder-terminal

Run system terminals inside Spyder. Works on Linux, macOS and Windows.
MIT License
230 stars 78 forks source link

ENV_ROUTE clarification #303

Open mrclary opened 2 years ago

mrclary commented 2 years ago

@steff456 , I don't mean to bombard you with issues on this plugin, but I have some questions about the terminal setup.

What is the intention of the terminal plugin? Is is supposed to emulate an interactive login shell? The reason I ask is that the ENV_ROUTE for bash and zsh may need some adjustment.

  1. For bash, I'm not aware of any circumstance in which both ~/.bashrc and ~/.bash_profile are sourced. The expected source files are:
    • Interactive login: first /etc/profile then the first available of ~/.bash_profile, ~/.bash_login, or ~/.profile
    • Interactive non-login: first /etc/bashrc then ~/.bashrc
  2. For zsh, all files are sourced, in order, if they exist:
    • Interactive login: /etc/zshenv, $ZDOTDIR/.zshenv, /etc/zprofile, $ZDOTDIR/.zprofile, /etc/zshrc, $ZDOTDIR/.zshrc, /etc/zlogin, and $ZDOTDIR/.zlogin
    • Interactive non-login: /etc/zshenv, $ZDOTDIR/.zshenv, /etc/zshrc, $ZDOTDIR/.zshrc

Additionally, do you know where environment variables are passed to new terminals? Maybe it's somewhere in terminado? For the macOS standalone application, some environment variables need to be removed, e.g. PYTHONHOME and RESOURCEPATH.

steff456 commented 2 years ago

Hi @mrclary, don't worry about opening issues!

The main idea behind this plugin is to have a console inside Spyder that works as close to a system terminal as possible. This is the reason why we decided to try to import all the configurations that may be modified by the user, specially to have all the conda paths available inside the terminal.

Maybe this can help, https://github.com/spyder-ide/spyder-terminal/blob/45b2a3ca1ebe7aad5fe2d18536199dfb57d43264/spyder_terminal/server/logic/term_manager.py#L55