Skip to content

Commit d3c4ad9

Browse files
committed
Merge branch 'master' into ds/custom_editor
* master: Fix flakey file system tests (#10541) Tweaks for gather (#10532) Fix #10437: Update launch.json handling to support "listen" and "connect" (#10517) Add conda support to nightly flake test (#10523) Rename datascience to datascience_modules (#10525) Clean up the extension activation code. (#10455) Allow escape and ctrl+U to clear the interactive window (#10513) Fix builtins so they don't interfere with our execution (#10511) Jupyter autocompletion will only show up on empty lines, (#10420) notify on missing kernel and interpreter with kernel (#10508)
2 parents cc9458a + ca776ab commit d3c4ad9

File tree

106 files changed

+2230
-1461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+2230
-1461
lines changed

.vscode/launch.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@
242242
"env": {
243243
// Remove `X` prefix to test with real python (for DS functional tests).
244244
"XVSCODE_PYTHON_ROLLING": "1",
245+
// Remove 'X' to turn on all logging in the debug output
246+
"XVSC_PYTHON_FORCE_LOGGING": "1",
245247
// Remove `X` prefix and update path to test with real python interpreter (for DS functional tests).
246-
// Do not use a conda environment (as it needs to be activated and the like).
247248
"XCI_PYTHON_PATH": "<Python Path>"
248249
},
249250
"outFiles": [

build/ci/conda_base.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pandas
2+
jupyter
3+
numpy
4+
matplotlib

build/ci/conda_env_1.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: conda_env_1
2+
dependencies:
3+
- python=3.7
4+
- pandas
5+
- jupyter
6+
- numpy
7+
- matplotlib

build/ci/conda_env_2.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: conda_env_2
2+
dependencies:
3+
- python=3.8
4+
- pandas
5+
- jupyter
6+
- numpy
7+
- matplotlib

build/ci/templates/test_phases.yml

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,7 @@ steps:
9797
python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python/debugpy/no_wheels --no-cache-dir --implementation py --no-deps --upgrade --pre debugpy
9898
displayName: 'pip install system test requirements'
9999
condition: and(succeeded(), eq(variables['NeedsPythonTestReqs'], 'true'))
100-
101-
# Install the additional sqlite requirements
102-
#
103-
# This task will only run if variable `NeedsPythonFunctionalReqs` is true.
104-
- bash: |
105-
sudo apt-get install libsqlite3-dev
106-
python -m pip install pysqlite
107-
displayName: 'Setup python to run with sqlite on 2.7'
108-
condition: and(succeeded(), eq(variables['NeedsPythonFunctionalReqs'], 'true'), eq(variables['Agent.Os'], 'Linux'), eq(variables['PythonVersion'], '2.7'))
109-
100+
110101
# Install the requirements for functional tests.
111102
#
112103
# This task will only run if variable `NeedsPythonFunctionalReqs` is true.
@@ -118,9 +109,69 @@ steps:
118109
- bash: |
119110
python -m pip install numpy
120111
python -m pip install --upgrade -r ./build/functional-test-requirements.txt
112+
python -c "import sys;print(sys.executable)"
121113
displayName: 'pip install functional requirements'
114+
condition: and(succeeded(), eq(variables['NeedsPythonFunctionalReqs'], 'true'))
115+
116+
# Add CONDA to the path so anaconda works
117+
#
118+
# This task will only run if variable `NeedsPythonFunctionalReqs` is true.
119+
- bash: |
120+
echo "##vso[task.prependpath]$CONDA/bin"
121+
displayName: 'Add conda to the path'
122+
condition: and(succeeded(), eq(variables['NeedsPythonFunctionalReqs'], 'true'), ne(variables['Agent.Os'], 'Windows_NT'))
123+
124+
# Add CONDA to the path so anaconda works (windows)
125+
#
126+
# This task will only run if variable `NeedsPythonFunctionalReqs` is true.
127+
- powershell: |
128+
Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
129+
displayName: 'Add conda to the path'
130+
condition: and(succeeded(), eq(variables['NeedsPythonFunctionalReqs'], 'true'), eq(variables['Agent.Os'], 'Windows_NT'))
131+
132+
# On MAC let CONDA update install paths
133+
#
134+
# This task will only run if variable `NeedsPythonFunctionalReqs` is true.
135+
- bash: |
136+
sudo chown -R $USER $CONDA
137+
displayName: 'Give CONDA permission to its own files'
138+
condition: and(succeeded(), eq(variables['NeedsPythonFunctionalReqs'], 'true'), eq(variables['Agent.Os'], 'Darwin'))
139+
140+
# Create the two anaconda environments
141+
#
142+
# This task will only run if variable `NeedsPythonFunctionalReqs` is true.
143+
#
144+
- script: |
145+
conda env create --quiet --force --file build/ci/conda_env_1.yml
146+
conda env create --quiet --force --file build/ci/conda_env_2.yml
147+
displayName: 'Create CONDA Environments'
122148
condition: and(succeeded(), eq(variables['NeedsPythonFunctionalReqs'], 'true'))
123149
150+
# Run the pip installs in the 3 environments (darwin linux)
151+
- bash: |
152+
source activate base
153+
conda install --quiet -y --file build/ci/conda_base.yml
154+
python -m pip install --upgrade -r build/conda-functional-requirements.txt
155+
source activate conda_env_1
156+
python -m pip install --upgrade -r build/conda-functional-requirements.txt
157+
source activate conda_env_2
158+
python -m pip install --upgrade -r build/conda-functional-requirements.txt
159+
conda deactivate
160+
displayName: 'Install Pip requirements for CONDA envs'
161+
condition: and(succeeded(), eq(variables['NeedsPythonFunctionalReqs'], 'true'), ne(variables['Agent.Os'], 'Windows_NT'))
162+
163+
# Run the pip installs in the 3 environments (windows)
164+
- script: |
165+
call activate base
166+
conda install --quiet -y --file build/ci/conda_base.yml
167+
python -m pip install --upgrade -r build/conda-functional-requirements.txt
168+
call activate conda_env_1
169+
python -m pip install --upgrade -r build/conda-functional-requirements.txt
170+
call activate conda_env_2
171+
python -m pip install --upgrade -r build/conda-functional-requirements.txt
172+
displayName: 'Install Pip requirements for CONDA envs'
173+
condition: and(succeeded(), eq(variables['NeedsPythonFunctionalReqs'], 'true'), eq(variables['Agent.Os'], 'Windows_NT'))
174+
124175
# Downgrade pywin32 on Windows due to bug https://github.com/jupyter/notebook/issues/4909
125176
#
126177
# This task will only run if variable `NeedsPythonFunctionalReqs` is true.

build/ci/vscode-python-nightly-flake-ci.yaml

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,6 @@ stages:
5050
steps:
5151
- template: templates/test_phases.yml
5252

53-
- job: 'Py36'
54-
dependsOn: []
55-
timeoutInMinutes: 120
56-
strategy:
57-
matrix:
58-
'Functional':
59-
PythonVersion: '3.6'
60-
TestsToRun: 'testfunctional'
61-
NeedsPythonTestReqs: true
62-
NeedsPythonFunctionalReqs: true
63-
VSCODE_PYTHON_ROLLING: true
64-
pool:
65-
vmImage: 'ubuntu-16.04'
66-
steps:
67-
- template: templates/test_phases.yml
68-
6953
- stage: Mac
7054
dependsOn:
7155
- Build
@@ -85,22 +69,6 @@ stages:
8569
steps:
8670
- template: templates/test_phases.yml
8771

88-
- job: 'Py36'
89-
dependsOn: []
90-
timeoutInMinutes: 120
91-
strategy:
92-
matrix:
93-
'Functional':
94-
PythonVersion: '3.6'
95-
TestsToRun: 'testfunctional'
96-
NeedsPythonTestReqs: true
97-
NeedsPythonFunctionalReqs: true
98-
VSCODE_PYTHON_ROLLING: true
99-
pool:
100-
vmImage: '$(vmImageMacOS)'
101-
steps:
102-
- template: templates/test_phases.yml
103-
10472
- stage: Windows
10573
dependsOn:
10674
- Build
@@ -119,19 +87,3 @@ stages:
11987
vmImage: 'vs2017-win2016'
12088
steps:
12189
- template: templates/test_phases.yml
122-
123-
- job: 'Py36'
124-
dependsOn: []
125-
timeoutInMinutes: 120
126-
strategy:
127-
matrix:
128-
'Functional':
129-
PythonVersion: '3.6'
130-
TestsToRun: 'testfunctional'
131-
NeedsPythonTestReqs: true
132-
NeedsPythonFunctionalReqs: true
133-
VSCODE_PYTHON_ROLLING: true
134-
pool:
135-
vmImage: 'vs2017-win2016'
136-
steps:
137-
- template: templates/test_phases.yml
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# List of requirements for conda environments that cannot be installed using conda
2+
livelossplot
3+
versioneer
4+
flake8
5+
autopep8
6+
bandit
7+
black ; python_version>='3.6'
8+
yapf
9+
pylint
10+
pycodestyle
11+
prospector
12+
pydocstyle
13+
nose
14+
pytest==4.6.9 # Last version of pytest with Python 2.7 support
15+
rope
16+
flask
17+
django
18+
isort
19+
pathlib2>=2.2.0 ; python_version<'3.6' # Python 2.7 compatibility (pytest)
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
1-
# List of requirements for functional tests
2-
versioneer
3-
jupyter
4-
numpy
5-
matplotlib
6-
pandas
7-
livelossplot
1+
# List of requirements for functional tests
2+
versioneer

build/webpack/webpack.extension.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const config = {
6161
},
6262
// Packages listed in externals keeps webpack from trying to package them.
6363
// The ppaPackageList variable is set to non-empty if the build pipeline has been
64-
//authenticated to install @msrvida/python-program-analysis.
64+
// authenticated to install @msrvida/python-program-analysis.
6565
externals: ['vscode', 'commonjs', ...ppaPackageList, ...existingModulesInOutDir],
6666
plugins: [
6767
...common.getDefaultPlugins('extension'),

news/1 Enhancements/10198.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Support using 'esc' or 'ctrl+u' to clear the contents of the interactive window input box.

news/1 Enhancements/10437.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Support reverse connection ("listen" in launch.json) from debug adapter to VSCode.

news/2 Fixes/10023.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Jupyter autocompletion will only show magic commands on empty lines, preventing them of appearing in functions.

news/2 Fixes/10280.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix problem with Data Viewer not working when builtin functions are overridden (like max).

news/3 Code Health/10134.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add conda environments to nightly test runs

news/3 Code Health/10454.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Refactor the extension activation code to split on phases.

package.json

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,15 +1365,46 @@
13651365
},
13661366
"attach": {
13671367
"properties": {
1368+
"connect": {
1369+
"type": "object",
1370+
"label": "Attach by connecting to debugpy over a socket.",
1371+
"properties": {
1372+
"port": {
1373+
"type": "number",
1374+
"description": "Port to connect to."
1375+
},
1376+
"host": {
1377+
"type": "string",
1378+
"description": "Hostname or IP address to connect to.",
1379+
"default": "127.0.0.1"
1380+
}
1381+
},
1382+
"required": ["port"]
1383+
},
1384+
"listen": {
1385+
"type": "object",
1386+
"label": "Attach by listening for incoming socket connection from debugpy",
1387+
"properties": {
1388+
"port": {
1389+
"type": "number",
1390+
"description": "Port to listen on."
1391+
},
1392+
"host": {
1393+
"type": "string",
1394+
"description": "Hostname or IP address of the interface to listen on.",
1395+
"default": "127.0.0.1"
1396+
}
1397+
},
1398+
"required": ["port"]
1399+
},
13681400
"port": {
13691401
"type": "number",
1370-
"description": "Debug port to attach",
1371-
"default": 0
1402+
"description": "Port to connect to."
13721403
},
13731404
"host": {
13741405
"type": "string",
1375-
"description": "IP Address of the of remote server (default is localhost or use 127.0.0.1).",
1376-
"default": "localhost"
1406+
"description": "Hostname or IP address to connect to.",
1407+
"default": "127.0.0.1"
13771408
},
13781409
"pathMappings": {
13791410
"type": "array",
@@ -1834,14 +1865,14 @@
18341865
},
18351866
"python.dataScience.enableGather": {
18361867
"type": "boolean",
1837-
"default": false,
1838-
"description": "Enable experimental code gathering for executed cells. For a gathered cell, that cell and only the code it depends on will be exported to a new notebook.",
1868+
"default": true,
1869+
"description": "Python Insiders Only: Enable experimental gather feature for executed cells. For a gathered cell, that cell and only the code it depends on will be exported to a new notebook.",
18391870
"scope": "resource"
18401871
},
18411872
"python.dataScience.gatherToScript": {
18421873
"type": "boolean",
1843-
"default": true,
1844-
"description": "If experimental code gather is enabled, gather code to a python script rather than a notebook.",
1874+
"default": false,
1875+
"description": "Python Insiders Only: If experimental gather feature is enabled, gather code to a python script rather than a notebook.",
18451876
"scope": "resource"
18461877
},
18471878
"python.dataScience.codeLenses": {

pythonFiles/tests/ipython/scripts.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ def execute_script(file, replace_dict=dict([])):
4545

4646
def get_variables(capsys):
4747
path = os.path.dirname(os.path.abspath(__file__))
48-
file = os.path.abspath(
49-
os.path.join(path, "../../datascience/getJupyterVariableList.py")
50-
)
48+
file = os.path.abspath(os.path.join(path, "./getJupyterVariableList.py"))
5149
if execute_script(file):
5250
read_out = capsys.readouterr()
5351
return json.loads(read_out.out)
@@ -64,9 +62,7 @@ def find_variable_json(varList, varName):
6462
def get_variable_value(variables, name, capsys):
6563
varJson = find_variable_json(variables, name)
6664
path = os.path.dirname(os.path.abspath(__file__))
67-
file = os.path.abspath(
68-
os.path.join(path, "../../datascience/getJupyterVariableValue.py")
69-
)
65+
file = os.path.abspath(os.path.join(path, "./getJupyterVariableValue.py"))
7066
keys = dict([("_VSCode_JupyterTestValue", json.dumps(varJson))])
7167
if execute_script(file, keys):
7268
read_out = capsys.readouterr()
@@ -79,7 +75,9 @@ def get_data_frame_info(variables, name, capsys):
7975
varJson = find_variable_json(variables, name)
8076
path = os.path.dirname(os.path.abspath(__file__))
8177
file = os.path.abspath(
82-
os.path.join(path, "../../datascience/getJupyterVariableDataFrameInfo.py")
78+
os.path.join(
79+
path, "../../vscode_datascience_helpers/getJupyterVariableDataFrameInfo.py"
80+
)
8381
)
8482
keys = dict([("_VSCode_JupyterTestValue", json.dumps(varJson))])
8583
if execute_script(file, keys):
@@ -92,7 +90,9 @@ def get_data_frame_info(variables, name, capsys):
9290
def get_data_frame_rows(varJson, start, end, capsys):
9391
path = os.path.dirname(os.path.abspath(__file__))
9492
file = os.path.abspath(
95-
os.path.join(path, "../../datascience/getJupyterVariableDataFrameRows.py")
93+
os.path.join(
94+
path, "../../vscode_datascience_helpers/getJupyterVariableDataFrameRows.py"
95+
)
9696
)
9797
keys = dict(
9898
[

pythonFiles/datascience/daemon/README.md renamed to pythonFiles/vscode_datascience_helpers/daemon/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const env = {
77
PYTHONUNBUFFERED: '1',
88
PYTHONPATH: '<extension dir>/pythonFiles:<extension dir>/pythonFiles/lib/python'
99
}
10-
const childProcess = cp.spawn('<fully qualifieid python path>', ['-m', 'datascience.daemon', '-v', '--log-file=log.log'], {env});
10+
const childProcess = cp.spawn('<fully qualifieid python path>', ['-m', 'vscode_datascience_helpers.daemon', '-v', '--log-file=log.log'], {env});
1111
const connection = rpc.createMessageConnection(new rpc.StreamMessageReader(childProcess.stdout),new rpc.StreamMessageWriter(childProcess.stdin));
1212

1313
connection.onClose(() => console.error('Closed'));

pythonFiles/datascience/daemon/__main__.py renamed to pythonFiles/vscode_datascience_helpers/daemon/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def add_arguments(parser):
2020

2121
parser.add_argument(
2222
"--daemon-module",
23-
default="datascience.daemon.daemon_python",
23+
default="vscode_datascience_helpers.daemon.daemon_python",
2424
help="Daemon Module",
2525
)
2626

pythonFiles/datascience/daemon/daemon_python.py renamed to pythonFiles/vscode_datascience_helpers/daemon/daemon_python.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import traceback
99
import runpy
1010
import importlib
11-
from datascience.daemon.daemon_output import (
11+
from vscode_datascience_helpers.daemon.daemon_output import (
1212
CustomWriter,
1313
IORedirector,
1414
get_io_buffers,
@@ -63,7 +63,7 @@ def _decorator(self, *args, **kwargs):
6363

6464
class PythonDaemon(MethodDispatcher):
6565
""" Base Python Daemon with simple methods to check if a module exists, get version info and the like.
66-
To add additional methods, please create a separate class based off this and pass in the arg `--daemon-module` to `datascience.daemon`.
66+
To add additional methods, please create a separate class based off this and pass in the arg `--daemon-module` to `vscode_datascience_helpers.daemon`.
6767
"""
6868

6969
def __init__(self, rx, tx):

0 commit comments

Comments
 (0)