Skip to content

Improve display names of interpreters in the list and status bar #1351

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

Closed
1 task
DonJayamanne opened this issue Apr 9, 2018 · 18 comments · Fixed by #2540 or #2616
Closed
1 task

Improve display names of interpreters in the list and status bar #1351

DonJayamanne opened this issue Apr 9, 2018 · 18 comments · Fixed by #2540 or #2616
Assignees
Labels
debt Covers everything internal: CI, testing, refactoring of the codebase, etc. feature-request Request for new features or functionality important Issue identified as high-priority

Comments

@DonJayamanne
Copy link

DonJayamanne commented Apr 9, 2018

The prefix 'packaged by conda-forge` should not be added to some of the interpreters.
As this belongs to the root interpreters

@brettcannon @qubitron
We'll need to go come up with a set of rules for the display names of:

  • Conda, virtual, venv, and other environments.

screen shot 2018-04-09 at 11 31 56 am

win

@DonJayamanne DonJayamanne added needs PR debt Covers everything internal: CI, testing, refactoring of the codebase, etc. labels Apr 9, 2018
@DonJayamanne DonJayamanne self-assigned this Apr 9, 2018
@DonJayamanne
Copy link
Author

DonJayamanne commented Apr 28, 2018

The following is a WIP:

Requirements:

  • Able to identify the type of environment (whether its conda, pipenv, etc)
  • Able to identify version of Python
  • Able to identify name of the environment (if its a virtual environment or similar)
  • Able to identify the name of the company/distro
  • Consistent across all platforms
  • Consider requirements of PEP 514

TBD:

  • Do we care for the display of bitness information (should be easy to determine, using sys.maxsize)
  • Do we need to display the type of release (e.g. if its a RC, beta etc, something other than the final release).

Propose Format

CompanyName DisplayName (EnvironmentName EnvironmentType)

Propose Sort order

  • Environment + display name
    E.g.:
  1. Anaconda Python 2.7.14 32Bit (base)
  2. Anaconda Python 2.7.14 32Bit (env-01)
  3. Anaconda Python 3.5.1 64Bit (env-02)
  4. Python 2.7.14 32Bit (v01 pipenv)
  5. Python 3.5.1 32Bit (v02 pipenv)
  6. Python 3.5.1 32Bit (v03 pipenv)
  7. Python 3.5.1 32Bit (v03 pyenv)
  8. Python 3.6.1 32Bit (v03 venv)
  9. Python 3.5.1 32Bit (myenv2 virtualenv)

Where:

  • CompanyName is
    • The name of the company (on Windows this is retrieved from the registry PEP 514)
  • DisplayName is
    • On Windows, this should be retrieved from the registry PEP 514
    • Python Major.Minor.Micro 32/64bit (for all but conda environments and non Windows OS)
      E.g. Python 2.7.14 32bit Python 3.5.1 64bit
  • EnvironmentType: is one of the following
    • pipenv
    • pyenv
    • venv
    • virtualenv
      Note: conda is not included in the above list, as the company name (prefix) would be an implicit indicator of the fact that its a conda environment.

@DonJayamanne DonJayamanne changed the title Improve display names of interpreters Improve display names of interpreters in the list and status bar Apr 28, 2018
@DonJayamanne
Copy link
Author

Added needs decision, as @qubitron is working on the display format.
I'm currently working on laying the foundation work to make the above possible (i.e. ensure we have all necessary bits of information to build the display value).

@DonJayamanne
Copy link
Author

DonJayamanne commented May 4, 2018

Agreed display is as follows:
Sort order = Version number

Anaconda Python 2.7.14 32-bit (base)
Anaconda Python 2.7.14 32-bit (env-01)
Anaconda Python 3.5.1 64-bit (env-02)
Python 2.7.14 32-bit (v01 pipenv)
Python 3.5.1 32-bit (v02 pipenv)
Python 3.5.1 32-bit (v03 pipenv)
Python 3.5.1 32-bit (v03 pyenv)
Python 3.6.1 32-bit (v03 venv)
Python 3.5.1 32-bit (myenv2 virtualenv)

@brettcannon
Copy link
Member

brettcannon commented May 7, 2018

What are the parts of (v03 venv)? Is that directory name and type? Should we separate those out more clearly as that will get confusing when the directory has a space, e.g. (some bunk venv)?

And do we want x86/x64 instead of 32-bit/64-bit for any reason other than it's shorter? 😉

@DonJayamanne
Copy link
Author

(v03 venv)

v03 - environment name
venv - tool used to create environment (or environment type).

confusing when the directory has a space, e.g. (some bunk venv)?

Agreed. How about using double quotes when necessary?

And do we want x86/x64

Good idea. I went with the later as that's what is returned by python (when using --version).

@brettcannon
Copy link
Member

Maybe ("some bunk" / venv)? ("some bunk": venv)?

@DonJayamanne
Copy link
Author

@qubitron thoughts.

@qubitron
Copy link

qubitron commented May 7, 2018

What about (some bunk: venv)? Double quotes look noisy, and the colon to me says "some bunk is a venv".

@brettcannon
Copy link
Member

Could also be single quotes: ('some bunk': venv). But since macOS 9 is no longer a thing we can probably get away with it not confusing people as to where the directory name ends. 😉

@DonJayamanne
Copy link
Author

Note:
Registry information is not to be used for display names. See issue #2219

@DonJayamanne DonJayamanne added the bug Issue identified by VS Code Team member as probable bug label Jul 30, 2018
@DonJayamanne
Copy link
Author

Updated label to Bug as this resolves issue #2219

@brettcannon brettcannon added the important Issue identified as high-priority label Aug 2, 2018
@ericsnowcurrently
Copy link

I've verified that the interpreter/env list is formatted in the new way. However, there might be something wrong. Some of the entries don't have the right info:

Python 2.7.15 64-bit (usr: virtualEnv)
  /usr/bin/python
Python 3.5.2 64-bit
  /usr/bin/python3.5
Python 3.6.5 64-bit (.miniconda3: conda)
  ~/.miniconda3/bin/python
Python 3.6.5 64-bit (usr: virtualEnv)
  /usr/bin/python3
Python 3.7.0 64-bit (test env: conda)
  ~/.miniconda3/envs/test env/bin/python
Python 3.7.0 64-bit
  /usr/bin/python3.7
Python 3.7.0 64-bit (test_env: venv)
  ~/.envs/test_env/bin/python

Note the (usr: virtualEnv) entries. IIRC, those were previously standalone entries (like 3.5 and 3.7 are). Furthermore, I don't have any virtualenv environments.

Perhaps this is related to a different issue, but I noticed it here at least. :)

@ericsnowcurrently ericsnowcurrently added feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug labels Sep 18, 2018
@brettcannon brettcannon reopened this Sep 18, 2018
@ericsnowcurrently
Copy link

Things look good now. "System" interpreters are shown correctly and pyenv showed up right.

@d3r3kk
Copy link

d3r3kk commented Sep 19, 2018

(Tested as well, looks great)

@qubitron
Copy link

Looks good with the following changes:

  • virtualEnv -> virtualenv
  • venv space -> 'venv space'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Covers everything internal: CI, testing, refactoring of the codebase, etc. feature-request Request for new features or functionality important Issue identified as high-priority
Projects
None yet
5 participants