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

Investigate the possible flow for a Create Environment command #19676

Closed
brettcannon opened this issue Aug 11, 2022 · 7 comments · Fixed by #19848
Closed

Investigate the possible flow for a Create Environment command #19676

brettcannon opened this issue Aug 11, 2022 · 7 comments · Fixed by #19848
Assignees
Labels
area-environments Features relating to handling interpreter environments feature-request Request for new features or functionality needs proposal Need to make some design decisions on-testplan Added to test plan

Comments

@brettcannon
Copy link
Member

This would be taking the ideas from WWBD and bringing them here.

@brettcannon brettcannon added feature-request Request for new features or functionality needs proposal Need to make some design decisions area-environments Features relating to handling interpreter environments labels Aug 11, 2022
@brettcannon
Copy link
Member Author

brettcannon commented Aug 11, 2022

flowchart TD
    start([start])

    has_interpreter{Interpreter selected?}
    has_env_selected{Environment selected?}
    has_python{Is Python installed?}
    select_newest[Select newest Python]
    has_venv{Has `venv`?}
    create_env[`python -m venv .venv`]

    has_pip{"Has `pip`?"}
    
    has_requirements{Has requirements files?}
    select_requirements[/Select requirements files/]
    install_requirements["`python -m pip install -r requirements.txt`"]

    has_pyproject{Has a `pyproject.toml`?}
    select_extras[/Select extras/]
    install_extras["`python -m pip install -e .[extras]`"]

    error((Notify user of problem))

    finished([end])
    

    start --> has_interpreter

    subgraph Create Environment

    has_interpreter -- yes --> has_venv
    has_interpreter -- no --> has_env_selected

    %% error
    has_env_selected -- "no (nothing selected)" --> has_python

    has_python -- yes --> select_newest
    %% error
    

    select_newest --> has_venv

    has_venv -- yes --> create_env
    %% error
    end

    subgraph Installation
    create_env --> has_pip

    has_pip -- yes --> has_requirements
    %% error
    
    has_requirements -- yes --> select_requirements
    select_requirements --> install_requirements
    %% finished
    has_requirements -- no --> has_pyproject

    has_pyproject -- yes --> select_extras
    select_extras --> install_extras
    %% finished
    end

    has_venv -- "no (Debian)" --> error
    has_python -- no --> error
    has_env_selected -- yes --> error
    has_pip -- "no (Debian)" --> error

    error --> finished
    install_extras --> finished
    has_pyproject -- no --> finished
    install_requirements --> finished
Loading

@brettcannon
Copy link
Member Author

Asked for feedback at https://twitter.com/brettsky/status/1557850636611268609 .

@karthiknadig
Copy link
Member

If we are triggering environment creataion, we should probably skip the popup that we show when we detect env creation.

@brettcannon
Copy link
Member Author

If we are triggering environment creataion, we should probably skip the popup that we show when we detect env creation.

We should probably skip it regardless and just select the environment with an option to turn off automatic environment detection/selection.

@karthiknadig
Copy link
Member

For now the flow is like this:

  1. User execute the create environment command.
  2. We show a Quick pick allowing users to select from one of the providers (venv / conda / etc)
  3. For venv :
    1. Select a workspace in multi root scenario. If single workspace this is not shown.
    2. Select a python from a list of global pythons (This required exposing the python picker as an internal API). If only one interpreter is found, then that is used.
    3. Initiate the command to create venv. Install any packages.
  4. For conda:
    1. Select a workspace in multi root scenario. If single workspace this is not shown.
    2. Select a version of python to install in the new environment.
    3. Initiate the command to create conda env using --prefix.
  5. Once env is created you will see a pop-up to select that env (this is temporary until we expose a way to pause that UI)

@brettcannon
Copy link
Member Author

3. Install any packages.

Which install scenarios are supported?

@karthiknadig
Copy link
Member

Which install scenarios are supported?

requirements.txt or pyproject.toml directly under the workspace directory is supported.

eleanorjboyd pushed a commit to eleanorjboyd/vscode-python that referenced this issue Oct 4, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments feature-request Request for new features or functionality needs proposal Need to make some design decisions on-testplan Added to test plan
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants