From 3c03877481bcb9c537dcc40f6b74c7a8f21af040 Mon Sep 17 00:00:00 2001 From: tehlordvortex Date: Fri, 28 Mar 2025 11:23:06 +0100 Subject: [PATCH 1/3] fix: avoid enobufs error --- .../src/virtualenv/environment.ts | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/pyright-scip/src/virtualenv/environment.ts b/packages/pyright-scip/src/virtualenv/environment.ts index 802ba9f8d..deef1d7a6 100644 --- a/packages/pyright-scip/src/virtualenv/environment.ts +++ b/packages/pyright-scip/src/virtualenv/environment.ts @@ -8,6 +8,9 @@ import { sync as commandExistsSync } from 'command-exists'; // Some future improvements: // - Could use `importlib` and execute some stuff from Python +const PIP_SHOW_CHUNK_SIZE = 100; +const MAX_EXEC_SYNC_BUF_SIZE = 5 * 1024 * 1024; + interface PipInformation { name: string; version: string; @@ -29,15 +32,26 @@ let getPipCommand = () => { }; function pipList(): PipInformation[] { - return JSON.parse(child_process.execSync(`${getPipCommand()} list --format=json`).toString()) as PipInformation[]; + return JSON.parse( + child_process + .execSync(`${getPipCommand()} list --format=json`, { maxBuffer: MAX_EXEC_SYNC_BUF_SIZE }) + .toString() + ) as PipInformation[]; } function pipBulkShow(names: string[]): string[] { - // TODO: This probably breaks with enough names. Should batch them into 512 or whatever the max for bash would be - return child_process - .execSync(`${getPipCommand()} show -f ${names.join(' ')}`) - .toString() - .split('\n---'); + const chunks = []; + for (let i = 0; i < names.length; i += PIP_SHOW_CHUNK_SIZE) { + const chunk = names.slice(i, i + PIP_SHOW_CHUNK_SIZE); + chunks.push(chunk); + } + + return chunks.flatMap((chunk) => + child_process + .execSync(`${getPipCommand()} show -f ${chunk.join(' ')}`, { maxBuffer: MAX_EXEC_SYNC_BUF_SIZE }) + .toString() + .split('\n---') + ); } export default function getEnvironment( From 301f7d5c3649299a4c1bb47db723cbd447f99e61 Mon Sep 17 00:00:00 2001 From: tehlordvortex Date: Fri, 28 Mar 2025 11:23:54 +0100 Subject: [PATCH 2/3] chore: update package meta --- packages/pyright-scip/package.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/pyright-scip/package.json b/packages/pyright-scip/package.json index 048aaeb44..4c4164d63 100644 --- a/packages/pyright-scip/package.json +++ b/packages/pyright-scip/package.json @@ -1,6 +1,5 @@ { - "name": "@sourcegraph/scip-python", - "version": "0.6.0", + "name": "@getrover/scip-python", "description": "SCIP indexer for Python", "main": "index.js", "scripts": { @@ -13,10 +12,10 @@ "webpack": "webpack --mode development --progress", "watch": "webpack --mode development --progress --watch" }, - "author": "Sourcegraph", + "author": "getrover", "repository": { "type": "git", - "url": "https://github.com/sourcegraph/scip-python", + "url": "https://github.com/documaticai/scip-python", "directory": "packages/pyright-scip/" }, "license": "MIT", From 71ffff7d31a7bf69356091857db4b7c465a95eea Mon Sep 17 00:00:00 2001 From: tehlordvortex Date: Fri, 28 Mar 2025 11:24:00 +0100 Subject: [PATCH 3/3] chore: bump version --- packages/pyright-scip/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/pyright-scip/package.json b/packages/pyright-scip/package.json index 4c4164d63..ce23ff79d 100644 --- a/packages/pyright-scip/package.json +++ b/packages/pyright-scip/package.json @@ -1,5 +1,6 @@ { "name": "@getrover/scip-python", + "version": "0.6.1", "description": "SCIP indexer for Python", "main": "index.js", "scripts": {