forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Run python code using env variables from activated envs #3930
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
Merged
DonJayamanne
merged 52 commits into
microsoft:master
from
DonJayamanne:issueCondaActivation
Jan 10, 2019
Merged
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
68a566d
Misc
DonJayamanne eea64b7
Merge branch 'master' of https://github.com/DonJayamanne/pythonVSCode
DonJayamanne 93119d2
Merge branch 'master' of https://github.com/DonJayamanne/pythonVSCode
DonJayamanne fa9c397
Run python code using env variables from activated envs
DonJayamanne bfc634a
Improve readability
DonJayamanne cf1535a
Give preference to version returned by python process
DonJayamanne eb69a75
Fix trace message
DonJayamanne a5ae72d
Fix typo
DonJayamanne 8bec994
Fixed errors, ensure vsc, console does not leak into debug adapter code
DonJayamanne f5e2b97
Fixes
DonJayamanne 85f77d9
Fixed tests
DonJayamanne 817a4df
More tests for caching
DonJayamanne 917fb36
Update src/client/common/utils/cacheUtils.ts
brettcannon 14c8e93
Update src/client/common/utils/cacheUtils.ts
brettcannon 3f58161
Update src/test/common/process/pythonExecutionFactory.unit.test.ts
brettcannon d3dc620
Update src/test/common/process/pythonExecutionFactory.unit.test.ts
brettcannon 79316af
Update src/client/common/utils/cacheUtils.ts
brettcannon 3b4dbcf
Update src/test/common/terminals/environmentActivationProviders/pipEn…
brettcannon d341e01
Update src/test/common/terminals/environmentActivationProviders/pipEn…
brettcannon 1777227
Use default shells
DonJayamanne bd863c6
Change time
DonJayamanne b5948f2
Log command
DonJayamanne dc5f730
Rename PipEnv to Pipenv
DonJayamanne 10ec5d4
Write tests
DonJayamanne 901465b
Fixed tests
DonJayamanne 135fbf3
Fix tests
DonJayamanne cffda9a
Fix test
DonJayamanne 30c40b5
Fix tests
DonJayamanne a715423
Always pass value into get configuration
DonJayamanne 6947f18
Fix tests
DonJayamanne b909447
Fix tests
DonJayamanne ac4414d
cleaner
DonJayamanne a1faa8b
Register services
DonJayamanne 46d0bb3
Fix svc registrations
DonJayamanne d1ea8dc
Address code review comments
DonJayamanne 5cd8061
Add telemetry
DonJayamanne a496df3
Log errors
DonJayamanne cdd5d49
Fix tests
DonJayamanne 5e530bf
Add news entry
DonJayamanne a25695a
Fix references
DonJayamanne 34a6779
Fixed tests
DonJayamanne 77adb2b
Address review comments
DonJayamanne 3f5268f
Update news/3 Code Health/3746.md
brettcannon eeac026
Update news/2 Fixes/3330.md
brettcannon ac0a360
Fix tests
DonJayamanne 2ce0659
Merge branch 'issueCondaActivation' of https://github.com/DonJayamann…
DonJayamanne 1d22e7b
More fixes
DonJayamanne 2fcd998
Fixes
DonJayamanne 66bd123
Fixed tests
DonJayamanne c8de453
Fixes
DonJayamanne 58ab538
Fix tests
DonJayamanne 1b29756
Fix tests
DonJayamanne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Activate `pipenv` environments in the shell using the command `pipenv shell`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Activate any selected Python Environment when running unit tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Remove duplicates from interpreters listed in the interpreter selection list. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Detect usage of `xonsh` shells (this does **not** add support for `xonsh` itself) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
import os | ||
import json | ||
|
||
print(json.dumps(dict(os.environ))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/client/common/terminal/environmentActivationProviders/pipEnvActivationProvider.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
'use strict'; | ||
|
||
import { inject, injectable } from 'inversify'; | ||
import { Uri } from 'vscode'; | ||
import { IInterpreterService, InterpreterType } from '../../../interpreter/contracts'; | ||
import { ITerminalActivationCommandProvider, TerminalShellType } from '../types'; | ||
|
||
@injectable() | ||
export class PipEnvActivationCommandProvider implements ITerminalActivationCommandProvider { | ||
constructor(@inject(IInterpreterService) private readonly interpreterService: IInterpreterService) { } | ||
|
||
public isShellSupported(_targetShell: TerminalShellType): boolean { | ||
return true; | ||
} | ||
|
||
public async getActivationCommands(resource: Uri | undefined, _: TerminalShellType): Promise<string[] | undefined> { | ||
const interpreter = await this.interpreterService.getActiveInterpreter(resource); | ||
if (!interpreter || interpreter.type !== InterpreterType.Pipenv) { | ||
return; | ||
} | ||
|
||
return ['pipenv shell']; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.