diff --git a/spyder_kernels/console/kernel.py b/spyder_kernels/console/kernel.py index 02967cf1..07c3927d 100644 --- a/spyder_kernels/console/kernel.py +++ b/spyder_kernels/console/kernel.py @@ -753,9 +753,17 @@ def update_syspath(self, new_path, prioritize): """ Update the PYTHONPATH of the kernel. - `new_path` corresponds to the new state of the PYTHONPATH. - `prioritize` determines whether to prioritize PYTHONPATH in sys.path. + Parameters + ---------- + new_path: list of str + List of PYTHONPATH paths. + prioritize: bool + Whether to place PYTHONPATH paths at the front (True) or + back (False) of sys.path. + + Notes + ----- A copy of sys.path is made at instantiation, which should be clean, so we can just prepend/append to the copy without having to explicitly remove old user paths. PYTHONPATH can just be overwritten. diff --git a/spyder_kernels/console/start.py b/spyder_kernels/console/start.py index 34634838..ce1440e2 100644 --- a/spyder_kernels/console/start.py +++ b/spyder_kernels/console/start.py @@ -16,9 +16,8 @@ import sys import site -# Remove current directory from sys.path to prevent kernel -# crashes when people name Python files or modules with -# the same name as standard library modules. +# Remove current directory from sys.path to prevent kernel crashes when people +# name Python files or modules with the same name as standard library modules. # See spyder-ide/spyder#8007 # Inject it back into sys.path after all imports in this module but # before the kernel is initialized diff --git a/spyder_kernels/console/tests/test_console_kernel.py b/spyder_kernels/console/tests/test_console_kernel.py index 3618d1b4..ba748dcd 100644 --- a/spyder_kernels/console/tests/test_console_kernel.py +++ b/spyder_kernels/console/tests/test_console_kernel.py @@ -749,8 +749,8 @@ def test_runfile(tmpdir): sys.platform == 'darwin' and sys.version_info[:2] == (3, 8), reason="Fails on Mac with Python 3.8") def test_np_threshold(kernel): - """Test that setting Numpy threshold doesn't make the Variable Explorer - slow. + """ + Test that setting Numpy threshold doesn't make the Variable Explorer slow. """ cmd = "from spyder_kernels.console import start; start.main()"