From 2d38a3e8a04240a8308fc0c3d276a09780192db8 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Sun, 25 Aug 2024 14:52:09 -0500 Subject: [PATCH 1/3] IPython console: Pass TMPDIR env var to kernels --- spyder/plugins/ipythonconsole/utils/kernelspec.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spyder/plugins/ipythonconsole/utils/kernelspec.py b/spyder/plugins/ipythonconsole/utils/kernelspec.py index cf6c2042343..40e00d795ff 100644 --- a/spyder/plugins/ipythonconsole/utils/kernelspec.py +++ b/spyder/plugins/ipythonconsole/utils/kernelspec.py @@ -29,9 +29,10 @@ from spyder.utils.environ import clean_env, get_user_environment_variables from spyder.utils.misc import get_python_executable from spyder.utils.programs import ( + get_module_version, + get_temp_dir, is_python_interpreter, is_module_installed, - get_module_version ) # Constants @@ -195,6 +196,10 @@ def env(self): 'SPY_TESTING': running_under_pytest() or get_safe_mode(), 'SPY_HIDE_CMD': self.get_conf('hide_cmd_windows'), 'SPY_PYTHONPATH': pypath, + # This env var avoids polluting the OS default temp directory with + # files generated by `conda run`. It's removed in the kernel after + # initialization to not affect users code. + "TMPDIR": get_temp_dir(), }) # App considerations From 6db910bead5b353e79e9fd7f4a45fdfb1747d9e2 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Sun, 25 Aug 2024 15:21:27 -0500 Subject: [PATCH 2/3] git subrepo pull --remote=https://github.com/ccordoba12/spyder-kernels.git --branch=remove-tmpdir --update --force external-deps/spyder-kernels subrepo: subdir: "external-deps/spyder-kernels" merged: "3e5998a1b4" upstream: origin: "https://github.com/ccordoba12/spyder-kernels.git" branch: "remove-tmpdir" commit: "3e5998a1b4" git-subrepo: version: "0.4.9" origin: "https://github.com/ingydotnet/git-subrepo" commit: "ea10886" --- external-deps/spyder-kernels/.gitrepo | 10 +++++----- .../spyder_kernels/customize/spydercustomize.py | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/external-deps/spyder-kernels/.gitrepo b/external-deps/spyder-kernels/.gitrepo index 1db6858fe2c..7a07a6e025d 100644 --- a/external-deps/spyder-kernels/.gitrepo +++ b/external-deps/spyder-kernels/.gitrepo @@ -4,9 +4,9 @@ ; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme ; [subrepo] - remote = https://github.com/spyder-ide/spyder-kernels.git - branch = master - commit = 4e60ca9ebedd0c7fbabce84b4c75b09b929a0e87 - parent = 8102c576f0e3949ee9e291496583b57308f46ad4 + remote = https://github.com/ccordoba12/spyder-kernels.git + branch = remove-tmpdir + commit = 3e5998a1b4ed26efcffeb8b1bdaece847b4286f1 + parent = 2d38a3e8a04240a8308fc0c3d276a09780192db8 method = merge - cmdver = 0.4.3 + cmdver = 0.4.9 diff --git a/external-deps/spyder-kernels/spyder_kernels/customize/spydercustomize.py b/external-deps/spyder-kernels/spyder_kernels/customize/spydercustomize.py index 99c2089890f..2ac975ae502 100644 --- a/external-deps/spyder-kernels/spyder_kernels/customize/spydercustomize.py +++ b/external-deps/spyder-kernels/spyder_kernels/customize/spydercustomize.py @@ -11,7 +11,6 @@ # Spyder consoles sitecustomize # -import logging import os import pdb import sys @@ -239,7 +238,7 @@ def _patched_preparation_data(name): # ============================================================================= -# os adjustments +# OS adjustments # ============================================================================= # This is necessary to have better support for Rich and Colorama. def _patched_get_terminal_size(fd=None): @@ -253,6 +252,17 @@ def _patched_get_terminal_size(fd=None): # ============================================================================= pdb.Pdb = SpyderPdb + +# ============================================================================= +# Remove TMPDIR env var in case it was set by Spyder +# ============================================================================= +# See spyder-ide/spyder#22382 for the details. +try: + os.environ.pop("TMPDIR") +except KeyError: + pass + + # ============================================================================= # PYTHONPATH and sys.path Adjustments # ============================================================================= From 06e9ccbca9b67fa7a7c8e8be1374d999d1b086ae Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Sun, 25 Aug 2024 16:12:30 -0500 Subject: [PATCH 3/3] git subrepo pull (merge) --remote=https://github.com/spyder-ide/spyder-kernels.git --branch=master --update --force external-deps/spyder-kernels subrepo: subdir: "external-deps/spyder-kernels" merged: "66d58eb0be" upstream: origin: "https://github.com/spyder-ide/spyder-kernels.git" branch: "master" commit: "66d58eb0be" git-subrepo: version: "0.4.9" origin: "https://github.com/ingydotnet/git-subrepo" commit: "ea10886" [ci skip] --- external-deps/spyder-kernels/.gitrepo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/external-deps/spyder-kernels/.gitrepo b/external-deps/spyder-kernels/.gitrepo index 7a07a6e025d..bce9479a464 100644 --- a/external-deps/spyder-kernels/.gitrepo +++ b/external-deps/spyder-kernels/.gitrepo @@ -4,9 +4,9 @@ ; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme ; [subrepo] - remote = https://github.com/ccordoba12/spyder-kernels.git - branch = remove-tmpdir - commit = 3e5998a1b4ed26efcffeb8b1bdaece847b4286f1 - parent = 2d38a3e8a04240a8308fc0c3d276a09780192db8 + remote = https://github.com/spyder-ide/spyder-kernels.git + branch = master + commit = 66d58eb0be9da9b09a2539557f8580333ddaa301 + parent = 6db910bead5b353e79e9fd7f4a45fdfb1747d9e2 method = merge cmdver = 0.4.9