cskit-cli 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/init.js +34 -5
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -97,24 +97,53 @@ async function setupPythonEnv(projectDir, spinner) {
|
|
|
97
97
|
const pipPath = path.join(venvPath, 'bin', 'pip');
|
|
98
98
|
|
|
99
99
|
try {
|
|
100
|
-
execSync(`"${pipPath}" install -r requirements.txt
|
|
100
|
+
execSync(`"${pipPath}" install -r requirements.txt`, {
|
|
101
101
|
stdio: 'pipe',
|
|
102
102
|
cwd: libPythonDir
|
|
103
103
|
});
|
|
104
104
|
spinner.succeed(`Python environment ready (${pythonVersion})`);
|
|
105
105
|
return { success: true, version: pythonVersion };
|
|
106
106
|
} catch (pipError) {
|
|
107
|
-
//
|
|
107
|
+
// Extract failed packages from error output
|
|
108
|
+
const errorOutput = pipError.stderr ? pipError.stderr.toString() : pipError.message;
|
|
109
|
+
const failedPackages = [];
|
|
110
|
+
|
|
111
|
+
// Parse error output for specific package failures
|
|
112
|
+
const lines = errorOutput.split('\n');
|
|
113
|
+
for (const line of lines) {
|
|
114
|
+
if (line.includes('No matching distribution') || line.includes('Could not find')) {
|
|
115
|
+
const match = line.match(/for\s+(\S+)/);
|
|
116
|
+
if (match) failedPackages.push(match[1]);
|
|
117
|
+
}
|
|
118
|
+
if (line.includes('ERROR:')) {
|
|
119
|
+
const pkgMatch = line.match(/ERROR:.*?(\S+>=[\d.]+)/);
|
|
120
|
+
if (pkgMatch) failedPackages.push(pkgMatch[1]);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Try installing without failed packages
|
|
108
125
|
spinner.text = 'Retrying with core packages...';
|
|
109
126
|
try {
|
|
110
127
|
execSync(`"${pipPath}" install numpy pandas scipy pydantic rich click -q`, {
|
|
111
128
|
stdio: 'pipe',
|
|
112
129
|
cwd: libPythonDir
|
|
113
130
|
});
|
|
114
|
-
|
|
115
|
-
|
|
131
|
+
|
|
132
|
+
// Show specific failures
|
|
133
|
+
if (failedPackages.length > 0) {
|
|
134
|
+
spinner.warn(`Partial install - failed packages:`);
|
|
135
|
+
console.log(chalk.yellow(`\n Failed: ${failedPackages.join(', ')}`));
|
|
136
|
+
console.log(chalk.dim(` Run manually: ${pipPath} install <package>\n`));
|
|
137
|
+
} else {
|
|
138
|
+
spinner.warn('Partial install - some optional packages failed');
|
|
139
|
+
console.log(chalk.dim(`\n Error: ${errorOutput.slice(0, 200)}...\n`));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return { success: true, partial: true, version: pythonVersion, failed: failedPackages };
|
|
116
143
|
} catch {
|
|
117
|
-
|
|
144
|
+
spinner.fail('Python setup failed');
|
|
145
|
+
console.log(chalk.red(`\n ${errorOutput.slice(0, 500)}\n`));
|
|
146
|
+
return { success: false, error: errorOutput.slice(0, 200) };
|
|
118
147
|
}
|
|
119
148
|
}
|
|
120
149
|
} catch (error) {
|