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: Add feature to append/prepend PPM to IPython Console sys.path #18308

Closed
wants to merge 17 commits into from

Conversation

mrclary
Copy link
Contributor

@mrclary mrclary commented Jun 16, 2022

Add a checkbox to the PYTHONPATH Manager that allows the user to specify whether to append or prepend these paths to the IPython Console sys.path.

Prerequisites

Fixes: #17066

@mrclary mrclary self-assigned this Jun 16, 2022
@pep8speaks
Copy link

pep8speaks commented Jun 16, 2022

Hello @mrclary! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-08-01 18:13:18 UTC

@mrclary mrclary marked this pull request as draft June 16, 2022 01:05
@mrclary
Copy link
Contributor Author

mrclary commented Jun 16, 2022

@ccordoba12, you mentioned using the update_syspath kernel handler. I wouldn't mind a quick overview via zoom when you have a moment. I see the basic functionality, as it is already used by the PPM on path updates. However, I think that we could completely eliminate set_spyder_pythonpath in spyder_kernels/customize/spydercustomize.py (and SPY_PYTHONPATH) by executing update_syspath upon client creation, but I'd want to know exactly the best signals to send and use for accomplishing this.

@CAM-Gerlach
Copy link
Member

However, I think that we could completely eliminate set_spyder_pythonpath in spyder_kernels/customize/spydercustomize.py (and SPY_PYTHONPATH) by executing update_syspath upon client creation,

Just FYI, I think that's what @ccordoba12 was saying as well over on the other issue:

By the way, that would make useless the code you changed here in spydercustomize.py, so you could remove it.

@mrclary
Copy link
Contributor Author

mrclary commented Jul 20, 2022

@ccordoba12 @dalthviz, I think that @goanpeca began to use the modern configuration system for the PPM paths about two years ago, but there are still references to individual path and not_active_path files in the configuration directory. So I think some cleanup may be necessary here. However, I'm confused about the roles of spyder.ini vs. transient.ini. Could you explain their intended differentiated purpose and what configurations belong in which file?

@dalthviz
Copy link
Member

From my side I'm not sure to be honest 😅 However, I think the main difference between spyder.ini and transient.ini is that the config options at transient are usually loaded at startup or created at startup if not found and meant to keep the session state next time Spyder starts (so I think usually the options there are persisted just before Spyder closes). Probably @ccordoba12 knows better.

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Jul 27, 2022

As I understand it, transient.ini is for ephemeral state that is not particularly critical and can be discarded without much loss, while the main spyder.ini is for persistent config options affirmatively set by the user, e.g. in the preferences dialog.

mrclary and others added 15 commits August 1, 2022 10:59
Alphabetize DEFAULTS and NAME_MAP.
PEP8
Use the configuration manager and the projects paths to build pythonpath dictionary.
Projects plugin to connect update_python_path on project change instead of pythonpath_changed.
Use configuration manager.
Do not use save_python_path.
Use path dictionary values and remove not_active_path attribute.
Do not disable path in path dictionary if it is duplicate of project path.
Update call signatures.
Aggregate common path lists.
Remove nt constraint on test_button_state
…figuration and remove the files.

Revert this commit for a future release.
Add prepend state to sig_path_changed.
Add prepend checkbox to PPM widget.
Add prepend argument to update_path
Add spyder_pythonpath_prepend to config.main.
Add prepend_path file to configuration path.
get_spyder_pythonpath_dict now returns path_dict and prepend.
load_python_path loads prepend_path and sets attribute.
save_python_path saves prepend_path file and sets spyder_ppythonpath_prepend config property.
Add new_prepend argument to update_python_path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggestion: insert paths from PYTHONPATH manager before system's PYTHONPATH
4 participants