Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Fix redirection flag for micromamba (IPython console) #22360

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions spyder/plugins/ipythonconsole/utils/kernelspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,27 +117,35 @@ def argv(self):
self.set_conf('default', True, section='main_interpreter')
self.set_conf('custom', False, section='main_interpreter')

kernel_cmd = []
mrclary marked this conversation as resolved.
Show resolved Hide resolved

if is_conda_env(pyexec=pyexec):
# If executable is a conda environment and different from Spyder's
# runtime environment, use conda's "run" subcommand in order to
# activate the environment and run spyder-kernels.
mrclary marked this conversation as resolved.
Show resolved Hide resolved
conda_exe = find_conda()

kernel_cmd.extend([
conda_exe,
'run',
'--prefix',
get_conda_env_path(pyexec)
])

if conda_exe.endswith('micromamba'):
kernel_cmd.extend(['--attach', '""'])
else:
kernel_cmd.append('--live-stream')

# Command used to start kernels
mrclary marked this conversation as resolved.
Show resolved Hide resolved
kernel_cmd = [
kernel_cmd.extend([
pyexec,
# This is necessary to avoid a spurious message on Windows.
# Fixes spyder-ide/spyder#20800.
'-Xfrozen_modules=off',
'-m', 'spyder_kernels.console',
'-f', '{connection_file}'
]

if is_conda_env(pyexec=pyexec):
# If executable is a conda environment and different from Spyder's
# runtime environment, we need to activate the environment to run
# spyder-kernels
kernel_cmd[:0] = [
find_conda(),
'run',
'--no-capture-output',
'--prefix',
get_conda_env_path(pyexec),
]
])

logger.info('Kernel command: {}'.format(kernel_cmd))

Expand Down