Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion extensions/positron-python/.github/release_plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ Feature freeze is Monday @ 17:00 America/Vancouver, XXX XX. At that point, commi
</details>


# Release candidate (Monday, XXX XX)
# Release candidate (Thursday, XXX XX)
NOTE: This Thursday occurs during TESTING week. Branching should be done during this week to freeze the release with only the correct changes. Any last minute fixes go in as candidates into the release branch and will require team approval.

Other:
NOTE: Third Party Notices are automatically added by our build pipelines using https://tools.opensource.microsoft.com/notice.
NOTE: the number of this release is in the issue title and can be substituted in wherever you see [YYYY.minor].

Expand Down
2 changes: 1 addition & 1 deletion extensions/positron-python/build/azure-pipeline.stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extends:
project: 'Monaco'
definition: 593
buildVersionToDownload: 'latestFromBranch'
branchName: 'refs/heads/release/2024.22'
branchName: 'refs/heads/release/2025.2'
targetPath: '$(Build.SourcesDirectory)/python-env-tools/bin'
artifactName: 'bin-$(vsceTarget)'
itemPattern: |
Expand Down
21,128 changes: 8,041 additions & 13,087 deletions extensions/positron-python/package-lock.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion extensions/positron-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,12 @@
"scope": "resource",
"type": "boolean"
},
"python.testing.autoTestDiscoverOnSavePattern": {
"default": "**/*.py",
"description": "%python.testing.autoTestDiscoverOnSavePattern.description%",
"scope": "resource",
"type": "string"
},
"python.testing.cwd": {
"default": null,
"description": "%python.testing.cwd.description%",
Expand Down Expand Up @@ -1916,7 +1922,7 @@
"get-port": "^5.1.1",
"gulp": "^5.0.0",
"gulp-typescript": "^5.0.0",
"mocha": "^9.2.2",
"mocha": "^11.1.0",
"mocha-junit-reporter": "^2.0.2",
"mocha-multi-reporters": "^1.1.7",
"node-has-native-dependencies": "^1.0.2",
Expand Down
3 changes: 2 additions & 1 deletion extensions/positron-python/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"python.command.python.configureTests.title": "Configure Tests",
"python.command.testing.rerunFailedTests.title": "Rerun Failed Tests",
"python.command.python.execSelectionInTerminal.title": "Run Selection/Line in Python Terminal",
"python.command.python.execInREPL.title": "Run Selection/Line in Python REPL",
"python.command.python.execInREPL.title": "Run Selection/Line in Native Python REPL",
"python.command.python.execSelectionInDjangoShell.title": "Run Selection/Line in Django Shell",
"python.command.python.execSelectionInConsole.title": "Run Selection in Console",
"python.command.python.reportIssue.title": "Report Issue...",
Expand Down Expand Up @@ -95,6 +95,7 @@
"python.terminal.focusAfterLaunch.description": "When launching a python terminal, whether to focus the cursor on the terminal.",
"python.terminal.launchArgs.description": "Python launch arguments to use when executing a file in the terminal.",
"python.testing.autoTestDiscoverOnSaveEnabled.description": "Enable auto run test discovery when saving a test file.",
"python.testing.autoTestDiscoverOnSavePattern.description": "Glob pattern used to determine which files are used by autoTestDiscoverOnSaveEnabled.",
"python.testing.cwd.description": "Optional working directory for tests.",
"python.testing.debugPort.description": "Port number used for debugging of tests.",
"python.testing.promptToConfigure.description": "Prompt to configure a test framework if potential tests directories are discovered.",
Expand Down
4 changes: 2 additions & 2 deletions extensions/positron-python/pythonExtensionApi/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ export type EnvironmentsChangeEvent = {

export type ActiveEnvironmentPathChangeEvent = EnvironmentPath & {
/**
* Workspace folder the environment changed for.
* Resource the environment changed for.
*/
readonly resource: WorkspaceFolder | undefined;
readonly resource: Resource | undefined;
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,16 @@
#
--only-binary :all:

psutil==6.1.1 \
--hash=sha256:018aeae2af92d943fdf1da6b58665124897cfc94faa2ca92098838f83e1b1bca \
--hash=sha256:0bdd4eab935276290ad3cb718e9809412895ca6b5b334f5a9111ee6d9aff9377 \
--hash=sha256:1924e659d6c19c647e763e78670a05dbb7feaf44a0e9c94bf9e14dfc6ba50468 \
--hash=sha256:33431e84fee02bc84ea36d9e2c4a6d395d479c9dd9bba2376c1f6ee8f3a4e0b3 \
--hash=sha256:384636b1a64b47814437d1173be1427a7c83681b17a450bfc309a1953e329603 \
--hash=sha256:6d4281f5bbca041e2292be3380ec56a9413b790579b8e593b1784499d0005dac \
--hash=sha256:8be07491f6ebe1a693f17d4f11e69d0dc1811fa082736500f649f79df7735303 \
--hash=sha256:8df0178ba8a9e5bc84fed9cfa61d54601b371fbec5c8eebad27575f1e105c0d4 \
--hash=sha256:97f7cb9921fbec4904f522d972f0c0e1f4fabbdd4e0287813b21215074a0f160 \
--hash=sha256:9ccc4316f24409159897799b83004cb1e24f9819b0dcf9c0b68bdcb6cefee6a8 \
--hash=sha256:b6e06c20c05fe95a3d7302d74e7097756d4ba1247975ad6905441ae1b5b66003 \
--hash=sha256:c777eb75bb33c47377c9af68f30e9f11bc78e0f07fbf907be4a5d70b2fe5f030 \
--hash=sha256:ca9609c77ea3b8481ab005da74ed894035936223422dc591d6772b147421f777 \
--hash=sha256:eaa912e0b11848c4d9279a93d7e2783df352b082f40111e078388701fd479e53 \
--hash=sha256:f35cfccb065fff93529d2afb4a2e89e363fe63ca1e4a5da22b603a85833c2649 \
--hash=sha256:fc0ed7fe2231a444fc219b9c42d0376e0a9a1a72f16c5cfa0f68d19f1a0663e8
psutil==7.0.0 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a major upgrade and psutil includes platform-specific binaries, we should double-check that this doesn't cause any platform-specific build issues after we've merged.

--hash=sha256:101d71dc322e3cffd7cea0650b09b3d08b8e7c4109dd6809fe452dfd00e58b25 \
--hash=sha256:1e744154a6580bc968a0195fd25e80432d3afec619daf145b9e5ba16cc1d688e \
--hash=sha256:1fcee592b4c6f146991ca55919ea3d1f8926497a713ed7faaf8225e174581e91 \
--hash=sha256:39db632f6bb862eeccf56660871433e111b6ea58f2caea825571951d4b6aa3da \
--hash=sha256:4b1388a4f6875d7e2aff5c4ca1cc16c545ed41dd8bb596cefea80111db353a34 \
--hash=sha256:4cf3d4eb1aa9b348dec30105c55cd9b7d4629285735a102beb4441e38db90553 \
--hash=sha256:84df4eb63e16849689f76b1ffcb36db7b8de703d1bc1fe41773db487621b6c17 \
--hash=sha256:a5f098451abc2828f7dc6b58d44b532b22f2088f4999a937557b603ce72b1993 \
--hash=sha256:ba3fcef7523064a6c9da440fc4d6bd07da93ac726b5733c29027d7dc95b39d99
# via ipykernel
tornado==6.4.2 \
--hash=sha256:072ce12ada169c5b00b7d92a99ba089447ccc993ea2143c9ede887e0937aa803 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,35 @@ backcall==0.2.0 \
comm==0.2.2 \
--hash=sha256:e6fb86cb70ff661ee8c9c14e7d36d6de3b4066f1441be4063df9c5009f0a64d3
# via ipykernel
debugpy==1.8.12 \
--hash=sha256:086b32e233e89a2740c1615c2f775c34ae951508b28b308681dbbb87bba97d06 \
--hash=sha256:22a11c493c70413a01ed03f01c3c3a2fc4478fc6ee186e340487b2edcd6f4180 \
--hash=sha256:274b6a2040349b5c9864e475284bce5bb062e63dce368a394b8cc865ae3b00c6 \
--hash=sha256:2ae5df899732a6051b49ea2632a9ea67f929604fd2b036613a9f12bc3163b92d \
--hash=sha256:36f4829839ef0afdfdd208bb54f4c3d0eea86106d719811681a8627ae2e53dd5 \
--hash=sha256:39dfbb6fa09f12fae32639e3286112fc35ae976114f1f3d37375f3130a820969 \
--hash=sha256:4703575b78dd697b294f8c65588dc86874ed787b7348c65da70cfc885efdf1e1 \
--hash=sha256:4ad9a94d8f5c9b954e0e3b137cc64ef3f579d0df3c3698fe9c3734ee397e4abb \
--hash=sha256:557cc55b51ab2f3371e238804ffc8510b6ef087673303890f57a24195d096e61 \
--hash=sha256:5cc45235fefac57f52680902b7d197fb2f3650112379a6fa9aa1b1c1d3ed3f02 \
--hash=sha256:696d8ae4dff4cbd06bf6b10d671e088b66669f110c7c4e18a44c43cf75ce966f \
--hash=sha256:7e94b643b19e8feb5215fa508aee531387494bf668b2eca27fa769ea11d9f498 \
--hash=sha256:88a77f422f31f170c4b7e9ca58eae2a6c8e04da54121900651dfa8e66c29901a \
--hash=sha256:898fba72b81a654e74412a67c7e0a81e89723cfe2a3ea6fcd3feaa3395138ca9 \
--hash=sha256:9649eced17a98ce816756ce50433b2dd85dfa7bc92ceb60579d68c053f98dff9 \
--hash=sha256:9af40506a59450f1315168d47a970db1a65aaab5df3833ac389d2899a5d63b3f \
--hash=sha256:a28ed481d530e3138553be60991d2d61103ce6da254e51547b79549675f539b7 \
--hash=sha256:a2ba7ffe58efeae5b8fad1165357edfe01464f9aef25e814e891ec690e7dd82a \
--hash=sha256:a4042edef80364239f5b7b5764e55fd3ffd40c32cf6753da9bda4ff0ac466018 \
--hash=sha256:b0232cd42506d0c94f9328aaf0d1d0785f90f87ae72d9759df7e5051be039738 \
--hash=sha256:b202f591204023b3ce62ff9a47baa555dc00bb092219abf5caf0e3718ac20e7c \
--hash=sha256:b5c6c967d02fee30e157ab5227706f965d5c37679c687b1e7bbc5d9e7128bd41 \
--hash=sha256:cbbd4149c4fc5e7d508ece083e78c17442ee13b0e69bfa6bd63003e486770f45 \
--hash=sha256:f30b03b0f27608a0b26c75f0bb8a880c752c0e0b01090551b9d87c7d783e2069 \
--hash=sha256:fdb3c6d342825ea10b90e43d7f20f01535a72b3a1997850c0c3cefa5c27a4a2c
debugpy==1.8.13 \
--hash=sha256:06859f68e817966723ffe046b896b1bd75c665996a77313370336ee9e1de3e90 \
--hash=sha256:2b8de94c5c78aa0d0ed79023eb27c7c56a64c68217d881bee2ffbcb13951d0c1 \
--hash=sha256:31abc9618be4edad0b3e3a85277bc9ab51a2d9f708ead0d99ffb5bb750e18503 \
--hash=sha256:32b6857f8263a969ce2ca098f228e5cc0604d277447ec05911a8c46cf3e7e307 \
--hash=sha256:3872ce5453b17837ef47fb9f3edc25085ff998ce63543f45ba7af41e7f7d370f \
--hash=sha256:3dae443739c6b604802da9f3e09b0f45ddf1cf23c99161f3a1a8039f61a8bb89 \
--hash=sha256:46abe0b821cad751fc1fb9f860fb2e68d75e2c5d360986d0136cd1db8cad4428 \
--hash=sha256:4caca674206e97c85c034c1efab4483f33971d4e02e73081265ecb612af65377 \
--hash=sha256:5268ae7fdca75f526d04465931cb0bd24577477ff50e8bb03dab90983f4ebd02 \
--hash=sha256:62f9b4a861c256f37e163ada8cf5a81f4c8d5148fc17ee31fb46813bd658cdcc \
--hash=sha256:63ca7670563c320503fea26ac688988d9d6b9c6a12abc8a8cf2e7dd8e5f6b6ea \
--hash=sha256:6fab771639332bd8ceb769aacf454a30d14d7a964f2012bf9c4e04c60f16e85b \
--hash=sha256:79ce4ed40966c4c1631d0131606b055a5a2f8e430e3f7bf8fd3744b09943e8e8 \
--hash=sha256:7d9a05efc6973b5aaf076d779cf3a6bbb1199e059a17738a2aa9d27a53bcc888 \
--hash=sha256:887d54276cefbe7290a754424b077e41efa405a3e07122d8897de54709dbe522 \
--hash=sha256:924464d87e7d905eb0d79fb70846558910e906d9ee309b60c4fe597a2e802590 \
--hash=sha256:a0bd87557f97bced5513a74088af0b84982b6ccb2e254b9312e29e8a5c4270eb \
--hash=sha256:acf39a6e98630959763f9669feddee540745dfc45ad28dbc9bd1f9cd60639391 \
--hash=sha256:cb56c2db69fb8df3168bc857d7b7d2494fed295dfdbde9a45f27b4b152f37520 \
--hash=sha256:d4ba115cdd0e3a70942bd562adba9ec8c651fe69ddde2298a1be296fc331906f \
--hash=sha256:dc7b77f5d32674686a5f06955e4b18c0e41fb5a605f5b33cf225790f114cfeec \
--hash=sha256:ea869fe405880327497e6945c09365922c79d2a1eed4c3ae04d77ac7ae34b2b5 \
--hash=sha256:ed93c3155fc1f888ab2b43626182174e457fc31b7781cd1845629303790b8ad1 \
--hash=sha256:eee02b2ed52a563126c97bf04194af48f2fe1f68bb522a312b05935798e922ff \
--hash=sha256:f14d2c4efa1809da125ca62df41050d9c7cd9cb9e380a2685d1e453c4d450ccb
# via ipykernel
decorator==5.1.1 \
--hash=sha256:b8c3f85900b9dc423225913c5aace94729fe1fa9763b38939a95226f02d37186
decorator==5.2.1 \
--hash=sha256:d316bb415a2d9e2d2b3abcc4084c6502fc09240e292cd76a76afc106a1c8e04a
# via ipython
executing==2.2.0 \
--hash=sha256:11387150cad388d62750327a53d3339fad4888b39a6fe233c3afbb54ecffd3aa
Expand Down
9 changes: 9 additions & 0 deletions extensions/positron-python/python_files/normalizeSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ def normalize_lines(selection):

# Insert a newline between each top-level statement, and append a newline to the selection.
source = "\n".join(statements) + "\n"
# If selection ends with trailing dictionary or list, remove last unnecessary newline.
if selection[-2] == "}" or selection[-2] == "]":
source = source[:-1]
# If the selection contains trailing return dictionary, insert newline to trigger execute.
if check_end_with_return_dict(selection):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this code so should double-check how this affects Cmd+Enter for lines like return {}. I doubt we've covered that in e2e tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked this out 👀 it looks like it will insert a newline in the script and in the console, but will still execute as expected.

Screen.Recording.2025-03-12.at.12.43.47.PM.mov

source = source + "\n"
except Exception:
# If there's a problem when parsing statements,
# append a blank line to end the block and send it as-is.
Expand All @@ -134,6 +138,11 @@ def normalize_lines(selection):
min_key = None


def check_end_with_return_dict(code):
stripped_code = code.strip()
return stripped_code.endswith("}") and "return {" in stripped_code.strip()


def check_exact_exist(top_level_nodes, start_line, end_line):
return [
node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,28 @@ geopandas==0.13.2; python_version < '3.9'
geopandas==1.0.1; python_version >= '3.9'
hvplot==0.11.2 ; python_version >= '3.9'
hvplot==0.8.0 ; python_version < '3.9'
ibis-framework[duckdb]==10.0.0; python_version >= '3.10'
ibis-framework[duckdb]==10.2.0; python_version >= '3.10'
ipykernel==6.29.5
ipython<=8.31.0
ipywidgets==8.1.5
lightning==2.3.2
lightning==2.3.2; python_version < '3.9'
lightning==2.5.0; python_version >= '3.9'
matplotlib==3.7.4; python_version < '3.9'
matplotlib==3.9.2; python_version == '3.9'
matplotlib==3.10.0; python_version >= '3.10'
matplotlib==3.10.1; python_version >= '3.10'
numpy==1.24.4; python_version < '3.9'
numpy==2.0.2; python_version == '3.9'
numpy==2.2.2; python_version >= '3.10'
numpy==2.2.3; python_version >= '3.10'
pandas==2.0.3; python_version < '3.9'
pandas==2.2.3; python_version >= '3.9'
plotly==6.0.0
polars==1.7.1; python_version < '3.9'
polars[timezone]==1.7.1; python_version < '3.9'
polars==1.22.0; python_version >= '3.9'
polars[timezone]==1.22.0; python_version >= '3.9' and sys_platform == 'win32'
polars==1.24.0; python_version >= '3.9'
polars[timezone]==1.24.0; python_version >= '3.9' and sys_platform == 'win32'
pyarrow==17.0.0; python_version < '3.13'
pyarrow==19.0.0; python_version >= '3.13'
pytest==8.3.4
pyarrow==19.0.1; python_version >= '3.13'
pytest==8.3.5
pytest-asyncio==0.23.8; python_version < '3.9'
pytest-asyncio==0.25.3; python_version >= '3.9'
pytest-mock==3.14.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,50 @@ def test_list_comp(self):
result = normalizeSelection.normalize_lines(src)

assert result == expected

def test_return_dict(self):
importlib.reload(normalizeSelection)
src = textwrap.dedent(
"""\
def get_dog(name, breed):
return {'name': name, 'breed': breed}
"""
)

expected = textwrap.dedent(
"""\
def get_dog(name, breed):
return {'name': name, 'breed': breed}

"""
)

result = normalizeSelection.normalize_lines(src)

assert result == expected

def test_return_dict2(self):
importlib.reload(normalizeSelection)
src = textwrap.dedent(
"""\
def get_dog(name, breed):
return {'name': name, 'breed': breed}

dog = get_dog('Ahri', 'Pomeranian')
print(dog)
"""
)

expected = textwrap.dedent(
"""\
def get_dog(name, breed):
return {'name': name, 'breed': breed}

dog = get_dog('Ahri', 'Pomeranian')
print(dog)
"""
)

result = normalizeSelection.normalize_lines(src)

assert result == expected
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,11 @@ def pytest_sessionfinish(session, exitstatus):
except NoSource:
# as per issue 24308 this best way to handle this edge case
continue
except Exception as e:
print(
f"Plugin error[vscode-pytest]: Skipping analysis of file: {file} due to error: {e}"
)
continue
lines_executable = {int(line_no) for line_no in analysis[1]}
lines_missed = {int(line_no) for line_no in analysis[3]}
lines_covered = lines_executable - lines_missed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"pytestPath": "placeholder",
"unittestArgs": "placeholder",
"unittestEnabled": true,
"autoTestDiscoverOnSaveEnabled": true
"autoTestDiscoverOnSaveEnabled": true,
"autoTestDiscoverOnSavePattern": "placeholder"
},
"terminal": {
"activateEnvironment": true,
Expand Down
13 changes: 11 additions & 2 deletions extensions/positron-python/src/client/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ import { IConfigurationService, Resource } from './common/types';
import { getDebugpyLauncherArgs } from './debugger/extension/adapter/remoteLaunchers';
import { IInterpreterService } from './interpreter/contracts';
import { IServiceContainer, IServiceManager } from './ioc/types';
import { JupyterExtensionIntegration } from './jupyter/jupyterIntegration';
import {
JupyterExtensionIntegration,
JupyterExtensionPythonEnvironments,
JupyterPythonEnvironmentApi,
} from './jupyter/jupyterIntegration';
import { traceError } from './logging';
import { IDiscoveryAPI } from './pythonEnvironments/base/locator';
import { buildEnvironmentApi } from './environmentApi';
Expand All @@ -36,11 +40,16 @@ export function buildApi(
const configurationService = serviceContainer.get<IConfigurationService>(IConfigurationService);
const interpreterService = serviceContainer.get<IInterpreterService>(IInterpreterService);
serviceManager.addSingleton<JupyterExtensionIntegration>(JupyterExtensionIntegration, JupyterExtensionIntegration);
serviceManager.addSingleton<JupyterExtensionPythonEnvironments>(
JupyterExtensionPythonEnvironments,
JupyterExtensionPythonEnvironments,
);
serviceManager.addSingleton<TensorboardExtensionIntegration>(
TensorboardExtensionIntegration,
TensorboardExtensionIntegration,
);
const jupyterIntegration = serviceContainer.get<JupyterExtensionIntegration>(JupyterExtensionIntegration);
const jupyterPythonEnvApi = serviceContainer.get<JupyterPythonEnvironmentApi>(JupyterExtensionPythonEnvironments);
const tensorboardIntegration = serviceContainer.get<TensorboardExtensionIntegration>(
TensorboardExtensionIntegration,
);
Expand Down Expand Up @@ -149,7 +158,7 @@ export function buildApi(
stop: (client: BaseLanguageClient): Promise<void> => client.stop(),
getTelemetryReporter: () => getTelemetryReporter(),
},
environments: buildEnvironmentApi(discoveryApi, serviceContainer),
environments: buildEnvironmentApi(discoveryApi, serviceContainer, jupyterPythonEnvApi),
};

// In test environment return the DI Container.
Expand Down
4 changes: 2 additions & 2 deletions extensions/positron-python/src/client/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ export type EnvironmentsChangeEvent = {

export type ActiveEnvironmentPathChangeEvent = EnvironmentPath & {
/**
* Workspace folder the environment changed for.
* Resource the environment changed for.
*/
readonly resource: WorkspaceFolder | undefined;
readonly resource: Resource | undefined;
};

/**
Expand Down
Loading
Loading