cskit-cli 1.0.3 → 1.0.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cskit-cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Content Suite Kit CLI - Download and manage CSK skills from private repository",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -66,30 +66,57 @@ async function setupPythonEnv(projectDir, spinner) {
66
66
  const venvPath = path.join(libPythonDir, '.venv');
67
67
 
68
68
  try {
69
- // Check if Python 3 is available
69
+ // Check if Python 3 is available and get version
70
+ let pythonVersion;
70
71
  try {
71
- execSync('python3 --version', { stdio: 'pipe' });
72
+ pythonVersion = execSync('python3 --version', { stdio: 'pipe' }).toString().trim();
73
+ spinner.text = `Found ${pythonVersion}`;
72
74
  } catch {
73
75
  spinner.warn('Python 3 not found, skipping venv setup');
74
76
  return { success: true, skipped: true, reason: 'python3 not found' };
75
77
  }
76
78
 
79
+ // Check minimum version (3.9+)
80
+ const versionMatch = pythonVersion.match(/Python (\d+)\.(\d+)/);
81
+ if (versionMatch) {
82
+ const [, major, minor] = versionMatch.map(Number);
83
+ if (major < 3 || (major === 3 && minor < 9)) {
84
+ spinner.warn(`Python ${major}.${minor} found, requires 3.9+`);
85
+ return { success: true, skipped: true, reason: `Python ${major}.${minor} requires 3.9+` };
86
+ }
87
+ }
88
+
77
89
  // Create venv if not exists
78
90
  if (!fs.existsSync(venvPath)) {
79
91
  spinner.text = 'Creating virtual environment...';
80
92
  execSync(`python3 -m venv "${venvPath}"`, { stdio: 'pipe', cwd: libPythonDir });
81
93
  }
82
94
 
83
- // Install requirements
95
+ // Install requirements with error handling
84
96
  spinner.text = 'Installing Python packages...';
85
97
  const pipPath = path.join(venvPath, 'bin', 'pip');
86
- execSync(`"${pipPath}" install -r requirements.txt -q`, {
87
- stdio: 'pipe',
88
- cwd: libPythonDir
89
- });
90
98
 
91
- spinner.succeed('Python environment ready');
92
- return { success: true };
99
+ try {
100
+ execSync(`"${pipPath}" install -r requirements.txt -q`, {
101
+ stdio: 'pipe',
102
+ cwd: libPythonDir
103
+ });
104
+ spinner.succeed(`Python environment ready (${pythonVersion})`);
105
+ return { success: true, version: pythonVersion };
106
+ } catch (pipError) {
107
+ // Try installing without optional packages
108
+ spinner.text = 'Retrying with core packages...';
109
+ try {
110
+ execSync(`"${pipPath}" install numpy pandas scipy pydantic rich click -q`, {
111
+ stdio: 'pipe',
112
+ cwd: libPythonDir
113
+ });
114
+ spinner.warn('Partial install - some optional packages failed');
115
+ return { success: true, partial: true, version: pythonVersion };
116
+ } catch {
117
+ throw pipError;
118
+ }
119
+ }
93
120
  } catch (error) {
94
121
  spinner.warn(`Python setup failed: ${error.message}`);
95
122
  return { success: false, error: error.message };