Skip to content
Open
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
8 changes: 0 additions & 8 deletions .basedpyright/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1733,14 +1733,6 @@
"lineCount": 1
}
},
{
"code": "reportUnusedCallResult",
"range": {
"startColumn": 12,
"endColumn": 111,
"lineCount": 1
}
},
{
"code": "reportPossiblyUnboundVariable",
"range": {
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
BROWSER_NPM_PACKAGE_DIR: packages/browser-pyright
# prevent uv from constantly reinstalling the project and overwriting docstubs
UV_NO_SYNC: true
GG_GITHUB_TOKEN: ${{ github.token }}

on: push

Expand Down Expand Up @@ -65,8 +66,15 @@ jobs:
name: docstubs-linux-and-macos
path: docstubs
- name: generate docstubs for each python version
run: ./build/generateAllDocstubs.sh
shell: bash
# https://github.com/eirikb/gg/issues/291
run: |
$ErrorActionPreference = "Stop"
foreach ($pythonVersion in "3.14", "3.13", "3.12", "3.11", "3.10", "3.9") {
./gg.cmd uv sync --only-group=docstubs --no-install-project --python $pythonVersion
./gg.cmd uv run --no-sync build/py3_8/generate_docstubs.py
}
# https://github.com/eirikb/gg/issues/292
shell: powershell
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: docstubs
Expand Down Expand Up @@ -97,7 +105,7 @@ jobs:
name: docstubs
path: docstubs

- run: ./pw uv sync --config-setting regenerate_docstubs=false
- run: ./gg.cmd uv sync --config-setting regenerate_docstubs=false

- name: add pyprojectx and npm scripts to PATH
# using both relative and absolute path for npm scripts because some binaries are in package-specific node_modules/.bin
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
env:
REPO_KEY: ${{ secrets.GH_TOKEN }}
USERNAME: github-actions[bot]
GG_GITHUB_TOKEN: ${{ github.token }}
steps:
- name: Checkout
# zizmor: ignore[artipacked]
Expand All @@ -44,13 +45,13 @@ jobs:
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: install dependencies
run: ./pw uv sync
run: ./gg.cmd uv sync
- name: deploy dev docs
if: github.ref == 'refs/heads/main'
run: ./pw uv run mike deploy --push --update-aliases dev
run: ./gg.cmd uv run mike deploy --push --update-aliases dev
- name: deploy release docs
if: github.ref_type == 'tag'
# zizmor: ignore[template-injection]
run: |
./pw uv run mike deploy --push --update-aliases ${{ github.ref_name }} latest
./pw uv run mike set-default --push latest
./gg.cmd uv run mike deploy --push --update-aliases ${{ github.ref_name }} latest
./gg.cmd uv run mike set-default --push latest
7 changes: 4 additions & 3 deletions .github/workflows/mypy_primer_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ name: Run mypy_primer on PR

env:
PYRIGHT_DISABLE_GITHUB_ACTIONS_OUTPUT: true
GG_GITHUB_TOKEN: ${{ github.token }}

on:
# Run on the creation or update of a PR.
Expand Down Expand Up @@ -55,11 +56,11 @@ jobs:
persist-credentials: false
submodules: true
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
- name: Install dependencies
- name: add gg aliases to PATH
run: |
cd pyright_to_test
./pw --install-context mypy_primer
realpath ./.pyprojectx/mypy_primer >> $GITHUB_PATH
realpath ./gg >> $GITHUB_PATH
- run: uv --version
- name: Run mypy_primer
shell: bash
env:
Expand Down
62 changes: 37 additions & 25 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
GG_GITHUB_TOKEN: ${{ github.token }}

jobs:
static_checks:
runs-on: ubuntu-latest
Expand All @@ -19,23 +22,22 @@ jobs:
persist-credentials: false
submodules: true # needed to typecheck mypy_primer

# need to use pw script at least once even when activating the context so that the wrapper installs pyprojectx
- run: ./pw uv sync --locked
- name: add gg aliases to PATH
run: realpath ./gg >> $GITHUB_PATH

- name: activate pyprojectx context
run: realpath ./.pyprojectx/main >> $GITHUB_PATH
- run: uv sync --locked

- name: typescript typecheck
run: uv run npm run typecheck
run: pnpm run typecheck

- name: zizmor
# intentionally exclude workflows from the mypy_primer submodule. https://github.com/zizmorcore/zizmor/issues/784
run: uv run zizmor .github --persona=auditor

- run: uv run npm run check
- run: pnpm run check

- name: python typecheck
run: uv run npm run typecheck-python
run: pnpm run typecheck-python

- name: ruff check
run: uv run ruff check --output-format github
Expand All @@ -44,7 +46,7 @@ jobs:
run: uv run ruff format --check --diff

- name: pylint
run: uv run npm run pylint
run: pnpm run pylint

- name: validate docs
run: uv run mkdocs build --strict
Expand All @@ -53,10 +55,18 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]

name: Test ${{ matrix.os }}
runs-on: ${{ matrix.os }}
os:
- name: macos-latest
shell: bash
# https://github.com/eirikb/gg/issues/291
# https://github.com/eirikb/gg/issues/292
- name: windows-latest
shell: powershell
- name: ubuntu-latest
shell: bash

name: Test ${{ matrix.os.name }}
runs-on: ${{ matrix.os.name }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
Expand All @@ -65,24 +75,26 @@ jobs:
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
id: install_python

- run: ./pw uv sync
- run: ./gg.cmd uv sync
shell: ${{ matrix.os.shell }}

# ideally we would do the same thing with ./node_modules/.bin to ensure that the version of node from nodejs-wheel
# is always used, but it seems to be impossible to prevent github actions from using its own node version
- name: add pyprojectx to PATH (linux)
if: runner.os != 'Windows'
run: |
realpath ./.pyprojectx/main >> $GITHUB_PATH
- name: add pyprojectx to PATH (windows)
if: runner.os == 'Windows'
run: |
echo (resolve-path "./.pyprojectx/main").path | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# currently commented out because this doesn't work on macos, see https://github.com/eirikb/gg/issues/289
# - name: add gg aliases to PATH (linux/macos)
# if: runner.os != 'Windows'
# run: |
# realpath ./gg >> $GITHUB_PATH
# - name: add gg aliases to PATH (windows)
# if: runner.os == 'Windows'
# run: |
# echo (resolve-path "./gg").path | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: python tests
run: uv run npm run test-python -- -m "not needs_all_docstubs"
run: ./gg.cmd uv run npm run test-python -- -m "not needs_all_docstubs"

- name: npm test (pyright-internal)
run: uv run npm test
run: ../../gg.cmd uv run npm test
working-directory: packages/pyright-internal

# TODO: all tests run in a venv now so i dont think any of this stuff is needed anymore
Expand Down Expand Up @@ -111,13 +123,13 @@ jobs:
env:
CI_IMPORT_TEST_VENVPATH: '../../'
CI_IMPORT_TEST_VENV: '.venv'
run: uv run npm run test:imports
run: ../../gg.cmd pnpm run test:imports
working-directory: packages/pyright-internal

- name: Run import tests with pythonpath
env:
CI_IMPORT_TEST_PYTHONPATH: ${{env.python_venv_path}}
run: uv run npm run test:imports
run: ../../gg.cmd pnpm run test:imports
working-directory: packages/pyright-internal

required:
Expand Down
14 changes: 6 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
},
"explorer.compactFolders": false,
"search.exclude": {
"pw": true
"gg.cmd": true
},
"python.terminal.activateEnvInCurrentTerminal": true,
"editor.acceptSuggestionOnCommitCharacter": false,
Expand All @@ -84,20 +84,20 @@
// even though python.terminal.activateEnvInCurrentTerminal is enabled, we still need to add the venv's script folder to the PATH
// because vscode's npm tasks do not run with the activated venv
"terminal.integrated.env.windows": {
"PATH": "${workspaceFolder}/.pyprojectx/main;${workspaceFolder}/node_modules/.bin;${workspaceFolder}/.venv/Scripts;${env:PATH}"
"PATH": "${workspaceFolder}/gg;${workspaceFolder}/node_modules/.bin;${workspaceFolder}/.venv/Scripts;${env:PATH}"
},
"terminal.integrated.env.osx": {
"PATH": "${workspaceFolder}/.pyprojectx/main:${workspaceFolder}/node_modules/.bin:${workspaceFolder}/.venv/bin:${env:PATH}"
"PATH": "${workspaceFolder}/gg:${workspaceFolder}/node_modules/.bin:${workspaceFolder}/.venv/bin:${env:PATH}"
},
"terminal.integrated.env.linux": {
"PATH": "${workspaceFolder}/.pyprojectx/main:${workspaceFolder}/node_modules/.bin:${workspaceFolder}/.venv/bin:${env:PATH}"
"PATH": "${workspaceFolder}/gg:${workspaceFolder}/node_modules/.bin:${workspaceFolder}/.venv/bin:${env:PATH}"
},
"task.problemMatchers.neverPrompt": true,
"editor.unicodeHighlight.nonBasicASCII": true,
"ruff.nativeServer": true,
"js/ts.inlayHints.parameterNames.enabled": "literals",
"js/ts.inlayHints.enumMemberValues.enabled": true,
"jest.jestCommandLine": "node_modules/.bin/pnpm run jest",
"jest.jestCommandLine": "./gg.cmd pnpm run jest",
"jest.useJest30": true,
"files.readonlyInclude": {
".pdm-build/**/*": true,
Expand All @@ -112,9 +112,7 @@
"docstubs/**/*": true,
"pnpm-lock.yaml": true,
"uv.lock": true,
"pw.lock": true,
"pw": true,
"pw.bat": true
"gg.cmd": true,
},
// package.json file copied into the pypi package
// this is a top-level folder but the ** is still needed due to https://github.com/microsoft/vscode/issues/92114
Expand Down
13 changes: 7 additions & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,19 @@
{
"label": "install dependencies",
"type": "shell",
"command": "./pw",
"command": "uv",
// need to always reinstall the current project because docstubs may be outdated
"args": ["uv", "sync", "--reinstall-package", "basedpyright"],
"args": ["sync", "--reinstall-package", "basedpyright"],
"presentation": {
"clear": true
},
"problemMatcher": [],
// TODO: don't think this is needed anymore since switching to gg, but i don't dev on windows anymore so cbf testing it
// https://github.com/microsoft/vscode/issues/160891#issuecomment-2915280629
"windows": {
"command": "&'${command:python.interpreterPath}'",
"args": ["pw", "uv", "sync", "--reinstall-package", "basedpyright"]
}
// "windows": {
// "command": "&'${command:python.interpreterPath}'",
// "args": ["pw", "uv", "sync", "--reinstall-package", "basedpyright"]
// }
},
{
"label": "bump version",
Expand Down
4 changes: 2 additions & 2 deletions build/generateAllDocstubs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set -e
for pythonVersion in 3.14 3.13 3.12 3.11 3.10 3.9; do
./pw uv sync --only-group=docstubs --no-install-project --python $pythonVersion
./pw uv run --no-sync build/py3_8/generate_docstubs.py
./gg.cmd uv sync --only-group=docstubs --no-install-project --python $pythonVersion
./gg.cmd uv run --no-sync build/py3_8/generate_docstubs.py
done
2 changes: 1 addition & 1 deletion docs/development/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ we recommend using vscode, as there are project configuration files in the repo

1. hit `F1` > `Tasks: Run task` > `install dependencies`, or run the following command:
```
./pw uv sync
./gg.cmd uv sync
```
this will install all dependencies required for the project (pyprojectx, uv, node, typescript, etc.). all dependencies are installed locally to `./.venv` and `./node_modules`
2. press "Yes" when prompted by vscode to use the newly created virtualenv
Expand Down
2 changes: 1 addition & 1 deletion docs/development/localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Run the script:

```shell
# use uv
./pw uv run build/py_latest/localization_helper.py
./gg.cmd uv run build/py_latest/localization_helper.py
# or from inside the venv
npm run localization-helper
```
Expand Down
Binary file added gg.cmd
Binary file not shown.
5 changes: 5 additions & 0 deletions gg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[aliases]
uv = "gh/astral-sh/uv@0.11.26"
pnpm = "gh/pnpm/pnpm@11.9"
# we run mypy primer in a separate isolated venv because it can't run in the same venv as the version of basedpyright it's testing
mypy_primer = "uv tool run --from ./mypy_primer mypy_primer"
1 change: 1 addition & 0 deletions gg/mypy_primer
1 change: 1 addition & 0 deletions gg/mypy_primer.cmd
1 change: 1 addition & 0 deletions gg/pnpm
1 change: 1 addition & 0 deletions gg/pnpm.cmd
1 change: 1 addition & 0 deletions gg/uv
1 change: 1 addition & 0 deletions gg/uv.cmd
2 changes: 1 addition & 1 deletion mypy_primer
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"run:langserver": "pnpm run build:cli:dev && node packages/pyright/langserver.index.js --stdio",
"jest": "cd packages/pyright-internal && node_modules/.bin/jest",
"update-python-deps": "uv sync --upgrade",
"update-pyprojectx-lockfile": "python pw --lock",
"typecheck-python": "uv run --no-sync basedpyright",
"typecheck-python:writebaseline": "pnpm run typecheck-python --writebaseline",
"ruff-check": "uv run --no-sync ruff check --no-cache && uv run --no-sync ruff format --check --diff",
Expand Down
Loading
Loading