Skip to content

Commit

Permalink
vscode python merge v2024.14.1 (#5052)
Browse files Browse the repository at this point in the history
superseding #4670 since i really messed up git gymnastics there 😩 see
other PR for details/review

---------

Signed-off-by: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com>
Co-authored-by: positron-bot[bot] <173392469+positron-bot[bot]@users.noreply.github.com>
Co-authored-by: sharon <sharon-wang@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 16, 2024
1 parent 67cf79b commit f786b01
Show file tree
Hide file tree
Showing 308 changed files with 6,053 additions and 2,972 deletions.
1 change: 1 addition & 0 deletions extensions/positron-python/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"no-control-regex": "off",
"no-extend-native": "off",
"no-multi-str": "off",
"no-shadow": "off",
"no-param-reassign": "off",
"no-prototype-builtins": "off",
"no-restricted-syntax": [
Expand Down
2 changes: 1 addition & 1 deletion extensions/positron-python/.github/actions/lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ runs:

- name: Run Ruff
run: |
python -m pip install -U ruff
python -m pip install -U ruff==0.6.3
python -m ruff check .
python -m ruff format --check
working-directory: python_files
Expand Down
18 changes: 11 additions & 7 deletions extensions/positron-python/.github/release_plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ Feature freeze is Monday @ 17:00 America/Vancouver, XXX XX. At that point, commi

| Month | Primary | Secondary |
|:----------|:----------|:------------|
| ~~January~~ | ~~Eleanor~~ | ~~Karthik~~ |
| ~~February~~ | ~~Kartik~~ | ~~Anthony~~ |
| ~~March~~ | ~~Karthik~~ | ~~Eleanor~~ |
| ~~April~~ | ~~Paula~~ | ~~Eleanor~~ |
| May | Anthony | Karthik |
| June | Eleanor | Paula |
| ~~January~~ | ~~Eleanor~~ | ~~Karthik~~ |
| ~~February~~ | ~~Kartik~~ | ~~Anthony~~ |
| ~~March~~ | ~~Karthik~~ | ~~Eleanor~~ |
| ~~April~~ | ~~Paula~~ | ~~Eleanor~~ |
| ~~May~~ | ~~Anthony~~ | ~~Karthik~~ |
| ~~June~~ | ~~Karthik~~ | ~~Eleanor~~ |
| July | Anthony | Karthik |
| August | Paula | Anthony |
| September | Anthony | Eleanor |
| October | Paula | Karthik |
| November | Eleanor | Paula |
| December | Karthik | Anthony |
| December | Eleanor | Anthony |

Paula: 3 primary, 2 secondary
Eleanor: 3 primary (2 left), 3 secondary (2 left)
Expand All @@ -40,6 +40,9 @@ NOTE: the number of this release is in the issue title and can be substituted in

- [ ] checkout to `main` on your local machine and run `git fetch` to ensure your local is up to date with the remote repo.
- [ ] Create a new branch called **`bump-release-[YYYY.minor]`**.
- [ ] Update `pet`:
- [ ] Go to the [pet](https://github.com/microsoft/python-environment-tools) repo and check `main` and latest `release/*` branch. If there are new changes in `main` then create a branch called `release/YYYY.minor` (matching python extension release `major.minor`).
- [ ] Update `build\azure-pipeline.stable.yml` to point to the latest `release/YYYY.minor` for `python-environment-tools`.
- [ ] Change the version in `package.json` to the next **even** number and switch the `-dev` to `-rc`. (🤖)
- [ ] Run `npm install` to make sure `package-lock.json` is up-to-date _(you should now see changes to the `package.json` and `package-lock.json` at this point which update the version number **only**)_. (🤖)
- [ ] Update `ThirdPartyNotices-Repository.txt` as appropriate. You can check by looking at the [commit history](https://github.com/microsoft/vscode-python/commits/main) and scrolling through to see if there's anything listed there which might have pulled in some code directly into the repository from somewhere else. If you are still unsure you can check with the team.
Expand Down Expand Up @@ -111,6 +114,7 @@ NOTE: this PR should make all CI relating to `main` be passing again (such as th
- [ ] Create a branch against **`release/YYYY.minor`** called **`release-[YYYY.minor.point]`**.
- [ ] Bump the point version number in the `package.json` to the next `YYYY.minor.point`
- [ ] Run `npm install` to make sure `package-lock.json` is up-to-date _(you should now see changes to the `package.json` and `package-lock.json` only relating to the new version number)_ . (🤖)
- [ ] If Point Release is due to an issue in `pet`. Update `build\azure-pipeline.stable.yml` to point to the branch `release/YYYY.minor` for `python-environment-tools` with the fix or decided by the team.
- [ ] Create a PR from this branch against `release/YYYY.minor`
- [ ] **Rebase** and merge this PR into the release branch
- [ ] Create a draft GitHub release for the release notes (🤖) ❄️
Expand Down
7 changes: 7 additions & 0 deletions extensions/positron-python/.github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ jobs:
- name: Install test requirements
run: python -m pip install --upgrade -r build/test-requirements.txt

- name: Rust Tool Chain setup
uses: dtolnay/rust-toolchain@stable

- name: Build Native Binaries
run: nox --session native_build
shell: bash

- name: Install functional test requirements
run: python -m pip install --upgrade -r ./build/functional-test-requirements.txt
if: matrix.test-suite == 'functional'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- name: Run info-needed Closer
uses: ./actions/needs-more-info-closer
with:
token: ${{secrets.GITHUB_TOKEN}}
label: info-needed
closeDays: 30
closeComment: "Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off. \n\nHappy Coding!"
Expand Down
18 changes: 18 additions & 0 deletions extensions/positron-python/.github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,13 @@ jobs:
- name: Install test requirements
run: python -m pip install --upgrade -r build/test-requirements.txt

- name: Rust Tool Chain setup
uses: dtolnay/rust-toolchain@stable

- name: Build Native Binaries
run: nox --session native_build
shell: bash

- name: Install functional test requirements
run: python -m pip install --upgrade -r ./build/functional-test-requirements.txt
if: matrix.test-suite == 'functional'
Expand Down Expand Up @@ -506,6 +513,17 @@ jobs:
- name: Install Jedi requirements
run: python scripts/vendor.py

- name: Install build pre-requisite
run: python -m pip install wheel nox
shell: bash

- name: Rust Tool Chain setup
uses: dtolnay/rust-toolchain@stable

- name: Build Native Binaries
run: nox --session native_build
shell: bash

- name: Install test requirements
run: python -m pip install --upgrade -r build/test-requirements.txt

Expand Down
27 changes: 6 additions & 21 deletions extensions/positron-python/build/azure-pipeline.pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ resources:
ref: main
endpoint: Monaco

- repository: python-environment-tools
type: github
name: microsoft/python-environment-tools
ref: main
endpoint: Monaco


parameters:
- name: publishExtension
displayName: 🚀 Publish Extension
Expand All @@ -38,11 +31,7 @@ extends:
ghCreateTag: false
standardizedVersioning: true
l10nSourcePaths: ./src/client
sourceRepositoriesToScan:
include:
- repository: python-environment-tools
exclude:
- repository: translations
needsTools: true

buildPlatforms:
- name: Linux
Expand Down Expand Up @@ -76,10 +65,6 @@ extends:
vsceTarget: win32-x64

buildSteps:
- checkout: self
displayName: Checkout Python Extension
path: ./s

- task: NodeTool@0
inputs:
versionSpec: '18.17.1'
Expand All @@ -104,9 +89,6 @@ extends:
- script: nox --session install_python_libs
displayName: Install Jedi, get-pip, etc

# - script: python ./build/update_ext_version.py --for-publishing
# displayName: Update build number

- script: python ./build/update_package_file.py
displayName: Update telemetry in package.json

Expand All @@ -116,9 +98,12 @@ extends:
- script: npx gulp prePublishBundle
displayName: Build

- checkout: python-environment-tools
- script: nox --session azure_pet_checkout
displayName: Checkout python-environment-tools
path: ./s/python-env-tools
env:
PYTHON_ENV_TOOLS_DEST: $(Build.SourcesDirectory)
PYTHON_ENV_TOOLS_REF: main
PYTHON_ENV_TOOLS_TEMP: $(Agent.TempDirectory)

- script: nox --session azure_pet_build_before
displayName: Enable cargo config for azure
Expand Down
23 changes: 6 additions & 17 deletions extensions/positron-python/build/azure-pipeline.stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ resources:
ref: main
endpoint: Monaco

- repository: python-environment-tools
type: github
name: microsoft/python-environment-tools
ref: release/latest
endpoint: Monaco

parameters:
- name: publishExtension
displayName: 🚀 Publish Extension
Expand All @@ -31,11 +25,7 @@ extends:
parameters:
publishExtension: ${{ parameters.publishExtension }}
l10nSourcePaths: ./src/client
sourceRepositoriesToScan:
include:
- repository: python-environment-tools
exclude:
- repository: translations
needsTools: true

buildPlatforms:
- name: Linux
Expand Down Expand Up @@ -69,10 +59,6 @@ extends:
vsceTarget: win32-x64

buildSteps:
- checkout: self
displayName: Checkout Python Extension
path: ./s

- task: NodeTool@0
inputs:
versionSpec: '18.17.1'
Expand Down Expand Up @@ -106,9 +92,12 @@ extends:
- script: npx gulp prePublishBundle
displayName: Build

- checkout: python-environment-tools
- script: nox --session azure_pet_checkout
displayName: Checkout python-environment-tools
path: ./s/python-env-tools
env:
PYTHON_ENV_TOOLS_DEST: $(Build.SourcesDirectory)
PYTHON_ENV_TOOLS_REF: release/2024.14
PYTHON_ENV_TOOLS_TEMP: $(Agent.TempDirectory)

- script: nox --session azure_pet_build_before
displayName: Enable cargo config for azure
Expand Down
3 changes: 2 additions & 1 deletion extensions/positron-python/build/ci/addEnvPath.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

#Adds the virtual environment's executable path to json file

import json,sys
import json
import sys
import os.path
jsonPath = sys.argv[1]
key = sys.argv[2]
Expand Down
3 changes: 3 additions & 0 deletions extensions/positron-python/build/test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ freezegun

# testing custom pytest plugin require the use of named pipes
namedpipe; platform_system == "Windows"

# typing for Django files
django-stubs
2 changes: 1 addition & 1 deletion extensions/positron-python/build/update_ext_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def main(package_json: pathlib.Path, argv: Sequence[str]) -> None:
raise ValueError(
f"Major version [{major}] must be the current year [{current_year}].",
f"If changing major version after new year's, change to {current_year}.1.0",
f"Minor version must be updated based on release or pre-release channel.",
"Minor version must be updated based on release or pre-release channel.",
)

if args.release and not is_even(minor):
Expand Down
94 changes: 65 additions & 29 deletions extensions/positron-python/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
EXT_ROOT = pathlib.Path(__file__).parent


def delete_dir(path: pathlib.Path, ignore_errors=None):
attempt = 0
known = []
while attempt < 5:
try:
shutil.rmtree(os.fspath(path), ignore_errors=ignore_errors)
return
except PermissionError as pe:
if os.fspath(pe.filename) in known:
break
print(f"Changing permissions on {pe.filename}")
os.chmod(pe.filename, 0o666)

shutil.rmtree(os.fspath(path))

@nox.session()
def install_python_libs(session: nox.Session):
requirements = [
Expand Down Expand Up @@ -48,6 +63,45 @@ def install_python_libs(session: nox.Session):
if pathlib.Path("./python_files/lib/temp").exists():
shutil.rmtree("./python_files/lib/temp")

@nox.session()
def azure_pet_checkout(session: nox.Session):
branch = os.getenv("PYTHON_ENV_TOOLS_REF", "main")

# dest dir should be <vscode-python repo root>/python-env-tools
dest_dir = (pathlib.Path(os.getenv("PYTHON_ENV_TOOLS_DEST")) / "python-env-tools").resolve()

# temp dir should be <agent temp dir>
temp_dir = (pathlib.Path(os.getenv("PYTHON_ENV_TOOLS_TEMP")) / "python-env-tools").resolve()
session.log(f"Cloning python-environment-tools to {temp_dir}")
temp_dir.mkdir(0o766, parents=True, exist_ok=True)

try:
with session.cd(temp_dir):
session.run("git", "init", external=True)
session.run(
"git",
"remote",
"add",
"origin",
"https://github.com/microsoft/python-environment-tools",
external=True,
)
session.run("git", "fetch", "origin", branch, external=True)
session.run(
"git", "checkout", "--force", "-B", branch, f"origin/{branch}", external=True
)
delete_dir(temp_dir / ".git")
delete_dir(temp_dir / ".github")
delete_dir(temp_dir / ".vscode")
(temp_dir / "CODE_OF_CONDUCT.md").unlink()
shutil.move(os.fspath(temp_dir), os.fspath(dest_dir))
except PermissionError as e:
print(f"Permission error: {e}")
if not dest_dir.exists():
raise
finally:
delete_dir(temp_dir, ignore_errors=True)


@nox.session()
def azure_pet_build_before(session: nox.Session):
Expand Down Expand Up @@ -132,37 +186,19 @@ def native_build(session: nox.Session):
vscode_ignore.write_text("\n".join(filtered_lines) + "\n", encoding="utf-8")


def delete_dir(path: pathlib.Path, ignore_errors=None):
attempt = 0
known = []
while attempt < 5:
try:
shutil.rmtree(os.fspath(path), ignore_errors=ignore_errors)
return
except PermissionError as pe:
if os.fspath(pe.filename) in known:
break
print(f"Changing permissions on {pe.filename}")
os.chmod(pe.filename, 0o666)

shutil.rmtree(os.fspath(path))


@nox.session()
def checkout_native(session: nox.Session):
dest = (pathlib.Path.cwd() / "python-env-tools").resolve()
if dest.exists():
shutil.rmtree(os.fspath(dest))

tempdir = os.getenv("TEMP") or os.getenv("TMP") or "/tmp"
tempdir = pathlib.Path(tempdir) / str(uuid.uuid4()) / "python-env-tools"
tempdir.mkdir(0o666, parents=True)

session.log(f"Temp dir: {tempdir}")
temp_dir = os.getenv("TEMP") or os.getenv("TMP") or "/tmp"
temp_dir = pathlib.Path(temp_dir) / str(uuid.uuid4()) / "python-env-tools"
temp_dir.mkdir(0o766, parents=True)

session.log(f"Cloning python-environment-tools to {tempdir}")
session.log(f"Cloning python-environment-tools to {temp_dir}")
try:
with session.cd(tempdir):
with session.cd(temp_dir):
session.run("git", "init", external=True)
session.run(
"git",
Expand All @@ -176,17 +212,17 @@ def checkout_native(session: nox.Session):
session.run(
"git", "checkout", "--force", "-B", "main", "origin/main", external=True
)
delete_dir(tempdir / ".git")
delete_dir(tempdir / ".github")
delete_dir(tempdir / ".vscode")
(tempdir / "CODE_OF_CONDUCT.md").unlink()
shutil.move(os.fspath(tempdir), os.fspath(dest))
delete_dir(temp_dir / ".git")
delete_dir(temp_dir / ".github")
delete_dir(temp_dir / ".vscode")
(temp_dir / "CODE_OF_CONDUCT.md").unlink()
shutil.move(os.fspath(temp_dir), os.fspath(dest))
except PermissionError as e:
print(f"Permission error: {e}")
if not dest.exists():
raise
finally:
delete_dir(tempdir.parent, ignore_errors=True)
delete_dir(temp_dir.parent, ignore_errors=True)


@nox.session()
Expand Down
Loading

0 comments on commit f786b01

Please sign in to comment.