Skip to content

chore: Add formatting step in pyright-scip & update CI pipeline #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 15, 2025
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
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Format pyright-scip with prettier
47615dfee4d2beea57b3ba61f97c1f14d035c9f5
13 changes: 3 additions & 10 deletions .github/workflows/scip-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install asdf.
uses: asdf-vm/actions/setup@v2.1.0
- name: Cache asdf and asdf-managed tools.
uses: actions/cache@v4
id: asdf-cache
- name: Install mise
uses: jdx/mise-action@v2.4.4
with:
path: ${{ env.ASDF_DIR }}
key: asdf-${{ runner.os}}-${{ hashFiles('**/.tool-versions') }}
- name: Install asdf tools (if not cached).
if: steps.asdf-cache.outputs.cache-hit != 'true'
uses: asdf-vm/actions/install@v2.1.0
version: 2025.8.10
- name: Get npm cache directory
id: npm-cache
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
Expand Down
20 changes: 6 additions & 14 deletions .github/workflows/scip-snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
name: scip-snapshots
name: test

on:
push:
branches:
- main
- scip
pull_request:
branches:
- scip

jobs:
build:
check:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install asdf.
uses: asdf-vm/actions/setup@v2.1.0
- name: Cache asdf and asdf-managed tools.
uses: actions/cache@v4
id: asdf-cache
- name: Install mise
uses: jdx/mise-action@v2.4.4
with:
path: ${{ env.ASDF_DIR }}
key: asdf-${{ runner.os}}-${{ hashFiles('**/.tool-versions') }}
- name: Install asdf tools (if not cached).
if: steps.asdf-cache.outputs.cache-hit != 'true'
uses: asdf-vm/actions/install@v2.1.0
version: 2025.8.10
- name: Get npm cache directory
id: npm-cache
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/scip-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'formatting'

on:
push:
branches:
- main
- scip
pull_request:

jobs:
check:
runs-on: ubuntu-latest
name: check

steps:
- uses: actions/checkout@v3

- uses: jdx/mise-action@v2.4.4
with:
version: 2025.8.10

- run: npm install

- run: npm install
working-directory: packages/pyright-scip

- name: Check prettier formatting
run: npm run check:prettier
working-directory: packages/pyright-scip
1 change: 1 addition & 0 deletions packages/pyright-scip/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ module.exports = {
},
ignorePatterns: ['temp', 'lsif.ts', 'snapshots'],
rules: {},
root: true,
};
5 changes: 5 additions & 0 deletions packages/pyright-scip/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.md
*.markdown
dist/
node_modules/
snapshots/
26 changes: 26 additions & 0 deletions packages/pyright-scip/AGENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Agent Instructions for pyright-scip

## Development Commands

### Testing

- `npm test` - Run Jest tests
- `npm run check-snapshots` - Check snapshot tests
- `npm run update-snapshots` - Update snapshot tests

### Building

- `npm run webpack` - Development build
- `npm run build` - Production build
- `npm run watch` - Development build with watch mode

### Formatting

- `npm run fix:prettier` - Fix prettier formatting issues
- `npm run check:prettier` - Check prettier formatting

## Code Style

- Follow existing TypeScript patterns in the codebase
- Use the Sourcegraph ESLint config and Prettier config
- When modifying pyright-internal code, keep changes minimal and add `NOTE(scip-python):` prefix to comments
64 changes: 38 additions & 26 deletions packages/pyright-scip/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,41 @@
# Contributing to scip-python

- [Development](#development)
- [Installing dependencies](#installing-dependencies)
- [Building the code](#building-the-code)
- [Running tests](#running-tests)
- [Publishing releases](#publishing-releases)
- [Development](#development)
- [Installing dependencies](#installing-dependencies)
- [Building the code](#building-the-code)
- [Running tests](#running-tests)
- [Formatting](#formatting)
- [Publishing releases](#publishing-releases)

## Development

### Installing dependencies

1. Install [ASDF](https://asdf-vm.com/guide/getting-started.html).
1. Install [mise](https://mise.jdx.dev/getting-started.html).
2. Install the correct versions of Node and Python:

```bash
asdf plugin add nodejs
asdf plugin add python
mise plugin install nodejs
mise plugin install python
# Install appropriate Node and Python versions based on .tool-versions
asdf install
````
You may need to restart your shell for the changes to take effect.

NOTE: On Linux, ASDF may try to install Python from source instead of
using prebuilt binaries. In that case, you need to install a bunch of
other dependencies first:
```bash
sudo apt update
sudo apt install -y build-essential zlib1g-dev libssl-dev libbz2-dev libsqlite3-dev libncurses-dev libffi-dev readline-common libreadline-dev liblzma-dev
```
mise install
```

You may need to restart your shell for the changes to take effect.

3. Install dependencies:
```bash
# From the root of the repo
npm install
cd packages/pyright-scip
npm install
```
```bash
# From the root of the repo
npm install
cd packages/pyright-scip
npm install
```

All the other commands should be run from the `packages/pyright-scip`
subdirectory.

### Building the code


```bash
# Build in development mode once
npm run webpack
Expand Down Expand Up @@ -76,6 +71,7 @@ npm run check-snapshots
#### Filter specific snapshot tests

Use the `--filter-tests` flag to run only specific snapshot tests:

```bash
# Using npm scripts (note the -- to pass arguments)
npm run check-snapshots -- --filter-tests test1,test2,test3
Expand All @@ -86,6 +82,22 @@ Available snapshot tests can be found in `snapshots/input/`.
Using a different Python version other than the one specified
in `.tool-versions` may also lead to errors.

### Formatting

To check for formatting issues:

```bash
# Check prettier formatting
npm run check:prettier
```

To fix formatting issues:

```bash
# Fix prettier formatting issues
npm run fix:prettier
```

## Making changes to Pyright internals

When modifying code in the `pyright-internal` package:
Expand Down
8 changes: 6 additions & 2 deletions packages/pyright-scip/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ if (typeof module.setSourceMapsSupport === 'function') {
const nodeOptions = process.env.NODE_OPTIONS || '';
if (!nodeOptions.includes('--enable-source-maps')) {
if (nodeOptions) {
console.warn('Source maps support not available. Consider adding --enable-source-maps to the existing NODE_OPTIONS environment variable.');
console.warn(
'Source maps support not available. Consider adding --enable-source-maps to the existing NODE_OPTIONS environment variable.'
);
} else {
console.warn('Source maps support not available. Consider setting the NODE_OPTIONS environment variable to "--enable-source-maps".');
console.warn(
'Source maps support not available. Consider setting the NODE_OPTIONS environment variable to "--enable-source-maps".'
);
}
}
}
Expand Down
Loading
Loading