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

Add menu to change console environments #10

Open
isabela-pf opened this issue Aug 12, 2020 · 61 comments
Open

Add menu to change console environments #10

isabela-pf opened this issue Aug 12, 2020 · 61 comments
Assignees
Labels
enhancement New feature or request ready-for-implementation Changes decided during UX study

Comments

@isabela-pf
Copy link
Collaborator

To make it easier to switch what a new console defaults to and to change the environment for an existing console, we can add a menu from the lower status bar similar to the language server to its left.

Here is my proposal:
Full List

The default option will always be at the top, separated from the other options, and has the (Default) label. All other options should be listed below alphabetically with a check (Material Icons check) to the left of whichever option is being used by the currently selected console.

Full List + Default 1

To change the default, hovering over that option opens the secondary menu. It follows the same pattern of alphabetic listing and check for currently selected default/

@juanis2112
Copy link
Contributor

@CAM-Gerlach what do you think about this? We are going to continue this discussion further so let us know what are your ideas for this.

@CAM-Gerlach
Copy link
Member

We are going to continue this discussion further so let us know what are your ideas for this.

I thought we were all going to have a meeting about this to discuss it?

Overall, the root of the confusion we're grappling with here is how to best present two distinct concepts: the environment of the currently selected console, and the environment that new consoles open in, which related to two different common user tasks: determining what environment their current console is using, and opening a new console in a specific environment. After considering several approaches, I think the best way to both make this difference clear while offering an efficient, discoverable and easy to use UX is to separate them in the UI, putting each in a place appropriate to the task users are trying to accomplish, which closely matches both @mrclary 's and my proposals on spyder-ide/spyder#12200 .

Breaking them down one by one:

Opening a new console in a specific environment

When (and only when) the user is opening a new console, they need to know what environment it will be opening in by default, and have a way to easily select a different one, as they may be opening several consoles in different environments or want to open one console in a specific environment, without changing the default.

Current proposals

Current UX:

  • - New console env shown in statusbar where it isn't needed most of the time and may not be obvious when opening a new console
  • - Lengthy, tedious process to open a new console in a different env: open Prefs (with a long lag), go to the right tab, select the interpreter, apply the changes, open the console, go back to Prefs, re-select the original env (or the next desired env), and apply the changes again
  • - Non-discoverable

Initial spyder-ide/spyder#13950 proposal:

  • + Much much faster switching: just select the env from the statusbar, open the console, and reselect the next env.
  • + Env type, name and interpreter are shown, vs. just path as in preferences
  • - Users still have to change it back
  • - Still in a very different place than where users actually open new consoles
  • - There's confusion over whether this changes the env of the current console or new consoles.

@isabela-pf proposal:

  • + Offers a way to change both the current console env and the new console env
  • +/- Same upsides and downsides as 13950 proposal for opening a new one.
  • - Requires another layer of menus to set the new console env, further away from the actual New console command
  • - It wasn't immediately clear to me what "default" did vs. selecting an env in the top-level menu (esp. since a "default" doesn't make sense when there's no way to override it)

Recommended approach

image

  • Add a dropdown menu to the Console menu and Console pane options/context menu, allowing the user to easily open a console in a specific environment other than the default with one click, without having to change and revert it, in the same, easily discoverable UI location as opening a console in the default env (as suggested by both @mrclary and myself)

  • Change the (default settings) parenthetical in the Create new console UI text to be the name of the current default env for new consoles, as this is the one place the user actually needs to know it

  • As @mrclary suggested, we should add another dropdown option to the Python interpreter selection in preferences listing the autodetected environments in a more user friendly form, informative and easy to read form (as they were originally listed in the status bar menu) with types, names and interpreter versions (right now they are just listed as paths).

Checking the current environment

When the user is working in a given console, they may want to check the current environment they are using. I'm not sure how necessary offering a menu to change it is, since as it would have to kill the current kernel and launch a new one, losing all of the user's variables and packages (unless we automatically save and restore the user's session), it has essentially the same effect (and the same number of clicks) as opening a new a new console in that env and closing the old one, but it could be a little more intuitive for users.

Current proposals

Current UX:

  • - Doesn't offer this at all; new console env is shown in statusbar instead of current env, which is confusing

Initial spyder-ide/spyder#13950 proposal:

  • - Same as current UX, except potentially even more potential for confusion with the popup menu

@isabela-pf proposal:

  • + Displays current console env and allows selection of it
  • - "Default" menu is potentially confusing and does not allow selection of the default interpreter for the current console

Recommended approach

Use the above proposal, just without the Default menu (which is handled separately, per the above), and with the env type, name and interpreter version shown for each env, as in spyder-ide/spyder#13950 and as @mrclary and others have proposed.

@mrclary , thoughts?

@mrclary
Copy link

mrclary commented Dec 2, 2020

@CAM-Gerlach, If I follow everything correctly, then I think I agree with your assessment. I believe this would be the summary of your proposal.

Checking the current environment

  • The current environment should be displayed in the status bar (not the default new environment).
  • I would also recommend moving away from status bar menus and have the status bar only display the environment of the current console. This would eliminate the need for an additional menu layer and stay consistent with the purpose of a "status" bar.

Opening a new console in a specific environment

  • New environments can be opened (in a new tab) using the console menu or context menu, changing the existing menu item "New console (default settings)" to "New console"-> list of environments with "default" indicated.
  • Keyboard shortcut opens console in designated default environment.

Run configuration per file

We have not discussed what to do about per-file run configurations, but currently we can set this to "Execute in current console", "Execute in dedicated console", or "Execute in an external system terminal". Under the existing and proposed paradigms, files executed in dedicated consoles can only use the designated default environment. I think we should consider updating this setting to include a selected environment to be used. I also think we should consider adding a setting at the project level, i.e. opening/switching projects opens consoles in the chosen environment. The environment would be set, in decreasing order of precedence, file -> project -> Spyder preferences.

Regarding the path display of environments in Preferences, I think that @steff456 is currently revising that to be more readable (i.e. type, name, version).

@CAM-Gerlach
Copy link
Member

Yep, thanks @mrclary . That pretty much sums it up, with a few small notes (below).

I would also recommend moving away from status bar menus and have the status bar only display the environment of the current console. This would eliminate the need for an additional menu layer and stay consistent with the purpose of a "status" bar.

Yeah, I don't really see the need for per-console environment switching in the status bar; the utility is pretty marginal, potentially confusing and it doesn't feel intuitive to have commands in the status bar affect a specific console (especially a destructive action like this). I mainly included it because it was in your original proposal, so I figured you had a use case in mind.

New environments can be opened (in a new tab) using the console menu or context menu, changing the existing menu item "New console (default settings)" to "New console"-> list of environments with "default" indicated.

Keyboard shortcut opens console in designated default environment.

Unfortunately, many users are unaware of keyboard shortcuts or even don't like to use them at all, especially newer users likely to be potentially confused or intimidated by a list of environments to choose from. Therefore, I suggest retaining the existing separate top-level menu item to open a console in the default environment, to make it easier and more obvious to access, which is reflected in my mockup screenshot above. Also, how would you suggest clearly indicating the default environment in the list?

Run configuration per file

I definitely agree, we need to add that at some point, and as mentioned default environment is an ideal example for a project-level setting—I'm just not sure of the implementation status of the project improvements necessary for that, which you probably are more so than me.

Regarding the path display of environments in Preferences, I think that @steff456 is currently revising that to be more readable (i.e. type, name, version).

I see; this might already be in work, but especially if we make this change, we should revise the UI text in the preferences to eliminate the "default" wording for the build-in environment and just call it "same as Spyder", to avoid confusion with the default interpreter for new consoles (which this option is selecting) as well as the system, Anaconda, etc. default Python environment.

@mrclary
Copy link

mrclary commented Dec 2, 2020

@CAM-Gerlach

I mainly included it because it was in your original proposal, so I figured you had a use case in mind.

Sometimes I spitball ideas...doesn't mean they are good ;-)

I suggest retaining the existing separate top-level menu item to open a console in the default environment, to make it easier and more obvious to access, which is reflected in my mockup screenshot above.

I think this is just fine.

Also, how would you suggest clearly indicating the default environment in the list?

Usually, defaults are indicated with an asterisk * or (default) text and kept at the top of the list. However, given your suggestion, there would be no need for that.

@isabela-pf
Copy link
Collaborator Author

Replying to the meeting we had a few weeks ago, I generally agree with this, but I think there is some more work to be done around how information is communicated to the user.

Recommended approach

image

  • Add a dropdown menu to the Console menu and Console pane options/context menu, allowing the user to easily open a console in a specific environment other than the default with one click, without having to change and revert it, in the same, easily discoverable UI location as opening a console in the default env (as suggested by both @mrclary and myself)
  • Change the (default settings) parenthetical in the Create new console UI text to be the name of the current default env for new consoles, as this is the one place the user actually needs to know it
  • As @mrclary suggested, we should add another dropdown option to the Python interpreter selection in preferences listing the autodetected environments in a more user friendly form, informative and easy to read form (as they were originally listed in the status bar menu) with types, names and interpreter versions (right now they are just listed as paths).

Below are some very rough ideas on what could be useful to add.

If we are going to have a potential split on how environments are applied, it would make sense to specify the different ways it influences the interface. I think this could be as simple as adding a syntax highlighting label to the status bar to show which environment the editor is currently relying on.
status bar 0-2

This could also be communicated through some kind of icon in the console tab. Something like this could make it easy to skim and quickly find which editor and environment are linked.
console link 0-1

I also agree with the idea that changing the default environment should take more intention and happen in Preferences, though I don't know if it belongs in an existing section or if there should be a new section to accommodate this.

@mrclary
Copy link

mrclary commented Mar 17, 2021

If we are going to have a potential split on how environments are applied, it would make sense to specify the different ways it influences the interface. I think this could be as simple as adding a syntax highlighting label to the status bar to show which environment the editor is currently relying on.
status bar 0-2

Since this is handled by the LSP server, would it make sense to just append the LSP status with the environment used for completions/syntax? E.g. "LSP <language>: <env>" -> "LSP Python: conda: base (Python 3.7.6)"; it also seems redundant to have "ready" indicated since if LSP is not ready, then it either has a spinning wheel or indicates error.

@CAM-Gerlach
Copy link
Member

Sorry I wasn't able to make the meting this morning; morning storms from the ongoing severe wx outbreak in MS and AL knocked out power and internet shortly beforehand. EDIT: Also, realized I never actually submitted this before I headed out on a research deployment.

I think this could be as simple as adding a syntax highlighting label to the status bar to show which environment the editor is currently relying on.

Overall, that seems like a fair solution, with some refinements.

Actually, its not syntax highlighting that uses this, but LSP services, most notably code completion, so we'd want to change the UI text accordingly (maybe "Code completion:"? But I'm not sure users would understand what it entails, though a tooltip, e.g. "Python environment used for providing code completions", might help).

Also, the status bar in the mockup is getting quite long and complex. However, assuming we go with your excellent idea to simply label each console tab with its environment rather than change the status bar indication to show the console env (which I think we all agree on, makes more sense conceptually, is clearer for users and is simpler to implement), the environment already shown in the status bar is the Editor completion/etc lookup environment (in the current working proposal you reference above, the default env for new consoles, which may or may not be the same depending on what we decide, is already shown the one place it matters, when creating a new console in the default env), so we could either:

  • Simply pre-pend the extra UI text to the existing statusbar item; or
  • [EDIT: As @mrclary suggests] Combine the LSP Python and Completion env entries in one item

I initially considered the latter due to being even shorter, but I'd lean toward the former, for the reasons discussed below

Since this is handled by the LSP server, would it make sense to just append the LSP status with the environment used for completions/syntax? E.g. "LSP : " -> "LSP Python: conda: base (Python 3.7.6)"

The main issue I see with this with this is it makes the status bar indication rather long and syntactically complex, i.e. LSP Python environment: conda - base (Python 3.7.6) [restarting], comprising two related but distinct status items and limits our flexibility if we do want to add a menu to select the environment at some point, add additional LSP options or adjust the UI text to be more specific to one or the other. So, I'd suggest just eliminating the entirely redundant environment listing, and just adding descriptive UI text to the existing one, which is also a much simpler change to implement and less of a break from the current UI, unless there are compelling reasons to do something else.

it also seems redundant to have "ready" indicated since if LSP is not ready, then it either has a spinning wheel or indicates error.

Yeah, but it provides a positive indication that LSP should be functional, as is done in the statusbars of other applications, at least on Windows (users may not just assume this if nothing is shown), and something would still be shown if it is restarting or here is an error, taking up as much if not more space. So not sure its worth it.

I also agree with the idea that changing the default environment should take more intention and happen in Preferences, though I don't know if it belongs in an existing section or if there should be a new section to accommodate this.

This is actually how it always has been, though a number of improvements have been made in recent versions; see Preferences > Python interpreter for how it looks currently. Or are you suggesting making the default LSP/completion environment and default Console environment entirely different settings (assuming we keep the former static, rather than dynamically following the active console)? I'm not sure its worth the considerable added complexity relative to the likely small number of users that would have a compelling reason to set them differently.

@mrclary
Copy link

mrclary commented Mar 18, 2021

I agree with @CAM-Gerlach regarding the general principle of consolidating the statusbar items, where possilbe. I think we both agree that the LSP server status is the right place to put the completion environment details.

However, I think that there needs to be clear communication about the console environment; a simple icon in the console tab will not be sufficient. Even if it clearly communicates that it is the "default" environment, I won't remember what that environment was, especially when working with multiple environments.

If we agree that a document should be linked to an environment, should we consider segregating the status bar into editor an console sections? Or should the Editor and Console widgets have their own statusbars, apart from the application statusbar?

@CAM-Gerlach
Copy link
Member

@mrclary Sorry if I wasn't clear. What I was proposing was:

  • Avoid overcomplicating the LSP status listing with the completion environment details for the reasons mentioned above; instead, simply add a descriptive UI text prefix to the existing default completion environment (what is already shown in the current statusbar)
  • Don't add another lengthy and potentially confusing (as you say @mrclary ) statusbar item to track the current console env; instead, simply add the env name to each console tab (with a tooltip with full env details) as suggested by @isabela-pf elsewhere, where it is more clearly connected to what it describes, allows viewing the envs of all open consoles at a glance, and is simpler to implement.
  • Show the default env for new consoles (which in practice would be the same as the editor's completion env, at least as implemented now) the one place it matters, in the "New console in default env (ENV-NAME)" menu listing, as in my original proposal

We do need to decide whether the Editor's completion env should follow the active console, or always default to the current default env set it preferences (which in the future will be configurable per-project). The former matches how the Editor runs files; they are sent to the active console, so we might already expect the user to have selected an appropriate console with the packages present to run their code, and is arguably the best heuristic we have to choose the most likely desired environment to get completions in, rather than whatever is the default selected in preferences, for users working in multiple at once. However, there were concerns related to latency switching between them, explaining this to users and matching user expectation, and its also more complex/more of change to implement. Regardless, the approach suggested above works for whatever we decide on that.

However, I think that there needs to be clear communication about the console environment; a simple icon in the console tab will not be sufficient.

I neglected to directly respond to it above, but I definitely agree the icon in the console tab is confusing—in fact, I'm not really sure what it is even intended to mean at all. If its the default env for new consoles, or the Editor's default completion env (presuming we keep the latter fixed in preferences, all) some or none of the currently open consoles could have this env, so users cannot rely on it being present nor indicate anything meaningful. Meanwhile, if it is supposed to indicate the completion env and we have that follow the active console, it is redundant with the already prominent indication of the active console tab. Either way, unlike UI text in the statusbar, I'm not sure it provides any additional value in actually telling the user what it means, and may in fact mislead more savvy users (those likely to get anything out of it) into thinking Editor completions are looked up dynamically in the indicated console instead of statically in whatever environment that console happens to correspond to (although I have heard plans to eventually do the latter).

@mrclary
Copy link

mrclary commented Mar 18, 2021

Don't add another lengthy and potentially confusing (as you say @mrclary ) statusbar item to track the current console env; instead, simply add the env name to each console tab (with a tooltip with full env details) as suggested by @isabela-pf elsewhere, where it is more clearly connected to what it describes, allows viewing the envs of all open consoles at a glance, and is simpler to implement.

My only concern here is cluttering the console tab, particularly for "Execute in dedicated console" where the document name is listed in the console tab.

We do need to decide whether the Editor's completion env should follow the active console, or always default to the current default env set it preferences (which in the future will be configurable per-project). The former matches how the Editor runs files; they are sent to the active console, so we might already expect the user to have selected an appropriate console with the packages present to run their code, and is arguably the best heuristic we have to choose the most likely desired environment to get completions in, rather than whatever is the default selected in preferences, for users working in multiple at once. However, there were concerns related to latency switching between them, explaining this to users and matching user expectation, and its also more complex/more of change to implement. Regardless, the approach suggested above works for whatever we decide on that.

I'm not sure what your intended meaning for "active" is. I don't think the Editor should necessarily follow the active (tab focused) console. I frequently use "Execute in dedicated console", so it always executes in it's own (possibly already open) console, regardless of which console tab has focus. For me, this links the document to an environment, albeit indirectly. It would be much better to link the document to an environment explicitly, whether directly configured, like the per file run configuration, or via project configuration, as we have discussed. The only issue then is how to handle the situation where the document env doesn't match the console env when one "Executes in current console":

  • just use the (tab focused) console env anyway
  • warn the user about the discrepancy
  • open a new console
  • or some combination of the above

@CAM-Gerlach
Copy link
Member

My only concern here is cluttering the console tab, particularly for "Execute in dedicated console" where the document name is listed in the console tab.

Yeah; just displaying the env name and included the type, path, etc. in a tooltip this would help, or perhaps not show it for dedicated consoles if we have another mechanism for users explicitly setting this. That raises another question—we didn't consider the case of running files in dedicated consoles; therefore, we should presumably have a way to set the env to run in per-file, otherwise users have to constantly switch their default env to run different files (these suggested changes don't make things worse in that regard, but don't really address that case). However, this could solve two problems at once, this selected environment would both explicitly set the environment to run in (if "Run file in dedicated console/external system terminal" is used), and could also be used to retrieve completions for that file (if the overhead of switching envs in LSP is not so great, IIRC @ccordoba12 said he would look into that).

I'm not sure what your intended meaning for "active" is.

Currently selected tab; I didn't really consider the other two run config options, sorry.

It would be much better to link the document to an environment explicitly, whether directly configured, like the per file run configuration, or via project configuration, as we have discussed.

Coupled with the above approach (which it seems you're thinking of already), I agree this seems the most straightforward and workable solution, and more clearly and explicitly addresses the case of needing different envs for different source files as opposed to the originally proposed approximate heuristic of the currently selected console tab, and without increasing user confusion. The only potential issue is the latency of switching PyLS between envs (or the overhead of running a PyLS per env), but that is the case with any approach that doesn't use a fixed per-project completion env.

The only issue then is how to handle the situation where the document env doesn't match the console env when one "Executes in current console"

I guess this depends on whether you're referring to the dynamic case (running the code from a file) or the static case (providing static completions for it). Assuming we adopt the behavior you mention (do the lookup in the specified environment for the file if explicitly set, otherwise fall back to the default project env) then the currently active console (and thus the setting) doesn't matter, since the operation does not depend on the active console.

For the former, if no environment is explicitly set, and only the project-default env differs from that of the currently selected console, then naturally the status quo approach (just run it in the current console anyway) makes the most sense. For cases where an env was explicitly specified for a file, we could automatically switch to and run the code in the last active console with a matching env, which would handle a lot of cases but be far from perfect (what if the user wants to temporarily run the code in a different env? what if no console of that env is open? What if multiple are, and the desired console isn't the last-selected one? etc), so I'd think it would be simplest and least confusing to just follow the current behavior, though perhaps we could add the option for a warning under the "Current console" setting? (Warn if file's selected environment doesn't match). We'd have to think more carefully about this...

@mrclary
Copy link

mrclary commented Mar 18, 2021

The only issue then is how to handle the situation where the document env doesn't match the console env when one "Executes in current console"

I guess this depends on whether you're referring to the dynamic case (running the code from a file) or the static case (providing static completions for it). Assuming we adopt the behavior you mention (do the lookup in the specified environment for the file if explicitly set, otherwise fall back to the default project env) then the currently active console (and thus the setting) doesn't matter, since the operation does not depend on the active console.

I mean that the document env will always be used for completions (and the currently active console doesn't matter) but also be used for execution, in conjunction with the execution configuration (dedicated, external, active).

For the former, if no environment is explicitly set, and only the project-default env differs from that of the currently selected console, then naturally the status quo approach (just run it in the current console anyway) makes the most sense.

exactly

For cases where an env was explicitly specified for a file, we could automatically switch to and run the code in the last active console with a matching env,

I don't think this is good because both the env and the namespace are important. I think for dedicated consoles and external consoles, this is a non-issue. The conflict should only arise when executing in active console.

what if the user wants to temporarily run the code in a different env?

If they have the document env set and executing in dedicated/external console, they would have to temporarily relax/change one of these settings; there is no way around it. If the document env is set and executing in active console, then they could just run in the active console (with whatever env they setup there).

what if no console of that env is open?

If dedicated/external console is set, then this is a non issue. Otherwise, just run in active console.

What if multiple are, and the desired console isn't the last-selected one?

If dedicated/external console is set, then this is a non issue. Otherwise, just run in active console.

We can replace "document env" with "effective document env" in all of the above.

Summary

  • If "Execute in dedicated console", behavior is the same as now, except the console will use the configured environment hierarchically: document->project->preferences default.
  • If "Execute in external console", behavior is the same as now, except the console will use the configured environment hierarchically document->project->preferences default.
  • If "Execute in active console", behavior is the same as now (environment configuration ignored).
  • Completions always use configured environment hierarchically: document->project->preferences default.

Importantly, the above does not really change Spyder's existing behavior, we're simply checking for other environments in front of the default environment in preferences. If the document and project environments are not configured, then the behavior is exactly Spyder's current behavior. So maybe no warnings are required; everything seems pretty logical and what most users would intuitively expect...

@mrclary
Copy link

mrclary commented Mar 18, 2021

But perhaps we're diverting off topic. The issue at hand is how to communicate to the user the completion environment and the console environment...

Summary

  • I think the console tab is fine for displaying console environment name with increment, e.g. "spy-dev 1" for environment "spy-dev". This is what Spyder currently does, except it uses the useless "Console" name :-). By the way, what is "/A" suppose to indicate? For dedicated consoles, currently the document name is used; this should remain since the environment would be implied by the file (with statusbar indication). Detailed information can be shown in the context menu (as suggested earlier) and in the tab browser.
    Screen Shot 2021-03-18 at 3 40 13 PMScreen Shot 2021-03-18 at 3 40 13 PM 2

  • The existing statusbar environment really only indicates the completion environment (and default environment) since it does not change with active console. So this could be co-opted by the completion environment, and for good measure, consolidated in some way with the LSP status, since that is what the LSP service is providing. LSP/completions status will always follow the active document (which won't be dynamic until document/project env configurations are implemented)

@CAM-Gerlach
Copy link
Member

I mean that the document env will always be used for completions (and the currently active console doesn't matter) but also be used for execution, in conjunction with the execution configuration (dedicated, external, active).

Right, I just wanted to make sure we were talking about the same basic thing

I don't think this is good because both the env and the namespace are important.

Yeah, as mentioned, neither do I. The questions I posed following it were intended to point out the shortcomings and complexities introduced in what at first seemed to me to be a reasonable heuristic, in support of the following conclusion that retaining the status quo behavior in this case as well (with potential future consideration for a warning or other options to handle it) was likely the best approach. That was what I meant by "so I'd think it would be simplest and least confusing to just follow the current behavior"; sorry for any confusion there.

I think for dedicated consoles and external consoles, this is a non-issue. The conflict should only arise when executing in active console.

Right; to be clear, the statements responding to your question related only to the "Current console" case, since that was the case posed.

Otherwise, just run in active console.

Exactly.

Summary

Agree with all, that was my understanding as well.

So maybe no warnings are required; everything seems pretty logical and what most users would intuitively expect...

Yeah, we can talk with our UX people and less-experienced users to make sure it wouldn't be confusing that they can select an environment but the code is still run in the current console i.e. its just used for static completion. I'd also think it might be useful to have some sort of optional warning or other behavior for cases where the user don't want their code to run in the wrong console, but this use case is probably pretty narrow.

We're planning to have a Zoom meeting to discuss this further and would really appreciate having you there for your great input, since you've been the biggest single contributor to making this change happen and provided incredibly valuable feedback, insight and analysis (we meant to invite you to the first one, but there was a mixup on my part); we'll reach out to you shortly with more details on that.

@CAM-Gerlach
Copy link
Member

I think the console tab is fine for displaying console environment name with increment, e.g. "spy-dev 1" for environment "spy-dev".

Yeah, the 1 part would be the equivalent of the current stock name (Console 1), which would be editable, while the environment name would not be (like the current A). To make the separation clearer, we could do something like 1 (env-name), though if we do that, it would make sense for the number to increment with each console created, rather than each console created in that environment.

By the way, what is "/A" suppose to indicate?

I honestly have no idea; its not part of the user-editable name and is set separately. Looking at the code, it looks like it might be some sort of "client ID", but its not clear what it signifies, and I've never seen it anything different then A, even when connecting to a local or remote external console. Possibly its obsolete, or part of something that was never implemented. @ccordoba12 any help here?

For dedicated consoles, currently the document name is used; this should remain since the environment would be implied by the file (with statusbar indication).

Yeah, I think this is the simplest approach without inflating the tab name.

Detailed information can be shown in the context menu (as suggested earlier) and in the tab browser.

I actually suggested a tooltip, but the tab menu would be a great place too as you demonstrate

The existing statusbar environment really only indicates the completion environment (and default environment) since it does not change with active console. So this could be co-opted by the completion environment,

Right, that's what I'm proposing as well, so we just need to add some UI text (Completion env:, etc. which we can discuss and bikeshed over at the meeting); @isabela-pf 's input would be particularly helpful here

consolidated in some way with the LSP status, since that is what the LSP service is providing.

At first I favored this, but IMO I think its simpler to keep them as they are for now, as described previously:

The main issue I see with this with this is it makes the status bar indication rather long and syntactically complex, i.e. LSP Python environment: conda - base (Python 3.7.6) [restarting], comprising two related but distinct status items and limits our flexibility if we do want to add a menu to select the environment at some point, add additional LSP options or adjust the UI text to be more specific to one or the other. So, I'd suggest just eliminating the entirely redundant environment listing, and just adding descriptive UI text to the existing one, which is also a much simpler change to implement and less of a break from the current UI, unless there are compelling reasons to do something else.

But we can definitely see what the others think.

@mrclary
Copy link

mrclary commented Feb 28, 2023

  • For dedicated console: __ini__.py (env_name)
  • For special consoles: Pylab 2 (env_name)
  • Different client same kernel: Console 3 (env_name) and Console 3 (env_name)

I definitely prefer this; I find the A/B/C confusing and noisy and never actually knew what it meant despite using many consoles, and "Console" is redundant since its in the IPython console pane and clearly a console. Otherwise, it would be even longer and more confusing with this new addition.

Perhaps

  • For dedicated console: __ini__.py (env_name)
  • For special consoles: Pylab (env_name)
  • Different client same kernel: (env_name) and (env_name)

@dalthviz
Copy link
Member

Perhaps

* For dedicated console: `__ini__.py (env_name)`

* For special consoles: `Pylab (env_name)`

* Different client same kernel: `(env_name)` and `(env_name)`

Or removing Console and kernel client id (A, B, etc) but keeping the number?:

  • For dedicated console: __ini__.py (env_name)
  • For special consoles: Pylab 1 (env_name)
  • Different client same kernel: 1 (env_name) and 1 (env_name)

@mrclary
Copy link

mrclary commented Feb 28, 2023

Perhaps

* For dedicated console: `__ini__.py (env_name)`

* For special consoles: `Pylab (env_name)`

* Different client same kernel: `(env_name)` and `(env_name)`

Or removing Console and kernel client id (A, B, etc) but keeping the number?:

  • For dedicated console: __ini__.py (env_name)
  • For special consoles: Pylab 1 (env_name)
  • Different client same kernel: 1 (env_name) and 1 (env_name)

What is the 1 supposed to communicate?

@dalthviz
Copy link
Member

What is the 1 supposed to communicate?

It would work as the default way to differentiate consoles using the same env, so you can have

1 (env_name) 2 (env_name) 3 (env_name)

Instead of:

(env_name) (env_name) (env_name)

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Mar 1, 2023

One issue though is that the numbers are counted sequentially for all consoles, but the position of the number after the "Pylab", etc., implies they are counted separately for each type of console. It also could potentially cause a little confusion as to whether the number implies something about Pylab, Sympy, etc. specifically, Removing the number side-steps the issue, but it could be avoided while keeping the number (which takes up little space and can certainly be useful) by changing it to

  • Regular consoles: 1 (<env name>)
  • Dedicated console: __ini__.py (<env_name>)
  • Special consoles: 1 - Pylab (<env_name>)
  • Different client same kernel: 1 (<env_name>) and 1 (<env_name>)

@mrclary
Copy link

mrclary commented Mar 1, 2023

Can we number the consoles only for duplicate console tab text, similar to what most file explorers do when creating new files or folders?

  • For dedicated console: __ini__.py (env_name)
  • For special consoles: Pylab (env_name), 1 Pylab (env_name)
  • Different client same kernel: (env_name), 1 (env_name), and 2 (env_name)

@CAM-Gerlach
Copy link
Member

In that case, if we change the numbering scheme to enumerate duplicates rather than being sequential (which would IMO be a good idea, and would further improve the tab titles), I would suggest some changes:

  • The number needs to go after the unique part of the name since it serves as the least significant bit rather than the most significant bit, and is also naturally the convention used by file managers
  • The putting it in parenthesis would follow the conventions of file managers to indicate a successive same-named file:
  • The number should start at 2, to avoid ambiguity and confusion
  • Fix the numbers for the different client/same kernel case
  • Ensure the other usages (parenthesis, etc) are consistent between name types

Thus:

  • Regular consoles (different kernels): <env_name>, <env_name> (2), <env_name> (3)
  • Dedicated console: <env_name> (__ini__.py)
  • Special consoles: <env_name> - Pylab, <env_name> - Pylab (2)
  • Different client same kernel: <env_name> and <env_name>; <env_name> (2) and <env_name> (2)

The "different client same kernel" case isn't quite as intuitively clear as before, but given that is rarely used and mostly for advanced users, that's less of a concern than not compromising clarity and conciseness for the other cases (which changing it would require).

@mrclary
Copy link

mrclary commented Mar 1, 2023

  • Regular consoles (different kernels): <env_name>, <env_name> (2), <env_name> (3)
  • Dedicated console: <env_name> (__ini__.py)
  • Special consoles: <env_name> - Pylab, <env_name> - Pylab (2)
  • Different client same kernel: <env_name> and <env_name>; <env_name> (2) and <env_name> (2)

I like this, except possibly - for the special consoles. Nevertheless, I agree that the console number is the least significant bit and any tab with the same tab text is using the same kernel; if the tab text is different, then different kernels. Thus the enumeration distinguishes between consoles of the same type but using different kernels.

The "different client same kernel" case isn't quite as intuitively clear as before, but given that is rarely used and mostly for advanced users, that's less of a concern than not compromising clarity and conciseness for the other cases (which changing it would require).

Indeed, I don't see any use case for multiple Spyder consoles connecting to the same kernel. Two consoles connected to the same kernel in Spyder will have exactly the same namespace, etc. What purpose does this serve? It's just a duplicate console 🤷🏼 . Connecting to the same kernel has advantages for different applications, for example if I want to connect a Spyder console and a Jupyter notebook to the same kernel, then both applications have access to the same namespace across applications.

@ccordoba12
Copy link
Member

ccordoba12 commented Mar 14, 2023

I agree with most of @CAM-Gerlach's last suggestion. The only thing that it's not clear to me is the Different client same kernel convention. What if preserver the A/B/C tags we already have? I mean, we could got with something like:

  • Different client same kernel: <env_name>, <env_name> (A), <env_name> (B)

It's not super intuitive, but it follows the same convention of Regular consoles (different kernels), which perhaps could make users better understand what's going on there.

What do you think?

@ccordoba12
Copy link
Member

ccordoba12 commented Mar 14, 2023

Other things to consider are that haven't been discussed before:

  • Should we preserve the current naming convention for consoles that are not associated to envs (minus A/B/C)? I mean, how should we name consoles attached to /usr/bin/python or Spyder's default env?
  • How are we going to present the Special consoles menu now? Perhaps three entries per env (Pylab, Sympy, Cython), then a separator, then three other entries for the next env, etc?

@CAM-Gerlach
Copy link
Member

What if preserver the A/B/C tags we already have?

I guess we could have it be as you suggest, e.g. <env_name>, <env_name (2), <env_name (2A), etc., so long as the "same kernel" letter isn't shown on the first console (which I believe your suggestion indeed omits). I suppose it doesn't do much harm if few people use that feature anyway, so long as it isn't shown when it isn't being used.

Should we preserve the current naming convention for consoles that are not associated to envs (minus A/B/C)? I mean, how should we name consoles attached to /usr/bin/python or Spyder's default env?

Hmm, good point. IMO, in most of those cases we still have some kinda name/identifier for the environment we can use, e.g. base for Anaconda base, , default or spyder_default Spyder's runtime env/default working env, or system for the user's system Python on macOS or Linux. For any others, we could use Python X.Y.Z (i.e. the version) as the name, which would presumably be very helpful since typically users with multiple base Python installs do so because they each have different Python versions. So there's no need to fall back to the old, potentially confusing different scheme.

How are we going to present the Special consoles menu now? Perhaps three entries per env (Pylab, Sympy, Cython), then a separator, then three other entries for the next env, etc?

Instead of doing all that which would be long and hard to read, I would just make Pylab, Sympy and Cython sub-menus of their own with a list of environments under that, with the first one being the default.

@mrclary
Copy link

mrclary commented Mar 15, 2023

  • Different client same kernel: <env_name>, <env_name> (A), <env_name> (B)

I still don't know of any compelling reason to identify kernels. Every console has its own kernel. The only way to have two separate clients with the same kernel is to explicitly connect to an external kernel again. Why would anyone have two consoles (in Spyder) using the same kernel? Just to take up more tab space? Am I missing something here? I think we'd be better off just alerting the user that they already have a client connected to that kernel, rather than duplicating consoles.

Hmm, good point. IMO, in most of those cases we still have some kinda name/identifier for the environment we can use, e.g. base for Anaconda base, , default or spyder_default Spyder's runtime env/default working env, or system for the user's system Python on macOS or Linux. For any others, we could use Python X.Y.Z

Agreed.

How are we going to present the Special consoles menu now? Perhaps three entries per env (Pylab, Sympy, Cython), then a separator, then three other entries for the next env, etc?

I think that would be good. As far as the console tab goes, how about a small icon in the tab that indicates IPython, Pylab, Sympy, or Cython? We just need 4 different icons. Can the tab have hover text? If so, the hover text could show all information: console type, environment type (conda), environment name and/or path (conda, venv, system, etc.), Python version, kernel identifier, ...

@CAM-Gerlach
Copy link
Member

I think that would be good. As far as the console tab goes, how about a small icon in the tab that indicates IPython, Pylab, Sympy, or Cython? We just need 4 different icons.

As mentioned in my previous reply, this would mean the submenu is four times as long (which could increase to an unbounded length depending on the number of user environments), and also make the text horizontally longer and more repetitive. If having the special consoles as submenus in a submenu is too many layers of nesting (not an unreasonable position), IMO it would be better overall to just put the submenu for each console type directly in the top-level Consoles menu/context menu; it's only three more lines total.

@ccordoba12
Copy link
Member

ccordoba12 commented Mar 16, 2023

Hmm, good point. IMO, in most of those cases we still have some kinda name/identifier for the environment we can use, e.g. base for Anaconda base

What if users don't venture into using envs and just use the base env for all their computations? In that case, consoles would be named base, base (1), etc, which I think it'd be really confusing for newbies. They could ask: why consoles are not named Console 1, Console 2, etc (as before) and instead they have this weird base name?

default or spyder_default Spyder's runtime env/default working env

This is kind of the same scenario as the above one, but for our installers, i.e. consoles would be named default, default (2), etc, which I also find confusing for newbies and people not familiar with envs.

For any others, we could use Python X.Y.Z (i.e. the version) as the name, which would presumably be very helpful since typically users with multiple base Python installs do so because they each have different Python versions.

And what if two non-env installations have the same Python version? For instance, two Homebrew and MacPorts Pythons? In that case the Python version is not enough, unless we have Python X.Y.Z (2), Python X.Y.Z (3), etc, to be consistent.

What I'd like to highlight with my previous comments is that you (i.e. both @CAM-Gerlach and @mrclary) seem to be optimizing the naming convention for envs. And I think using envs is still an advanced feature that perhaps not many people rely on. So, I propose that we keep using Console X when the default interpreter is selected in Preferences. In that way, consoles attached to envs would be treated as our other special consoles (Pylab, Sympy, dedicated, etc) by having a different name. And I guess users should have no problem to get familiar with them due to that.

Instead of doing all that which would be long and hard to read, I would just make Pylab, Sympy and Cython sub-menus of their own with a list of environments under that, with the first one being the default.

That's a very good idea. I agree with it.

@ccordoba12
Copy link
Member

I still don't know of any compelling reason to identify kernels. Every console has its own kernel. The only way to have two separate clients with the same kernel is to explicitly connect to an external kernel again. Why would anyone have two consoles (in Spyder) using the same kernel? Just to take up more tab space? Am I missing something here? I think we'd be better off just alerting the user that they already have a client connected to that kernel, rather than duplicating consoles.

I disagree. First, because it'd be a regression in functionality that is quite simple for us to support. And second, because you can have a console filled with results that you don't want to clear, but you could need to run another computation in the same kernel that can have lots of output. In that case, the most natural thing is to connect another client to the same kernel.

@ccordoba12
Copy link
Member

ccordoba12 commented Mar 16, 2023

IMO it would be better overall to just put the submenu for each console type directly in the top-level Consoles menu/context menu; it's only three more lines total.

I think having three additional submenus for Pylab, Sympy and Cython inside the Special consoles submenu is fine.

@mrclary
Copy link

mrclary commented Mar 16, 2023

a console filled with results that you don't want to clear, but you could need to run another computation in the same kernel that can have lots of output.

Thanks @ccordoba12, I had not thought of that.

@mrclary
Copy link

mrclary commented Mar 16, 2023

This may help clarify my thoughts and perhaps be useful to others as well. So take it for what it is worth.

Goals:

  1. We want to provide as much information as possible about the console
  2. We want to do so as efficiently as possible, reducing clutter and confusion

Information that should be communicated:

  1. Console type: IPython, Pylab, SymPy, Cython
  2. Console environment
    • Name: environment name, "System", or "Spyder"
    • Type: conda, pyenv, venv
    • Environment filepath
    • Python version
  3. Dedicated console: file name
  4. Kernel

Questions:

  1. Are there other means to communicate these in addition to tab text? For example, icons, colors, font weight, or whatever.
  2. Is hover-text possible with the console tab? This may provide a convenient place to list all the information verbosely while keeping the UI clean.
  3. Do we need to distinguish between consoles with identical identifiers? The set of information above will distinguish between consoles if any of the identifiers differ. But what if they are all the same: same console type, exactly the same environment, connected to the same kernel. Do we need to distinguish consoles under this circumstance?
  4. Which information is most important, which should be tab text, which should be an icon, which should be displayed elsewhere?

Comments:

  1. It seems to me that the console type is a prime candidate to be displayed as an icon in the console tab: there are only four possibilities and all are known.
  2. If hover-text is possible, then verbose information displayed there may relieve some of the need to communicate more in the tab text.
  3. We've discussed elsewhere removing the console status widget, but maybe that should instead be updated to display something regarding the focused console rather than the default console. Maybe the console type icon could go here instead of in the console tab. Maybe the environment type could go here as well, instead of the console tab.
  4. Let's not forget that the user can edit the console name to be whatever he wants, so the burden of distinguishing consoles under every circumstance may not have to be our responsibility.
  5. Perhaps the environment name is not the most important information. In my own use, I usually use dedicated consoles for files and all using the same environment. I switch environments from time-to-time, but that is related to changing projects. If (when) we implement project specific consoles, or having multiple projects open simultaneously, then the relevant identifier for me will be the project, not necessarily any environment information.

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Mar 17, 2023

What if users don't venture into using envs and just use the base env for all their computations? In that case, consoles would be named base, base (1), etc, which I think it'd be really confusing for newbies. They could ask: why consoles are not named Console 1, Console 2, etc (as before) and instead they have this weird base name?

This is kind of the same scenario as the above one, but for our installers, i.e. consoles would be named default, default (2), etc, which I also find confusing for newbies and people not familiar with envs.

Okay, so in that case, we could just go with the Python X.Y[.Z] name for all consoles that aren't started in an explicit user-named including base and the Spyder internal environment. We could then show the full details (name, path, etc) in a tooltip for disambiguation and users interested in that, as I believe Isabela previously suggested.

And what if two non-env installations have the same Python version? For instance, two Homebrew and MacPorts Pythons? In that case the Python version is not enough, unless we have Python X.Y.Z (2), Python X.Y.Z (3), etc, to be consistent.

That's exactly what I was proposing. Another alternative instead of Python versions, since most Pythons are either the system Python, Python.org or come with known distributions like MacPorts, Homebrew, Anaconda/Miniconda/Miniforge/Mambaforge, WinPython, deadsnakes etc. (i.e. most of them) where a parent dir in the path we can detect can be matched to a known distribution, we could give the console(s) that name instead. And for the Spyder-managed default env, we don't need to use whatever the actual name is; we can give it a clearer/more user friendly name instead—just Spyder, for instance. Or even the old Console.

If we didn't put the console number in parenthesis, we could put the Python version number in parenthesis, providing nearly complete disambiguation, as it is extremely unlikely users would ever have two separate installs, by the same method (if that's even possible), and with the same Python version. So, my revised suggestion is as follows

<Installation/Environment> [- <Special-type>] (Py<X.Y>) [<Number if >=2>]

I'm not even sure we need the <Special-type> in the tab name; we could have a special tab icon instead (Sympy, Cython or Pylab [MPL] all have circular-ish icons) which would take up less space, be less obtrusive and be easier to spot at a glance. This would simplify the above down to:

<Install/Env> (Py<X.Y>) [<N>]

So for example:

Anaconda base: Anaconda (Py3.7), Anaconda (Py3.7) 2, Anaconda (Py3.7) 3
Miniconda environment: pandas-env (Py3.10), pandas-env (Py3.10) 2
Homebrew: Homebrew (Py3.9), Homebrew (Py3.9) 2
System Python: system (Py3.8), system (Py3.8) 2
Spyder default: Spyder (Py3.9), Spyder (Py3.10)

For the Python.org Python or custom cases where we can't determine a specific distribution name, environment name or system Python, we could do Console (Py[X.Y]) [<N>], i.e. the same pattern as the above, or Python X.Y.Z [<N>].

What I'd like to highlight with my previous comments is that you (i.e. both @CAM-Gerlach and @mrclary) seem to be optimizing the naming convention for envs.

I've now modified the convention substially in my latest proposal above to provide a user-friendly name for a variety of env and non-env Python environments.

And I think using envs is still an advanced feature that perhaps not many people rely on.

Well, they really shouldn't be, because as we all know that is how users routinely break things. There has been a concerted push recently to encourage users to always use envs and make it as easy as possible to do so, with e.g. PEP 668 and PEP 704 on the pip side to prevent pip from installing if an environment isn't activated, conda/conda#12245 to do the same for base on the Conda side, Anaconda Navigator and of course own own work on the Conda-based installers and the environment management plugin in Spyder.

However, even for users not using environments but just specific Python install(s) like you mentioned above, then the revised solution here is equally helpful if not more so, as explained below.

So, I propose that we keep using Console X when the default interpreter is selected in Preferences. In that way, consoles attached to envs would be treated as our other special consoles (Pylab, Sympy, dedicated, etc) by having a different name. And I guess users should have no problem to get familiar with them due to that.

If "Python X.Y" is not sufficiently unique and the user may still not know from which Python the console is being launched from (Homebrew, MacPorts, system Python, Anaconda, etc), then "Console" is even less unique and gives the user even less information on which to go on; my revised proposal aims to specifically address your feedback and tell the user exactly what Python installation they are running right in the Console tab. I'm sure you've seen many users getting confused about where the Python they're using is coming from and where they can install things to it, so this should be a big help in that regard.

I think having three additional submenus for Pylab, Sympy and Cython inside the Special consoles submenu is fine.

Yeah I don't really mind it either way, as my impression is these special console types are not that heavily used by the great majority of users; I mostly suggested flattening it by one level since it seemed like there might be concern with that. If users do raise an issue about it, we can always make the change then.

I disagree. First, because it'd be a regression in functionality that is quite simple for us to support. And second, because you can have a console filled with results that you don't want to clear, but you could need to run another computation in the same kernel that can have lots of output. In that case, the most natural thing is to connect another client to the same kernel.

Well, it's not really a regression if its a minor UI hint indicator for a feature that, as far as I'm aware, few or no users actually use—despite helping probably thousands of Spyder users over the years I don't think I've ever seen any user, in any context, with multiple tabs connected to one console, whereas I have had more than one be confused what the "A" meant. Neither I nor @mrclary had ever used this despite being longtime heavy users of lots of consoles/kernels for half a decade, and I didn't even know what it meant despite writing our current detailed tutorial on connecting to local and remote kernels as well as answering user questions about it.

Regarding the use case presented, as someone who heavily relies on many thousands of lines of output history and long scrollback, I wouldn't remotely consider doing this; I'd just increase the number of lines of scrollback in the IPython Console preferences. It is far more "natural" to do that then a user manually figure out what kernel it is and then manually go through the steps to connect to it, with zero indication from the UI, docs or anything else that this is even possible let alone advisable.

That being said, as long as we only show B, C on the second, third, etc. consoles for the same kernel so it doesn't confuse the >99.9% of users who don't use this, I don't see much harm in it.

@CAM-Gerlach
Copy link
Member

Are there other means to communicate these in addition to tab text? For example, icons, colors, font weight, or whatever.

As suggested above, I suggest we use the Sympy, Cython and Pylab icons to indicate these special types of consoles, and a tooltip to show the other information beyond distribution, environment or file name, Python version and console number.

If hover-text is possible, then verbose information displayed there may relieve some of the need to communicate more in the tab text.

I would be very surprised if its not, as the editor appears to use the same tabs and has tooltips on them, and its what Isabela suggested above.

Do we need to distinguish between consoles with identical identifiers? The set of information above will distinguish between consoles if any of the identifiers differ. But what if they are all the same: same console type, exactly the same environment, connected to the same kernel. Do we need to distinguish consoles under this circumstance?

The distribution/environment name and Python version should render them fairly unambiguous, but I still propose a sequential number when those two both match, for consistency with the current UI.

Which information is most important, which should be tab text, which should be an icon, which should be displayed elsewhere?

As mentioned above, tab text: file name, distribution or environment name, and Python version; type as the respective icon and everything else in a tooltip.

@jitseniesen
Copy link
Member

And I think using envs is still an advanced feature that perhaps not many people rely on.

Well, they really shouldn't be, because as we all know that is how users routinely break things.

When I think of my maths undergraduate students, the vast majority (>90%) have never installed a package because Anaconda comes with all that they need. They don't know about environments, they have no need to know about it, and I want us to keep beginners like this in mind. For these people, "Console", "Console 2" etc have proved to be working fine.

Okay, so in that case, we could just go with the Python X.Y[.Z] name for all consoles that aren't started in an explicit user-named including base and the Spyder internal environment.

This would work even better for beginners, I think, because it's a place for executing Python. However, it seems to contradict what you are proposing later on, when you say:

Anaconda base: Anaconda (Py3.7), Anaconda (Py3.7) 2, Anaconda (Py3.7) 3

I can easily imagine beginners confusing an IPython console named "Anaconda" in the tab with the "Anaconda prompt" on Windows.

The tension here is that for users that open consoles in different environments, we want to distinguish between the environments and thus mention the environment name. For users that don't know about environments, mentioning the environment name without context is confusing. Maybe there is no good solution, but maybe we can distinguish between these two classes of users. Here are some suggestions:

  • At start up, we look whether there are multiple environments. If not, we go in "beginner mode" and use a plain "Console" or "Python" in the tab name. If yes, we go in "advanced mode" and mention the environment name, like Ryan and CAM propose.
  • Alternatively, we don't mention the environment name for consoles opened in the default environment and we do mention the environment name for consoles opened in non-default environments. This may be what CAM is proposing two comments above here, but I'm not sure. The disadvantage here is that the text in the tabs are not consistent.
  • Alternatively, we don't mention the environment name if all consoles are opened in the default environment and we do mention the environment name as soon as any console if opened in a non-default environment. This means that if all consoles are in the default environment and then the user opens a console in a non-default environment, the text in the tabs of the existing consoles has to change. This may be confusing and also technically complicated.

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Mar 17, 2023

However, it seems to contradict what you are proposing later on, when you say:

Right, those are two different proposals; the latter was more specifically tailored to address the types of situations @ccordoba12 posed in the quote I was responding to in that one, with a user that has, e.g. Python installed with both Homebrew and Anaconda, which is something users commonly report/open support requests for when they get confused which Python they're running in the IPython Console and why their packages installed in one or the other aren't showing up.

I can easily imagine beginners confusing an IPython console named "Anaconda" in the tab with the "Anaconda prompt" on Windows.

Hmm, that's a good point. We definitely do see users confusing the IPython Console and the Anaconda prompt (and more generally, the Python interpreter vs. their system shell) a fair bit, usually trying to run system commands (typically package installation) in a Python interpreter.

Considering this further, I'm now thinking that Python X.Y for non-env Pythons (and <env-name> (PyX.Y) or <env-name> (X.Y) for environments is probably indeed the best approach overall for the tab titles. It It makes the tab titles shorter, simpler, and more consistent between known and unknown distro names (though less so between env and non-env Pythons, unless for those we only show the Python version in the tooltip), as we can show the distribution name/type in the tooltip I.e.

{Python X.Y|<env-name> (PyX.Y)} [N if >= 2]

The examples boil down to basically 2 cases:

Anaconda base, Homebrew, system Python, Spyder default: Python 3.7, Python 3.7 2, Python 3.7 3
Conda environment: pandas-env (Py3.10), pandas-env (Py3.10) 2

Alternatively, we move the Python version for specific environments to the tooltip (and status bar?) as well, giving us:

{Python X.Y|<env-name>} [N if >= 2]

Anaconda base, Homebrew, system Python, Spyder default: Python 3.7, Python 3.7 2, Python 3.7 3Conda environment:pandas-env , pandas-env 2`

The one downside with either of these is Pythons from different installations that are the same version don't have unique names/get numbered in sequence by default, but that's still a substantial improvement over the entirely generic, redundant and less informative "Console" name.

An even better idea for more experienced users would be user-customizable console names. Users could type in their own a template with placeholders for the things @mrclary lists and that we would display in the tooltip (env name, env type, Python version, interpreter path, Console type, etc). But that's definitely more of a nice to have than a requirement.

For users that don't know about environments, mentioning the environment name without context is confusing. Maybe there is no good solution, but maybe we can distinguish between these two classes of users.

IMO, there is a fairly straightforward solution, as proposed above—for users who have named and created environments and told Spyder to use them (which would all have to happen for them to show up in the tab in the first place), show the env name (which the user gave the environment) in the console tab. Otherwise, show something more generic, like Python X.Y. That way, users who use environments get the env name, and those who are using the base environment, the "default" Spyder Python environment or another installed Python, do not.

At start up, we look whether there are multiple environments. If not, we go in "beginner mode" and use a plain "Console" or "Python" in the tab name. If yes, we go in "advanced mode" and mention the environment name, like Ryan and CAM propose.

Alternatively, we don't mention the environment name if all consoles are opened in the default environment and we do mention the environment name as soon as any console if opened in a non-default environment. This means that if all consoles are in the default environment and then the user opens a console in a non-default environment, the text in the tabs of the existing consoles has to change. This may be confusing and also technically complicated.

IMO, these both seem like a lot of complexity for relatively little gain over the more straightforward approach in my current proposals, and I'm unclear on the real gain vs. my most recent proposals of showing the Python version and/or distribution name for consoles not started in an environment.

Alternatively, we don't mention the environment name for consoles opened in the default environment and we do mention the environment name for consoles opened in non-default environments. This may be what CAM is proposing two comments above here, but I'm not sure. The disadvantage here is that the text in the tabs are not consistent.

Yeah, this is what I'm proposing. It's not perfect, but it wouldn't be that inconsistent using the Python version as the default "environment name" and the disadvantage seems very minor to me compared to the others.

@mrclary
Copy link

mrclary commented Mar 17, 2023

An even better idea for more experienced users would be user-customizable console names. Users could type in their own a template with placeholders for the things @mrclary lists and that we would display in the tooltip (env name, env type, Python version, interpreter path, Console type, etc). But that's definitely more of a nice to have than a requirement.

I was about to recommend the same thing. In Preferences -> IPython console -> {Display|Advanced settings} we could have a format template that the user could customize. The default template could be as @CAM-Gerlach has suggested: {<env name> | Python X.Y} [N if >=2]. But I suppose this could be implemented sometime later.

@mrclary
Copy link

mrclary commented Mar 17, 2023

So this is how I see the converging consensus so far:

  1. Console tab tooltip will have verbose information, as listed above
  2. Console status bar already shows <env name> (Python X.Y.Z), but should reflect active console tab and use an icon indicating type: IPython, SymPy, Pylab, or Cython
  3. Console text: {<env name> | Python X.Y} [N if >=2]
  4. Possible future enhancement: customized console tab text template

@ccordoba12
Copy link
Member

ccordoba12 commented Mar 25, 2023

Thanks @mrclary for summarizing the discussion so far. My comments about it:

Console tab tooltip will have verbose information, as listed above

Ok, I think this is a good idea to quickly check any console env without clicking on it and then looking at the status bar.

Console status bar already shows (Python X.Y.Z), but should reflect active console tab and use an icon indicating type: IPython, SymPy, Pylab, or Cython

Updating the status bar widget with the console environment is a great idea! Thanks for suggesting that @mrclary. This would make the UX similar to the way the working directory toolbar works, in the sense that if you want to check what cwd (env) the console is in, you need to take a look at the toolbar (status bar).

However, I disagree with using icons on it because I'm sure almost all consoles would be IPython ones, so the information conveyed by the icon would be irrelevant most of the time. Furthermore, when switching consoles connected to different envs, we'd need to update the env used by the editor for completions so that users get the completions they'd expect per env. That way, the current env reflected in the status bar would the one used by the console and editor (and also the profiler/code analysis, etc), so using icons tied to the console wouldn't make sense (another advantage of that approach is that we'd be able to remove the Completions status bar widget)

Finally, I'd like to maintain that Pylab/Sympy/Cython consoles are simply named Pylab 1, etc. That way users would still know that they are special consoles (i.e. different from regular ones).

Console text: { | Python X.Y} [N if >=2]

Given that this information would be reflected in the status bar, I see little need to repeat it in the console tab name. So, I propose to leave that feature to be an option in the IPython console preferences, disabled by default. That would also have the advantage of keeping the interface really simple, which would go very well with what @jitseniesen said above:

For these people [i.e. beginners], "Console", "Console 2" etc have proved to be working fine.


And @CAM-Gerlach, please refrain from posting another long comment about what I just said if it's going to repeat your points above (which for me drags this kind of discussions to almost a dead end). I understand that you're very passionate about showing env names in console tabs, but I don't think that's the direction we're going to go by default. Instead, I prefer the simpler approach of updating the status bar widget to reflect the current env, name all consoles as Console 1, 2, ... and leave naming console tabs as envs to be an extra option, along with the template idea (which I think is a very good one for power users).

If users strongly request that they'd like to see consoles be named as envs, we can reconsider that approach (we know that when our users don't like something, they are very vocal about it).

@mrclary
Copy link

mrclary commented Mar 25, 2023

However, I disagree with using icons on it because I'm sure almost all consoles would be IPython ones, so the information conveyed by the icon would be irrelevant most of the time.

I guess I don't really understand the objection to icons. Currently, the console status bar widget does not have an icon, while every other status bar widget does; so it should have an icon to be consistent with the paradigm. Even though most of the time it would be an IPython icon, this information is less irrelevant than "Console" in the console tab. Furthermore, when other console types are used, it conveys the same information in less space than "Cython" or "Pylab" in the console tab.

Furthermore, when switching consoles connected to different envs, we'd need to update the env used by the editor for completions so that users get the completions they'd expect per env. That way, the current env reflected in the status bar would the one used by the console and editor (and also the profiler/code analysis, etc)

That is correct, although I don't know if mean to argue in favor of this or against it.

so using icons tied to the console wouldn't make sense

I don't know how this follows from having to update the completions environment.

another advantage of that approach is that we'd be able to remove the Completions status bar widget.

I did not mention it in my previous comment, but I had the same idea. We could just eliminate the completions status bar widget altogether.

@ccordoba12
Copy link
Member

ccordoba12 commented Mar 25, 2023

while every other status bar widget does; so it should have an icon to be consistent with the paradigm.

That's actually not correct. Some widgets have icons and others don't:

image

Furthermore, when other console types are used, it conveys the same information in less space than "Cython" or "Pylab" in the console tab.

This assumes that people have seen the Matplotlib or Cython icons before and can recognize them (I'm not even sure if I'd recognize the Cython icon before googling for it!). And the Sympy icon has a lot of detail, so I doubt it could be displayed correctly in such a small size. So, in this case I'd prefer to be explicit about the special nature of those consoles by "flagging" that in their names.

That is correct, although I don't know if mean to argue in favor of this or against it.

That's what I'd naturally expect: if I'm working in a console that has Scikit-learn, I'd like to see code completions for it, regardless of what my completions env is. Otherwise, I'd have to always recall that Spyder has a completions env that is different from the console env and which libraries it has.

@ccordoba12
Copy link
Member

ccordoba12 commented Mar 25, 2023

This assumes that people have seen the Matplotlib or Cython icons before and can recognize them (I'm not even sure if I'd recognize the Cython icon before googling for it!). And the Sympy icon has a lot of detail, so I doubt it could be displayed correctly in such a small size. So, in this case I'd prefer to be explicit about the special nature of those consoles by "flagging" that in their names.

Ok, counter proposal to my own proposal so that we can name consoles only as Console X: what if instead of the project icons, we use C (i.e. mdi.alpha-c-box or similar) for Cython, S for Sympy and P for Pylab? Also, we should mention the console type in the tooltip's widget.

@jrmoserbaltimore
Copy link

Saw this trying to use Spyder, want to put in my own experience.

When using Thonny, I can go to the menu, pop out a terminal in the current venv, use a GUI in Thonny to search for and install packages, create a new venv, add an existing venv (so it runs the activate script), etc.. There's a dropdown in the bottom-right to pick an interpreter (it even detects if micropython is installed on a connected device like a Pi Pico).

When I opened Spyder, I immediately looked for how to add a virtual environment. It lets me pick a path to an interpreter in the options dialogue, but it isn't clear to me that this will activate the venv (I'm assuming it won't). I looked for a way to get a terminal to add packages with pip, but it wasn't obvious how to do that in the 2 minutes I spent trying. I also couldn't locate the built-in package manager, if any.

I checked on Google and found a lot of stuff that said to install Spyder into each Anaconda environment; I'm running Spyder installed from its installer, not conda. I found spyder-env-manager, which said to install it using pip, which again I don't know how to install packages in Spyder's environment (and don't know if that would actually add the plug-in to Spyder).

Spyder looks nice, but I went right back to Thonny because I can't figure out how to install numpy. I loaded my Pi Pico with a custom-compiled version of Micropython with ulab; doing that was more obvious than figuring out how to run pip in Spyder's Python environment.

Not being able to install or select a venv (putting aside being stuck on Python 3.8, which is its own problem) and manage packages (by getting a terminal open in the venv, or by having a GUI to manage packages) is the only thing blocking me from using Spyder right now.

From my perspective, the lack of a venv manager and some obvious way to install packages (even getting a terminal open is either non-obvious or not in Spyder—there is a plugin for this, the only thing online about installing Spyder plugins has to do with already being in a terminal for the Python environment Spider's running in, this is a causality loop that may very well destroy the entire universe) is the biggest barrier to accessibility. Spyder becomes "you can use this IDE only with the special environment it comes with and only with the default Python modules" even for moderately experienced developers, which is completely useless (hence being a barrier to accessibility). As far as I can tell, Spyder only really works for conda users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready-for-implementation Changes decided during UX study
Projects
None yet
Development

No branches or pull requests

10 participants