-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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: Add options to include user's local PYTHONPATH and environment variables #14918
Conversation
This PR and #14853 are mutually exclusive. |
856a8bb
to
220c7e6
Compare
90f35c1
to
ab8daac
Compare
b49c829
to
209be48
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mrclary for your work on this! I left an initial review for you.
e5c494e
to
45872af
Compare
I can't for the life of me figure out how to fix this problem... Failed test_run_cython_code=================================== FAILURES ===================================
_____________________________ test_run_cython_code _____________________________
main_window = <spyder.app.mainwindow.MainWindow object at 0x7f5ddcb26f50>
qtbot = <pytestqt.qtbot.QtBot object at 0x7f5ddc049c50>
@pytest.mark.slow
@flaky(max_runs=3)
@pytest.mark.skipif(
(os.name == 'nt' or sys.platform == 'darwin' or
parse_version(ipy_release.version) == parse_version('7.11.0')),
reason="Hard to test on Windows and macOS and fails for IPython 7.11.0")
def test_run_cython_code(main_window, qtbot):
"""Test all the different ways we have to run Cython code"""
# ---- Setup ----
# Get a reference to the code editor widget
code_editor = main_window.editor.get_focus_widget()
# ---- Run pyx file ----
# Load test file
main_window.editor.load(osp.join(LOCATION, 'pyx_script.pyx'))
# Run file
qtbot.keyClick(code_editor, Qt.Key_F5)
# Get a reference to the namespace browser widget
nsb = main_window.variableexplorer.current_widget()
# Wait until an object appears
qtbot.waitUntil(lambda: nsb.editor.source_model.rowCount() == 1,
> timeout=COMPILE_AND_EVAL_TIMEOUT)
E AssertionError: waitUntil timed out in 30000 miliseconds
E assert not True
E + where True = <function QtBot.waitUntil.<locals>.timed_out at 0x7f5dd3f1e4d0>()
/home/runner/work/spyder/spyder/spyder/app/tests/test_mainwindow.py:1104: AssertionError
----------------------------- Captured Qt messages -----------------------------
QtWarningMsg: Scenegraph already initialized, setBackend() request ignored
--------------------------- Captured stdout teardown ---------------------------
In [1]: runfile('/home/runner/work/spyder/spyder/spyder/app/tests/pyx_script.pyx', wdir='/home/runner/work/spyder/spyder/spyder/app/tests')
gcc: fatal error: cannot execute ‘cc1’: execvp: No such file or directory
compilation terminated.
In [2]:
---------------------------- Captured stderr setup -----------------------------
<class 'spyder.app.tests.spyder_boilerplate.spyder.plugin.SpyderBoilerplate'>: A plugin with section "spyder_boilerplate" already exists!
Traceback (most recent call last):
File "/home/runner/work/spyder/spyder/spyder/app/mainwindow.py", line 917, in setup
self.register_plugin(plugin_instance, external=True)
File "/home/runner/work/spyder/spyder/spyder/app/mainwindow.py", line 237, in register_plugin
plugin._register()
File "/home/runner/work/spyder/spyder/spyder/api/plugins.py", line 884, in _register
self._conf.register_plugin(self)
File "/home/runner/work/spyder/spyder/spyder/config/manager.py", line 119, in register_plugin
'exists!'.format(conf_section))
RuntimeError: A plugin with section "spyder_boilerplate" already exists!
I just can't get these tests to fail locally, so I can't figure out what is going on. |
@mrclary I think this is related with the fake plugin I added and the reuse of the mainwindow instance in the tests. I will check 👍 (probably we need to add some sort of condition/validation so the addition of the fake plugin entrypoint is only done once) |
@dalthviz, thanks for looking into the fake plugin, perhaps that is the issue. However, I am curious why that doesn't manifest in the mac and windows tests also, or on my local linux tests. |
…nch scenarios for Consoles
…source paths at front of sys.path so that console will launch if wrong standard module is present.
…ables for subprocesses by platform * Creates consistency across language providers and Consoles.
…cannot execute 'cc1': execvp: No such file or directory"
From conversation in #16200, remember to consider how |
Closing in favor of #16429 |
Description of Changes
Added preference to the Python Interpreter section allowing all platforms and launch methods to select whether a user's system
PYTHONPATH
and environment variables are used for Consoles.Spyder's PYTHONPATH Manager list behavior is unchanged.
Fixes #14843
New Behavior
sys.path
PYTHONPATH
environment variable are appended to the Console'ssys.path
. On macOS and Linux, the user's localPYTHONPATH
is determined by/etc/profile
,~/.bash_profile
,~/.bash_login
, and~/.profile
. On Windows, the user's localPYTHONPATH
is extracted from the registry queryreg query HKEY_CURRENT_USER\Environment
.os.environ
.PATH
andHOME
on macOSPATH
,HOME
,DISPLAY
andXAUTHORITY
on LinuxPYTHONPATH
, are passed to the Console'sos.environ
. On macOS and Linux, these are determined by/etc/profile
,~/.bash_profile
,~/.bash_login
, and~/.profile
. On Windows these are determined by the registry queryreg query HKEY_CURRENT_USER\Environment
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct:
@mrclary