-
-
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: Unify access to current active interpreter #17788
PR: Unify access to current active interpreter #17788
Conversation
4c486e3
to
a6b8d42
Compare
I don't think this is correct. I mean, @dalthviz, what do you think? |
Edit: Actually, the comment related with this is #17789 (comment) . Basically it initializes empty since no custom interpreter is initially selected (it should be empty as @ccordoba12 says I think) |
a6b8d42
to
180105f
Compare
Hello @maurerle! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2022-05-18 17:42:48 UTC |
As mentioned before:
The Variable flow is like this:
if executable != self.get_conf('executable'):
self.set_conf('executable', executable)
I think this is a clean solution and unifies the different mitigation approaches |
- remove access to custom_interpreter - remove unnecessary checks - use get_python_executable - remove unused public api - access get_conf - update interpreter on_conf_change
8ac690a
to
589ec8c
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.
Hey @maurerle, thanks a lot for this! I thought about it a lot during the weekend and regard it now as a great improvement.
I left a small review for you. After you address it, I can give you a hand to fix our tests.
Thank you Carlos! I am very happy to contribute it :) I ran all the tests locally (very impressive suite! Very great!) but did not find a related issue. The CI tells me that the |
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.
@maurerle, thanks for addressing my previous suggestions. Second review now, much simpler than the first one.
- resolve discussions
So, we have two kinds of tests: automatic tests based on Pytest and Pytest-Qt, and tests at the end of many files to quickly see if the widget in the file is displayed correctly. The one that was failing with your changes was a file test and it happened because it doesn't assume that our config options are populated. And the fix was simple: trying to get the |
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 @maurerle for your contribution!! This is a great improvement!
until now,
custom_interpreter
is always aligned withexecutable
.This is fixed here - so that
executable
always holds the current active used python interpreter, while the custom_interpreter is used to store the last value of the preferences dialog.I saw, that the custom_interpreter/executable does not behave very good when looking into #1884 which is fixed by this PR.
Another possibility would be to remove thecustom_interpreter
variable at all.If custom is set, the
custom_interpreter
is found in executable, elseit is not of interestit is used to store the value of the dialog.Old values are stored in the
custom_interpreters_list
, so they are unaffected.The only actual usage of the
custom_interpreter
value exists inget_main_interpreter
, which is never called too (but is a public API).If would actually suggest to change
get_main_interpreter
code toto unify the access to the current interpreter, which makes it easier for other plugins to get the executable to.
What do you think about that? The current situation seems to be improvable
wrong and it is not possible to see the custom_interpreter value in this variable.Description of Changes
Issue(s) Resolved
Fixes #1884
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: Florian Maurer