First time here? Check out the FAQ!
1

Visually distinguish/protect files in site-packages?

Is there a way to visually distinguish or protect files that are in site-packages as opposed to the project directory?

Sometimes I will be editing a module and a bug is exposed in a different module. However, that other module hasn't been added to the environment in editable mode and instead is in site-packages. Sometimes I don't notice this, fix the bug, and sometime later get confused when the fix has disappeared because I didn't fix it in the development location.

Ideally, I'd like to optionally set the background of the editor for source files in site-packages/* to a different colour than files in my project's directory.

Thinking about it further, perhaps it'd also be useful to be able to (optionally) set files in site-packages/* to read-only as well/alternatively. Or at least a warning pop-up letting you know when you save a file that the file is in site-packages.

AnthonyFloyd's avatar
11
AnthonyFloyd
asked 2024-10-22 10:55:00 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

1

There's no way to do this now, but I think it's a good idea. A work-around, obviously, would be to actually change site-packages files on disk to be read-only, but that very possibly will break package management. I don't know why Python package managers tend to leave installed files writable since that does set people up for this problem and defeats the advantage of supposedly working with a known set/version of packages.

If you right-click on the notebook tabs and select Hide Notebook Tabs you will get a popup menu instead of tabs and that does put a star icon next to files that are in the project, which maybe would also help a bit with this.

We'll try to address this better somehow, probably by warning immediately when a non-project file is edited and adding a way to disable that for the one file or all files. The issue with this is likely going to be that lots of people don't add their source files to the project, but failing to do that can defeat some of Wing's features anyway so it may not be a bad thing to warn about it.

Thanks for the suggestion!

Wingware Support's avatar
4.2k
Wingware Support
answered 2024-10-23 08:00:49 -0600
edit flag offensive 0 remove flag delete link

Comments

If you can distinguish the files that are in site-packages, it would be great to identify them in the exceptions tool. And in the drop-down in the debug console.

Chris Curvey's avatar Chris Curvey (2024-10-28 05:54:00 -0600) edit

We do already show stars for project files in both those places, so unless you add site-packages to the project (which we strongly recommend against) those files shouldn't have stars. In general the idea is that files you might edit should be added to the project and others should only be found through the Python Path.

Wingware Support's avatar Wingware Support (2024-10-29 11:12:14 -0600) edit
add a comment see more comments
1

Wing 10.0.6.2 now warns about attempts to edit files in the standard library or site-packages. There's no visual distinction, but a dialog appears if you try to edit them and you can either cancel the edit or turn on editing for that file for the duration of the session. It's also possible to entirely turn off the feature with a checkbox in the dialog.

We'll try to add visual distinction of these files in the future.

To get this change, use Check for Updates in the Help menu.

Wingware Support's avatar
4.2k
Wingware Support
answered 2024-11-05 05:28:51 -0600, updated 2024-11-05 05:32:11 -0600
edit flag offensive 0 remove flag delete link

Comments

You guys are awesome! Thanks for the quick implementation!

AnthonyFloyd's avatar AnthonyFloyd (2024-11-05 09:52:25 -0600) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer