Skip to content

Improvements to IEnvironmentActivationService to use hidden terminals #2614

Description

Today we use IEnvironmentActivationService to generate environment variables for activated environments. E.g. when running python code on behalf of user as a background process.

We do this today by activating the environment and capturing the environment variables.
For this we get the activation commands (using a default shell) and run it as a process.

A better approach is:

  • Create a hidden terminal
  • Get activation command and send to terminal
  • Dump variables to text file (instead of stdout).

Solves

  • unicode issues (today scraping stdout unicode)
  • Activates in terminal (thats what some activation command expect, i.e. to be run within a shell).

Discussed with Karthik Nadig (@karthiknadig) (helps DAP) Pavel Minaev (@int19h) /cc

FYI - I have started some work on this.

Activity

  1. int19h commented on Dec 5, 2019

    @int19h
    Contributor

    I think this could even skip the terminal altogether, and just spawn the activation script directly (all it needs is to ensure that it runs under the same shell that the actual terminal will be).

  2. DonJayamanne commented on Dec 6, 2019

    @DonJayamanne
    ContributorAuthor

    I think this could even skip the terminal altogether, and just spawn the activation script directly (all it needs is to ensure that it runs under the same shell that the actual terminal will be).

    Agreed. But using the terminal is easier as we don't need to worry about finding paths to shells.
    The activation scripts will run in the exact same environment that would other wise run when users run their code. We also have the added advantage of displaying the shell for diagnostic purposes if something goes wrong.

    Also this ensures startup scripts are correctly loaded in the shells (something conda requires and initializes when using conda init).

    On a side note, a tty interface is required by either pipenv or pyenv. Can't remember which one it was.

  3. rchiodo commented on Feb 3, 2020

    @rchiodo
    Contributor

    I believe this is working. At least it does for me. Ian Huff (@IanMatthewHuff) didn't you say you had a problem with activation with a new environment?

  4. IanMatthewHuff commented on Feb 3, 2020

    @IanMatthewHuff
    Member

    Rich Chiodo (@rchiodo) no. My issue was different, I'm pretty sure, my issue was with our saving of the last successful jupyter environment I think.

  5. rchiodo commented on Feb 3, 2020

    @rchiodo
    Contributor

    Thanks. Validated then.

  6. locked as resolved and limited conversation to collaborators on Feb 10, 2020
  7. unlocked this conversation on Nov 14, 2020
  8. locked as resolved and limited conversation to collaborators on May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions