positron-python upstream merge
extensions/positron-python is a fork of microsoft/vscode-python. Each maintenance round applies the upstream diff between two release tags as one commit, then updates dependencies and CI. The risky part is not the conflicts. It is upstream behavior changes that land cleanly in code Positron depends on. So triage comes before applying, and behavior decisions go to the user.
Scripts are in .claude/skills/positron-python-upstream-merge/scripts/ (below: $S). Run them from the repo root on the user's feature branch. From step 2 on, the tree must be clean.
Inputs
START: the last upstream tag that was merged. Get it from the maintenance issue, or the title of the previous "upstream merge vX" PR.package.json's version is2026.99.0-devand does not tell you.END: the new upstream release tag.- Earlier rounds may have cherry-picked some upstream commits (for example dependabot bumps) past
START. The 3-way merge handles them: files come outALREADY_UPSTREAM, or conflict only where Positron has an older version of the same bump.
Workflow
1. Preview and triage (no changes to the tree)
bash $S/preview.sh START END [path-to-local-vscode-python-clone]
The script fetches the tags into refs/vscode-python/* (kept for apply.sh) and prints per-status counts and a report dir:
files.tsv: each upstream-changed file asCLEAN,AUTOMERGE[...],CONFLICT[...],NEW,LOCKFILE_KEPT, and so on, with the count of Positron blocks in our copy.commits.txt: upstream commits that touch files with Positron blocks. Read every one withgit show <sha>and look at its commit message, which often explains the reason.
commits.txt only covers files with Positron blocks. Also review these, which it can't flag:
git diff refs/vscode-python/START refs/vscode-python/END -- package.json build/ python_files/covers dependencies, contributions, test requirements, and the Python adapters.NEWfiles andAUTOMERGE[...positron_blocks=0]files undersrc/client/that Positron code calls. Usergfromsrc/client/positron/to find out.
For each change, find the Positron callers of what it changes, especially in src/client/positron/. Then put it in one of these groups:
| Group | Typical areas |
|---|---|
| High: changes behavior that Positron code depends on | interpreterService / getActiveInterpreter (positron/manager.ts starts a session from its result after onDidChangeInterpreter), new callers of _onConfigChanged() with no scope (Positron then defaults to startSession: true), activationManager, nativePythonFinder (PET), installers, python_files/posit kernel deps |
| Medium: build, toolchain, or CI | TypeScript, @vscode/test-electron, webpack plugins, build/test-requirements.txt, upstream .github/ changes |
| Low: inert in Positron | Environments extension (useEnvExtension() is forced to false), PYTHONSTARTUP/pythonrc.py/PyREPL (forced off in terminals/pythonStartup.ts), native REPL, Pylance-only paths, chat tools hidden with "when": "false", telemetry |
A "Low" area can stop being inert. Check that the Positron override still exists before you rely on it.
STOP and report to the user with the groups, a recommendation for each High item (take upstream, keep Positron behavior, or adapt), and a list of manual validation areas. Wait for their decisions before you apply.
2. Apply
bash $S/apply.sh START END
This runs git diff | git apply --3way into the subdirectory, keeps Positron's package-lock.json, and deletes new upstream files that Positron's .gitignore excludes (build artifacts). Conflicted files keep their markers.
3. Resolve conflicts
| Situation | Resolution |
|---|---|
| package.json version / description | Keep Positron's |
| Positron has an older version of the same bump (npm dep, action version, pinned requirement) | Take upstream |
| extensions/positron-python/.github/** | Take upstream. These files don't run in Positron CI; they are the reference for step 6 |
| Upstream edits lines inside a Positron block | Keep the Positron block. If the block holds commented-out upstream code, update that copy to the new upstream code so the next merge diffs cleanly |
| Upstream adds lines next to a Positron block | Keep both |
| Upstream removes code that a Positron block only existed to override | Take upstream and delete the Positron block that no longer has a purpose |
| A High item the user decided to keep in Positron | Implement it inside // --- Start Positron --- / // --- End Positron --- with a comment that explains why |
AUTOMERGE files with positron_blocks>0 merged silently. Read their diff too (git diff HEAD -- <file>): a clean textual merge can still change behavior around a Positron block.
Then run bash $S/check-markers.sh and fix everything it reports.
4. Commit the merge as positron-bot
GIT_AUTHOR_NAME="positron-bot[bot]" GIT_AUTHOR_EMAIL="173392469+positron-bot[bot]@users.noreply.github.com" \
GIT_COMMITTER_NAME="positron-bot[bot]" GIT_COMMITTER_EMAIL="173392469+positron-bot[bot]@users.noreply.github.com" \
git commit -m "vscode-python changes from START to END"
Put everything after this in separate commits under the user's name.
5. Rebuild and verify (commit: "update deps")
In extensions/positron-python:
npm installto regenerate the lockfile. Check whether each npmoverridesentry inpackage.jsonis still needed (npm ls <pkg>).npx tsc -p ./ --noEmit. Then, from the repo root, run the TS7 native compiler that Positron CI uses (build/lib/tsgo.ts). It is stricter than the extension's TypeScript 5.x. For example, it rejects an interface key that upstream declares twice. Command:node "$(dirname "$(node -p "require.resolve('@typescript/native/package.json')")")/bin/tsc" --project extensions/positron-python/tsconfig.json --pretty false --noEmit. If it reports errors in upstream code, fence the fix in a Positron block. Thennpm run lintandnpm run format-check. Fix withnpm run format-fix. Never use the repo-rootscripts/format.mts, which uses tabs; this extension uses 4 spaces.npx tsc -p ./(the unit tests run fromout/), thennpm run test:unittests. Narrow it with-- --grepwhile you iterate, and run everything at the end. Only*.unit.test.tsfiles run here; other*.test.tsfiles run in CI's extension-host job.- Python:
./scripts/check-python-quality.sh; pytest inpython_files/posit;python python_files/tests/run_all.py(CI runsuv run --active python_files/tests/run_all.py) if upstream changed thepython_files/adapters. For the last one, mirror thepositron-python-ci.ymljob:requirements.txtinstalled withpip -t python_files/lib/python, thenbuild/test-requirements.txt. Move the oldpython_files/lib/pythonto the Trash first:pip -twithout--upgradeskips existing package directories and leaves old code next to new metadata.
6. Mirror upstream CI into Positron (commit: "fix ci")
Compare git diff refs/vscode-python/START refs/vscode-python/END -- .github/ with .github/workflows/positron-python-ci.yml (repo root). Port the changes that affect what gets tested: Python or pytest versions, install order, test dependencies, timeouts. Keep the existing action pinning style of the Positron workflow.
7. Dependencies (the remaining checklist items)
- PET: compare
positron.externalDependencies.petinpackage.jsonwithgh release list --repo posit-dev/positron-pet-buildsand the newestrelease/*branch ofmicrosoft/python-environment-tools. If upstream has a newer release without a Positron build, tell the user. Do not trigger the positron-builds workflow yourself. - In
extensions/positron-python:(cd python_files/posit && uv lock --upgrade),uv run scripts/pip-compile-ipykernel.py, and the command inpython_files/positron_requirements/requirements.in. Leavepython_files/jedilsp_requirementsalone; it is an upstream file. - Use the exact command written in
requirements.in(it redirects with>), so the generated header only changes where the Python version changes. - From the repo root:
uv run $S/req_diff.py <commit-before-step-7>. The rootrequirements.txt(installed intopython_files/lib/python),ipykernel_requirements, andpositron_requirementsrows ship to users;uv.lockis the test environment. The ipykernel bundle goes on the kernel'sPYTHONPATHahead of the user's site-packages, so a bundled major bump replaces the user's version too. Constrain it inscripts/pip-compile-ipykernel.pyif common libraries exclude the new major. For each shippedMAJORrow, read the package changelog, check howpython_files/posituses the package, and add it to the PR's validation list. Also check that Positron code doesn't import a package that left the bundle. - Run the kernel tests the way the
positron-ipykernel-testsCI job does:uv pip install pipin each environment (vendor.pycallspython -m pip),uv run scripts/vendor.pyonce (concurrent runs race on_vendor/), then for each Python version,uv sync --active --inexact --frozen --project python_files/positandpytest python_files/posit. Include the oldest supported Python: its lock resolves closest to the bundled versions. If a requirements header still names a Python version Positron dropped, that is why this round's bump is large.
8. PR
Draft the PR body as a markdown file in the working directory. Do not post it without asking. Include: the upstream range and issue link, the user's decisions on High items, the MAJOR dependency jumps, the manual validation areas from step 1, and e2e tags (use the positron-pr-helper skill).
9. Full suite run
PR CI runs only the tagged e2e tests. An upstream merge needs a full run as well. The tests run in the private repo posit-dev/positron-builds, through its Full Suite lane (test-full-suite.yml). After the branch is pushed and the PR is open, ask the user, then start it:
gh workflow run test-full-suite.yml --repo posit-dev/positron-builds --ref main \
-f positron_ref="$(git rev-parse HEAD)" \
-f run_unit=true
The defaults run every e2e test of each lane and the extension-host suites, and run_unit=true adds the unit suites, so this covers unit, extension host, and e2e on Ubuntu (Electron and Chromium) and Windows, with the test credentials. A failed run posts to Slack (notify_on is failures_only by default). The commit must be pushed, and you give it by its full SHA. The Jupyter and Pyrefly lanes are off by default (run_e2e_jupyter=true, run_e2e_pyrefly=true). The Full Suite lane has no Windows extension-host lane at this time. If step 1 found risk in those areas, say so in the PR. Get the run ID and URL with gh run list --repo posit-dev/positron-builds --workflow test-full-suite.yml --branch main --limit 5 --json databaseId,url,createdAt, and put the URL in the PR description or a PR comment.
The run is not a required PR check, so nothing blocks the merge if it fails. Watch it in the background (gh run watch <id> --exit-status; it takes tens of minutes) and report the result to the user. Do not call the PR ready to merge until the run passes, or until the user has triaged each failure (use the e2e-failure-analyzer skill) as unrelated or fixed.
Common mistakes
- Treating a clean apply as a safe merge. The behavior changes are usually in
AUTOMERGEfiles and in commits whose code merged cleanly. - Taking upstream startup or performance shortcuts (timeouts, cached or last-known values, listeners that do nothing in VS Code) without checking callers in
src/client/positron/. Positron starts runtime sessions from interpreter events, which VS Code does not do. - Leaving the commented-out upstream copy inside a Positron block stale.
- Formatting extension files with the repo-root formatter.
- Merging on PR CI alone, without a full suite run (step 9).
- Bundling ipykernel or ipython major bumps without kernel tests and e2e coverage (Console, Variables, Plots, Help, debugging).