motia 0.17.9-beta.191 → 0.17.9-beta.192-502786

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/dist/install.mjs CHANGED
@@ -1,11 +1,14 @@
1
1
  import { getStepFiles, getStreamFiles } from "./generate-locked-data.mjs";
2
+ import { internalLogger } from "./utils/internal-logger.mjs";
2
3
  import { executeCommand } from "./utils/execute-command.mjs";
3
4
  import { getPythonCommand } from "./utils/python-version-utils.mjs";
4
5
  import { activatePythonVenv } from "./utils/activate-python-env.mjs";
6
+ import { getInstallCommand } from "./utils/validate-python-environment.mjs";
5
7
  import { ensureUvInstalled } from "./utils/ensure-uv.mjs";
6
8
  import { installLambdaPythonPackages } from "./utils/install-lambda-python-packages.mjs";
7
9
  import fs from "fs";
8
10
  import path from "path";
11
+ import pc from "picocolors";
9
12
 
10
13
  //#region src/install.ts
11
14
  const pythonInstall = async ({ baseDir, isVerbose = false, pythonVersion = "3.13" }) => {
@@ -40,9 +43,16 @@ const pythonInstall = async ({ baseDir, isVerbose = false, pythonVersion = "3.13
40
43
  if (isVerbose) console.log("📄 Using requirements from:", requirement);
41
44
  await executeCommand(`pip install -r "${requirement}" --only-binary=:all:`, baseDir);
42
45
  }
46
+ const sitePackagesPath = process.env.PYTHON_SITE_PACKAGES;
47
+ if (!sitePackagesPath || !fs.existsSync(sitePackagesPath)) {
48
+ const installCmd = getInstallCommand(baseDir);
49
+ internalLogger.error("Python virtual environment was not created");
50
+ internalLogger.info(`Please try running ${pc.cyan(installCmd)} or manually create the venv with: ${pc.cyan("python3 -m venv python_modules")}`);
51
+ process.exit(1);
52
+ }
43
53
  } catch (error) {
44
54
  const errorMessage = error instanceof Error ? error.message : String(error);
45
- console.error("Installation failed:", errorMessage);
55
+ internalLogger.error("Installation failed:", errorMessage);
46
56
  process.exit(1);
47
57
  }
48
58
  };
@@ -1 +1 @@
1
- {"version":3,"file":"install.mjs","names":[],"sources":["../src/install.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport { getStepFiles, getStreamFiles } from './generate-locked-data'\nimport { activatePythonVenv } from './utils/activate-python-env'\nimport { ensureUvInstalled } from './utils/ensure-uv'\nimport { executeCommand } from './utils/execute-command'\nimport { installLambdaPythonPackages } from './utils/install-lambda-python-packages'\nimport { getPythonCommand } from './utils/python-version-utils'\n\ninterface InstallConfig {\n isVerbose?: boolean\n pythonVersion?: string\n}\n\ntype PythonInstallConfig = InstallConfig & { baseDir: string }\n\nexport const pythonInstall = async ({\n baseDir,\n isVerbose = false,\n pythonVersion = '3.13',\n}: PythonInstallConfig): Promise<void> => {\n const venvPath = path.join(baseDir, 'python_modules')\n console.log('📦 Installing Python dependencies...', venvPath)\n\n const coreRequirementsPath = path.join(baseDir, 'node_modules', 'motia', 'dist', 'requirements-core.txt')\n const snapRequirementsPath = path.join(baseDir, 'node_modules', 'motia', 'dist', 'requirements-snap.txt')\n const localRequirements = path.join(baseDir, 'requirements.txt')\n\n const requirementsList = [coreRequirementsPath, snapRequirementsPath, localRequirements]\n\n try {\n // Get the appropriate Python command\n const pythonCmd = await getPythonCommand(pythonVersion, baseDir)\n if (isVerbose) {\n console.log(`🐍 Using Python command: ${pythonCmd}`)\n }\n\n // Check if virtual environment exists\n if (!fs.existsSync(venvPath)) {\n console.log('📦 Creating Python virtual environment...')\n await executeCommand(`${pythonCmd} -m venv python_modules`, baseDir)\n }\n\n activatePythonVenv({ baseDir, isVerbose, pythonVersion })\n\n // Ensure UV is installed\n console.log('🔧 Checking UV installation...')\n await ensureUvInstalled()\n console.log('✅ UV is available')\n\n installLambdaPythonPackages({ isVerbose, requirementsList })\n\n // Install requirements\n console.log('📥 Installing Python dependencies...')\n\n // Core requirements\n\n for (const requirement of requirementsList) {\n if (fs.existsSync(requirement)) {\n if (isVerbose) {\n console.log('📄 Using requirements from:', requirement)\n }\n await executeCommand(`pip install -r \"${requirement}\" --only-binary=:all:`, baseDir)\n }\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n console.error('Installation failed:', errorMessage)\n process.exit(1)\n }\n}\n\nexport const install = async ({ isVerbose = false, pythonVersion = '3.13' }: InstallConfig): Promise<void> => {\n const baseDir = process.cwd()\n\n const steps = getStepFiles(baseDir)\n const streams = getStreamFiles(baseDir)\n if (steps.some((file) => file.endsWith('.py')) || streams.some((file) => file.endsWith('.py'))) {\n await pythonInstall({ baseDir, isVerbose, pythonVersion })\n }\n\n console.info('✅ Installation completed successfully!')\n\n process.exit(0)\n}\n"],"mappings":";;;;;;;;;;AAgBA,MAAa,gBAAgB,OAAO,EAClC,SACA,YAAY,OACZ,gBAAgB,aACwB;CACxC,MAAM,WAAW,KAAK,KAAK,SAAS,iBAAiB;AACrD,SAAQ,IAAI,wCAAwC,SAAS;CAM7D,MAAM,mBAAmB;EAJI,KAAK,KAAK,SAAS,gBAAgB,SAAS,QAAQ,wBAAwB;EAC5E,KAAK,KAAK,SAAS,gBAAgB,SAAS,QAAQ,wBAAwB;EAC/E,KAAK,KAAK,SAAS,mBAAmB;EAEwB;AAExF,KAAI;EAEF,MAAM,YAAY,MAAM,iBAAiB,eAAe,QAAQ;AAChE,MAAI,UACF,SAAQ,IAAI,4BAA4B,YAAY;AAItD,MAAI,CAAC,GAAG,WAAW,SAAS,EAAE;AAC5B,WAAQ,IAAI,4CAA4C;AACxD,SAAM,eAAe,GAAG,UAAU,0BAA0B,QAAQ;;AAGtE,qBAAmB;GAAE;GAAS;GAAW;GAAe,CAAC;AAGzD,UAAQ,IAAI,iCAAiC;AAC7C,QAAM,mBAAmB;AACzB,UAAQ,IAAI,oBAAoB;AAEhC,8BAA4B;GAAE;GAAW;GAAkB,CAAC;AAG5D,UAAQ,IAAI,uCAAuC;AAInD,OAAK,MAAM,eAAe,iBACxB,KAAI,GAAG,WAAW,YAAY,EAAE;AAC9B,OAAI,UACF,SAAQ,IAAI,+BAA+B,YAAY;AAEzD,SAAM,eAAe,mBAAmB,YAAY,wBAAwB,QAAQ;;UAGjF,OAAO;EACd,MAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AAC3E,UAAQ,MAAM,0BAA0B,aAAa;AACrD,UAAQ,KAAK,EAAE;;;AAInB,MAAa,UAAU,OAAO,EAAE,YAAY,OAAO,gBAAgB,aAA2C;CAC5G,MAAM,UAAU,QAAQ,KAAK;CAE7B,MAAM,QAAQ,aAAa,QAAQ;CACnC,MAAM,UAAU,eAAe,QAAQ;AACvC,KAAI,MAAM,MAAM,SAAS,KAAK,SAAS,MAAM,CAAC,IAAI,QAAQ,MAAM,SAAS,KAAK,SAAS,MAAM,CAAC,CAC5F,OAAM,cAAc;EAAE;EAAS;EAAW;EAAe,CAAC;AAG5D,SAAQ,KAAK,yCAAyC;AAEtD,SAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"install.mjs","names":[],"sources":["../src/install.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport pc from 'picocolors'\nimport { getStepFiles, getStreamFiles } from './generate-locked-data'\nimport { activatePythonVenv } from './utils/activate-python-env'\nimport { ensureUvInstalled } from './utils/ensure-uv'\nimport { executeCommand } from './utils/execute-command'\nimport { installLambdaPythonPackages } from './utils/install-lambda-python-packages'\nimport { internalLogger } from './utils/internal-logger'\nimport { getPythonCommand } from './utils/python-version-utils'\nimport { getInstallCommand } from './utils/validate-python-environment'\n\ninterface InstallConfig {\n isVerbose?: boolean\n pythonVersion?: string\n}\n\ntype PythonInstallConfig = InstallConfig & { baseDir: string }\n\nexport const pythonInstall = async ({\n baseDir,\n isVerbose = false,\n pythonVersion = '3.13',\n}: PythonInstallConfig): Promise<void> => {\n const venvPath = path.join(baseDir, 'python_modules')\n console.log('📦 Installing Python dependencies...', venvPath)\n\n const coreRequirementsPath = path.join(baseDir, 'node_modules', 'motia', 'dist', 'requirements-core.txt')\n const snapRequirementsPath = path.join(baseDir, 'node_modules', 'motia', 'dist', 'requirements-snap.txt')\n const localRequirements = path.join(baseDir, 'requirements.txt')\n\n const requirementsList = [coreRequirementsPath, snapRequirementsPath, localRequirements]\n\n try {\n // Get the appropriate Python command\n const pythonCmd = await getPythonCommand(pythonVersion, baseDir)\n if (isVerbose) {\n console.log(`🐍 Using Python command: ${pythonCmd}`)\n }\n\n // Check if virtual environment exists\n if (!fs.existsSync(venvPath)) {\n console.log('📦 Creating Python virtual environment...')\n await executeCommand(`${pythonCmd} -m venv python_modules`, baseDir)\n }\n\n activatePythonVenv({ baseDir, isVerbose, pythonVersion })\n\n // Ensure UV is installed\n console.log('🔧 Checking UV installation...')\n await ensureUvInstalled()\n console.log('✅ UV is available')\n\n installLambdaPythonPackages({ isVerbose, requirementsList })\n\n // Install requirements\n console.log('📥 Installing Python dependencies...')\n\n // Core requirements\n\n for (const requirement of requirementsList) {\n if (fs.existsSync(requirement)) {\n if (isVerbose) {\n console.log('📄 Using requirements from:', requirement)\n }\n await executeCommand(`pip install -r \"${requirement}\" --only-binary=:all:`, baseDir)\n }\n }\n\n const sitePackagesPath = process.env.PYTHON_SITE_PACKAGES\n\n if (!sitePackagesPath || !fs.existsSync(sitePackagesPath)) {\n const installCmd = getInstallCommand(baseDir)\n internalLogger.error('Python virtual environment was not created')\n internalLogger.info(\n `Please try running ${pc.cyan(installCmd)} or manually create the venv with: ${pc.cyan('python3 -m venv python_modules')}`,\n )\n process.exit(1)\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n internalLogger.error('Installation failed:', errorMessage)\n process.exit(1)\n }\n}\n\nexport const install = async ({ isVerbose = false, pythonVersion = '3.13' }: InstallConfig): Promise<void> => {\n const baseDir = process.cwd()\n\n const steps = getStepFiles(baseDir)\n const streams = getStreamFiles(baseDir)\n if (steps.some((file) => file.endsWith('.py')) || streams.some((file) => file.endsWith('.py'))) {\n await pythonInstall({ baseDir, isVerbose, pythonVersion })\n }\n\n console.info('✅ Installation completed successfully!')\n\n process.exit(0)\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,MAAa,gBAAgB,OAAO,EACl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,UAAQ,KAAK,EAAE;;;AAInB,MAAa,UAAU,OAAO,EAAE,YAAY,OAAO,gBAAgB,aAA2C;CAC5G,MAAM,UAAU,QAAQ,KAAK;CAE7B,MAAM,QAAQ,aAAa,QAAQ;CACnC,MAAM,UAAU,eAAe,QAAQ;AACvC,KAAI,MAAM,MAAM,SAAS,KAAK,SAAS,MAAM,CAAC,IAAI,QAAQ,MAAM,SAAS,KAAK,SAAS,MAAM,CAAC,CAC5F,OAAM,cAAc;EAAE;EAAS;EAAW;EAAe,CAAC;AAG5D,SAAQ,KAAK,yCAAyC;AAEtD,SAAQ,KAAK,EAAE"}
@@ -4,7 +4,10 @@ import { exec } from "child_process";
4
4
  const executeCommand = async (command, rootDir, options) => {
5
5
  const { silent = false } = options || {};
6
6
  return new Promise((resolve, reject) => {
7
- exec(command, { cwd: rootDir }, (error, stdout, stderr) => {
7
+ exec(command, {
8
+ cwd: rootDir,
9
+ env: process.env
10
+ }, (error, stdout, stderr) => {
8
11
  if (error) {
9
12
  if (!silent) console.error(`exec error: ${error}`);
10
13
  reject(error);
@@ -1 +1 @@
1
- {"version":3,"file":"execute-command.mjs","names":[],"sources":["../../src/utils/execute-command.ts"],"sourcesContent":["import { exec } from 'child_process'\n\ninterface ExecuteCommandOptions {\n silent?: boolean\n}\n\nexport const executeCommand = async (\n command: string,\n rootDir: string,\n options?: ExecuteCommandOptions,\n): Promise<string> => {\n const { silent = false } = options || {}\n\n return new Promise((resolve, reject) => {\n exec(command, { cwd: rootDir }, (error, stdout, stderr) => {\n if (error) {\n if (!silent) {\n console.error(`exec error: ${error}`)\n }\n reject(error)\n return\n }\n\n if (!silent) {\n if (stdout) console.log(stdout.toString())\n if (stderr) console.error(stderr.toString())\n }\n\n resolve(stdout.toString())\n })\n })\n}\n"],"mappings":";;;AAMA,MAAa,iBAAiB,OAC5B,SACA,SACA,YACoB;CACpB,MAAM,EAAE,SAAS,UAAU,WAAW,EAAE;AAExC,QAAO,IAAI,SAAS,SAAS,WAAW;AACtC,OAAK,SAAS,EAAE,KAAK,SAAS,GAAG,OAAO,QAAQ,WAAW;AACzD,OAAI,OAAO;AACT,QAAI,CAAC,OACH,SAAQ,MAAM,eAAe,QAAQ;AAEvC,WAAO,MAAM;AACb;;AAGF,OAAI,CAAC,QAAQ;AACX,QAAI,OAAQ,SAAQ,IAAI,OAAO,UAAU,CAAC;AAC1C,QAAI,OAAQ,SAAQ,MAAM,OAAO,UAAU,CAAC;;AAG9C,WAAQ,OAAO,UAAU,CAAC;IAC1B;GACF"}
1
+ {"version":3,"file":"execute-command.mjs","names":[],"sources":["../../src/utils/execute-command.ts"],"sourcesContent":["import { exec } from 'child_process'\n\ninterface ExecuteCommandOptions {\n silent?: boolean\n}\n\nexport const executeCommand = async (\n command: string,\n rootDir: string,\n options?: ExecuteCommandOptions,\n): Promise<string> => {\n const { silent = false } = options || {}\n\n return new Promise((resolve, reject) => {\n exec(command, { cwd: rootDir, env: process.env }, (error, stdout, stderr) => {\n if (error) {\n if (!silent) {\n console.error(`exec error: ${error}`)\n }\n reject(error)\n return\n }\n\n if (!silent) {\n if (stdout) console.log(stdout.toString())\n if (stderr) console.error(stderr.toString())\n }\n\n resolve(stdout.toString())\n })\n })\n}\n"],"mappings":";;;AAMA,MAAa,iBAAiB,OAC5B,SACA,SACA,YACoB;CACpB,MAAM,EAAE,SAAS,UAAU,WAAW,EAAE;AAExC,QAAO,IAAI,SAAS,SAAS,WAAW;AACtC,OAAK,SAAS;GAAE,KAAK;GAAS,KAAK,QAAQ;GAAK,GAAG,OAAO,QAAQ,WAAW;AAC3E,OAAI,OAAO;AACT,QAAI,CAAC,OACH,SAAQ,MAAM,eAAe,QAAQ;AAEvC,WAAO,MAAM;AACb;;AAGF,OAAI,CAAC,QAAQ;AACX,QAAI,OAAQ,SAAQ,IAAI,OAAO,UAAU,CAAC;AAC1C,QAAI,OAAQ,SAAQ,MAAM,OAAO,UAAU,CAAC;;AAG9C,WAAQ,OAAO,UAAU,CAAC;IAC1B;GACF"}
@@ -11,7 +11,7 @@ const colorMap = {
11
11
  };
12
12
  const extraTag = (color, extra) => {
13
13
  const colorFn = colorMap[color];
14
- return extra ? pc.bold(colorFn(extra)) : "";
14
+ return extra ? colorFn(extra) : "";
15
15
  };
16
16
  const internalLogger = {
17
17
  info: (message, extra) => {
@@ -1 +1 @@
1
- {"version":3,"file":"internal-logger.mjs","names":[],"sources":["../../src/utils/internal-logger.ts"],"sourcesContent":["import pc from 'picocolors'\n\nconst infoTag = pc.blue('➜ [INFO]')\nconst warnTag = pc.yellow('➜ [WARN]')\nconst errorTag = pc.red('✘ [ERROR]')\n\nconst colorMap = {\n cyan: pc.cyan,\n yellow: pc.yellow,\n red: pc.red,\n}\n\nconst extraTag = (color: 'cyan' | 'yellow' | 'red', extra?: string) => {\n const colorFn = colorMap[color as keyof typeof colorMap]\n\n return extra ? pc.bold(colorFn(extra)) : ''\n}\n\nexport const internalLogger = {\n info: (message: string, extra?: string) => {\n console.log(`${infoTag} ${message} ${extraTag('cyan', extra)}`)\n },\n warn: (message: string, extra?: string) => {\n console.log(`${warnTag} ${message} ${extraTag('yellow', extra)}`)\n },\n error: (message: string, extra?: string) => {\n console.log(`${errorTag} ${message} ${extraTag('red', extra)}`)\n },\n}\n"],"mappings":";;;AAEA,MAAM,UAAU,GAAG,KAAK,WAAW;AACnC,MAAM,UAAU,GAAG,OAAO,WAAW;AACrC,MAAM,WAAW,GAAG,IAAI,YAAY;AAEpC,MAAM,WAAW;CACf,MAAM,GAAG;CACT,QAAQ,GAAG;CACX,KAAK,GAAG;CACT;AAED,MAAM,YAAY,OAAkC,UAAmB;CACrE,MAAM,UAAU,SAAS;AAEzB,QAAO,QAAQ,GAAG,KAAK,QAAQ,MAAM,CAAC,GAAG;;AAG3C,MAAa,iBAAiB;CAC5B,OAAO,SAAiB,UAAmB;AACzC,UAAQ,IAAI,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,QAAQ,MAAM,GAAG;;CAEjE,OAAO,SAAiB,UAAmB;AACzC,UAAQ,IAAI,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,UAAU,MAAM,GAAG;;CAEnE,QAAQ,SAAiB,UAAmB;AAC1C,UAAQ,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,OAAO,MAAM,GAAG;;CAElE"}
1
+ {"version":3,"file":"internal-logger.mjs","names":[],"sources":["../../src/utils/internal-logger.ts"],"sourcesContent":["import pc from 'picocolors'\n\nconst infoTag = pc.blue('➜ [INFO]')\nconst warnTag = pc.yellow('➜ [WARN]')\nconst errorTag = pc.red('✘ [ERROR]')\n\nconst colorMap = {\n cyan: pc.cyan,\n yellow: pc.yellow,\n red: pc.red,\n}\n\nconst extraTag = (color: 'cyan' | 'yellow' | 'red', extra?: string) => {\n const colorFn = colorMap[color as keyof typeof colorMap]\n\n return extra ? colorFn(extra) : ''\n}\n\nexport const internalLogger = {\n info: (message: string, extra?: string) => {\n console.log(`${infoTag} ${message} ${extraTag('cyan', extra)}`)\n },\n warn: (message: string, extra?: string) => {\n console.log(`${warnTag} ${message} ${extraTag('yellow', extra)}`)\n },\n error: (message: string, extra?: string) => {\n console.log(`${errorTag} ${message} ${extraTag('red', extra)}`)\n },\n}\n"],"mappings":";;;AAEA,MAAM,UAAU,GAAG,KAAK,WAAW;AACnC,MAAM,UAAU,GAAG,OAAO,WAAW;AACrC,MAAM,WAAW,GAAG,IAAI,YAAY;AAEpC,MAAM,WAAW;CACf,MAAM,GAAG;CACT,QAAQ,GAAG;CACX,KAAK,GAAG;CACT;AAED,MAAM,YAAY,OAAkC,UAAmB;CACrE,MAAM,UAAU,SAAS;AAEzB,QAAO,QAAQ,QAAQ,MAAM,GAAG;;AAGlC,MAAa,iBAAiB;CAC5B,OAAO,SAAiB,UAAmB;AACzC,UAAQ,IAAI,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,QAAQ,MAAM,GAAG;;CAEjE,OAAO,SAAiB,UAAmB;AACzC,UAAQ,IAAI,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,UAAU,MAAM,GAAG;;CAEnE,QAAQ,SAAiB,UAAmB;AAC1C,UAAQ,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,OAAO,MAAM,GAAG;;CAElE"}
@@ -3,6 +3,7 @@ import { getPythonCommand } from "./python-version-utils.mjs";
3
3
  import { getPackageManager } from "./get-package-manager.mjs";
4
4
  import fs from "fs";
5
5
  import path from "path";
6
+ import pc from "picocolors";
6
7
 
7
8
  //#region src/utils/validate-python-environment.ts
8
9
  function getInstallCommand(baseDir) {
@@ -34,7 +35,7 @@ async function validatePythonEnvironment({ baseDir, hasPythonFiles, pythonVersio
34
35
  if (!fs.existsSync(venvPath)) {
35
36
  internalLogger.error("Python environment not configured");
36
37
  internalLogger.info("The python_modules directory was not found");
37
- internalLogger.info(`Run '${installCmd}' to set up your Python environment`);
38
+ internalLogger.info(`Run ${pc.cyan(installCmd)} to set up your Python environment`);
38
39
  return {
39
40
  success: false,
40
41
  hasPythonFiles: true
@@ -44,7 +45,7 @@ async function validatePythonEnvironment({ baseDir, hasPythonFiles, pythonVersio
44
45
  if (!fs.existsSync(libPath)) {
45
46
  internalLogger.error("Python environment is incomplete");
46
47
  internalLogger.info("The python_modules directory exists but appears to be corrupted");
47
- internalLogger.info(`Run '${installCmd}' to recreate your Python environment`);
48
+ internalLogger.info(`Run ${pc.cyan(installCmd)} to recreate your Python environment`);
48
49
  return {
49
50
  success: false,
50
51
  hasPythonFiles: true
@@ -54,7 +55,7 @@ async function validatePythonEnvironment({ baseDir, hasPythonFiles, pythonVersio
54
55
  if (fs.readdirSync(libPath).filter((item) => item.startsWith("python3")).length === 0) {
55
56
  internalLogger.error("Python environment is incomplete");
56
57
  internalLogger.info("The python_modules/lib directory exists but contains no Python version directories");
57
- internalLogger.info(`Run '${installCmd}' to recreate your Python environment`);
58
+ internalLogger.info(`Run ${pc.cyan(installCmd)} to recreate your Python environment`);
58
59
  return {
59
60
  success: false,
60
61
  hasPythonFiles: true
@@ -63,7 +64,7 @@ async function validatePythonEnvironment({ baseDir, hasPythonFiles, pythonVersio
63
64
  } catch (error) {
64
65
  internalLogger.error("Python environment is incomplete");
65
66
  internalLogger.info("The python_modules/lib directory cannot be read");
66
- internalLogger.info(`Run '${installCmd}' to recreate your Python environment`);
67
+ internalLogger.info(`Run ${pc.cyan(installCmd)} to recreate your Python environment`);
67
68
  return {
68
69
  success: false,
69
70
  hasPythonFiles: true
@@ -76,5 +77,5 @@ async function validatePythonEnvironment({ baseDir, hasPythonFiles, pythonVersio
76
77
  }
77
78
 
78
79
  //#endregion
79
- export { validatePythonEnvironment };
80
+ export { getInstallCommand, validatePythonEnvironment };
80
81
  //# sourceMappingURL=validate-python-environment.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate-python-environment.mjs","names":["error: any"],"sources":["../../src/utils/validate-python-environment.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport { getPackageManager } from './get-package-manager'\nimport { internalLogger } from './internal-logger'\nimport { getPythonCommand } from './python-version-utils'\n\nexport interface ValidationResult {\n success: boolean\n hasPythonFiles: boolean\n}\n\ninterface ValidateConfig {\n baseDir: string\n hasPythonFiles: boolean\n pythonVersion?: string\n}\n\nfunction getInstallCommand(baseDir: string): string {\n const pm = getPackageManager(baseDir)\n switch (pm) {\n case 'yarn':\n return 'yarn install'\n case 'pnpm':\n return 'pnpm install'\n case 'npm':\n default:\n return 'npm install'\n }\n}\n\nexport async function validatePythonEnvironment({\n baseDir,\n hasPythonFiles,\n pythonVersion = '3.13',\n}: ValidateConfig): Promise<ValidationResult> {\n if (!hasPythonFiles) {\n return { success: true, hasPythonFiles: false }\n }\n\n const installCmd = getInstallCommand(baseDir)\n\n try {\n await getPythonCommand(pythonVersion, baseDir)\n } catch {\n internalLogger.error('Python is not installed')\n internalLogger.info('Python files were detected in your project but Python 3 is not available')\n internalLogger.info('Please install Python 3.10 or higher: https://www.python.org/downloads/')\n return { success: false, hasPythonFiles: true }\n }\n\n const venvPath = path.join(baseDir, 'python_modules')\n if (!fs.existsSync(venvPath)) {\n internalLogger.error('Python environment not configured')\n internalLogger.info('The python_modules directory was not found')\n internalLogger.info(`Run '${installCmd}' to set up your Python environment`)\n return { success: false, hasPythonFiles: true }\n }\n\n const libPath = path.join(venvPath, 'lib')\n if (!fs.existsSync(libPath)) {\n internalLogger.error('Python environment is incomplete')\n internalLogger.info('The python_modules directory exists but appears to be corrupted')\n internalLogger.info(`Run '${installCmd}' to recreate your Python environment`)\n return { success: false, hasPythonFiles: true }\n }\n\n try {\n const libContents = fs.readdirSync(libPath)\n const pythonDirs = libContents.filter((item) => item.startsWith('python3'))\n\n if (pythonDirs.length === 0) {\n internalLogger.error('Python environment is incomplete')\n internalLogger.info('The python_modules/lib directory exists but contains no Python version directories')\n internalLogger.info(`Run '${installCmd}' to recreate your Python environment`)\n return { success: false, hasPythonFiles: true }\n }\n } catch (error: any) {\n internalLogger.error('Python environment is incomplete')\n internalLogger.info('The python_modules/lib directory cannot be read')\n internalLogger.info(`Run '${installCmd}' to recreate your Python environment`)\n return { success: false, hasPythonFiles: true }\n }\n\n return { success: true, hasPythonFiles: true }\n}\n"],"mappings":";;;;;;;AAiBA,SAAS,kBAAkB,SAAyB;AAElD,SADW,kBAAkB,QAAQ,EACrC;EACE,KAAK,OACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK;EACL,QACE,QAAO;;;AAIb,eAAsB,0BAA0B,EAC9C,SACA,gBACA,gBAAgB,UAC4B;AAC5C,KAAI,CAAC,eACH,QAAO;EAAE,SAAS;EAAM,gBAAgB;EAAO;CAGjD,MAAM,aAAa,kBAAkB,QAAQ;AAE7C,KAAI;AACF,QAAM,iBAAiB,eAAe,QAAQ;SACxC;AACN,iBAAe,MAAM,0BAA0B;AAC/C,iBAAe,KAAK,2EAA2E;AAC/F,iBAAe,KAAK,0EAA0E;AAC9F,SAAO;GAAE,SAAS;GAAO,gBAAgB;GAAM;;CAGjD,MAAM,WAAW,KAAK,KAAK,SAAS,iBAAiB;AACrD,KAAI,CAAC,GAAG,WAAW,SAAS,EAAE;AAC5B,iBAAe,MAAM,oCAAoC;AACzD,iBAAe,KAAK,6CAA6C;AACjE,iBAAe,KAAK,QAAQ,WAAW,qCAAqC;AAC5E,SAAO;GAAE,SAAS;GAAO,gBAAgB;GAAM;;CAGjD,MAAM,UAAU,KAAK,KAAK,UAAU,MAAM;AAC1C,KAAI,CAAC,GAAG,WAAW,QAAQ,EAAE;AAC3B,iBAAe,MAAM,mCAAmC;AACxD,iBAAe,KAAK,kEAAkE;AACtF,iBAAe,KAAK,QAAQ,WAAW,uCAAuC;AAC9E,SAAO;GAAE,SAAS;GAAO,gBAAgB;GAAM;;AAGjD,KAAI;AAIF,MAHoB,GAAG,YAAY,QAAQ,CACZ,QAAQ,SAAS,KAAK,WAAW,UAAU,CAAC,CAE5D,WAAW,GAAG;AAC3B,kBAAe,MAAM,mCAAmC;AACxD,kBAAe,KAAK,qFAAqF;AACzG,kBAAe,KAAK,QAAQ,WAAW,uCAAuC;AAC9E,UAAO;IAAE,SAAS;IAAO,gBAAgB;IAAM;;UAE1CA,OAAY;AACnB,iBAAe,MAAM,mCAAmC;AACxD,iBAAe,KAAK,kDAAkD;AACtE,iBAAe,KAAK,QAAQ,WAAW,uCAAuC;AAC9E,SAAO;GAAE,SAAS;GAAO,gBAAgB;GAAM;;AAGjD,QAAO;EAAE,SAAS;EAAM,gBAAgB;EAAM"}
1
+ {"version":3,"file":"validate-python-environment.mjs","names":["error: any"],"sources":["../../src/utils/validate-python-environment.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport pc from 'picocolors'\nimport { getPackageManager } from './get-package-manager'\nimport { internalLogger } from './internal-logger'\nimport { getPythonCommand } from './python-version-utils'\n\nexport interface ValidationResult {\n success: boolean\n hasPythonFiles: boolean\n}\n\ninterface ValidateConfig {\n baseDir: string\n hasPythonFiles: boolean\n pythonVersion?: string\n}\n\nexport function getInstallCommand(baseDir: string): string {\n const pm = getPackageManager(baseDir)\n switch (pm) {\n case 'yarn':\n return 'yarn install'\n case 'pnpm':\n return 'pnpm install'\n case 'npm':\n default:\n return 'npm install'\n }\n}\n\nexport async function validatePythonEnvironment({\n baseDir,\n hasPythonFiles,\n pythonVersion = '3.13',\n}: ValidateConfig): Promise<ValidationResult> {\n if (!hasPythonFiles) {\n return { success: true, hasPythonFiles: false }\n }\n\n const installCmd = getInstallCommand(baseDir)\n\n try {\n await getPythonCommand(pythonVersion, baseDir)\n } catch {\n internalLogger.error('Python is not installed')\n internalLogger.info('Python files were detected in your project but Python 3 is not available')\n internalLogger.info('Please install Python 3.10 or higher: https://www.python.org/downloads/')\n return { success: false, hasPythonFiles: true }\n }\n\n const venvPath = path.join(baseDir, 'python_modules')\n if (!fs.existsSync(venvPath)) {\n internalLogger.error('Python environment not configured')\n internalLogger.info('The python_modules directory was not found')\n internalLogger.info(`Run ${pc.cyan(installCmd)} to set up your Python environment`)\n return { success: false, hasPythonFiles: true }\n }\n\n const libPath = path.join(venvPath, 'lib')\n if (!fs.existsSync(libPath)) {\n internalLogger.error('Python environment is incomplete')\n internalLogger.info('The python_modules directory exists but appears to be corrupted')\n internalLogger.info(`Run ${pc.cyan(installCmd)} to recreate your Python environment`)\n return { success: false, hasPythonFiles: true }\n }\n\n try {\n const libContents = fs.readdirSync(libPath)\n const pythonDirs = libContents.filter((item) => item.startsWith('python3'))\n\n if (pythonDirs.length === 0) {\n internalLogger.error('Python environment is incomplete')\n internalLogger.info('The python_modules/lib directory exists but contains no Python version directories')\n internalLogger.info(`Run ${pc.cyan(installCmd)} to recreate your Python environment`)\n return { success: false, hasPythonFiles: true }\n }\n } catch (error: any) {\n internalLogger.error('Python environment is incomplete')\n internalLogger.info('The python_modules/lib directory cannot be read')\n internalLogger.info(`Run ${pc.cyan(installCmd)} to recreate your Python environment`)\n return { success: false, hasPythonFiles: true }\n }\n\n return { success: true, hasPythonFiles: true }\n}\n"],"mappings":";;;;;;;;AAkBA,SA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A,OAAY;AACnB,iBAAe,MAAM,mCAAmC;AACxD,iBAAe,KAAK,kDAAkD;AACtE,iBAAe,KAAK,OAAO,GAAG,KAAK,WAAW,CAAC,sCAAsC;AACrF,SAAO;GAAE,SAAS;GAAO,gBAAgB;GAAM;;AAGjD,QAAO;EAAE,SAAS;EAAM,gBAAgB;EAAM"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "motia",
3
3
  "description": "Build production-grade backends with a single primitive. APIs, background jobs, Queues, Workflows, and AI agents - unified in one system with built-in State management, Streaming, and Observability.",
4
- "version": "0.17.9-beta.191",
4
+ "version": "0.17.9-beta.192-502786",
5
5
  "license": "Elastic-2.0",
6
6
  "type": "module",
7
7
  "repository": {
@@ -46,13 +46,13 @@
46
46
  "table": "^6.9.0",
47
47
  "ts-node": "^10.9.2",
48
48
  "zod": "^4.1.13",
49
- "@motiadev/adapter-redis-state": "0.17.9-beta.191",
50
- "@motiadev/adapter-redis-cron": "0.17.9-beta.191",
51
- "@motiadev/adapter-redis-streams": "0.17.9-beta.191",
52
- "@motiadev/core": "0.17.9-beta.191",
53
- "@motiadev/stream-client-node": "0.17.9-beta.191",
54
- "@motiadev/adapter-bullmq-events": "0.17.9-beta.191",
55
- "@motiadev/workbench": "0.17.9-beta.191"
49
+ "@motiadev/adapter-bullmq-events": "0.17.9-beta.192-502786",
50
+ "@motiadev/adapter-redis-cron": "0.17.9-beta.192-502786",
51
+ "@motiadev/adapter-redis-state": "0.17.9-beta.192-502786",
52
+ "@motiadev/adapter-redis-streams": "0.17.9-beta.192-502786",
53
+ "@motiadev/core": "0.17.9-beta.192-502786",
54
+ "@motiadev/stream-client-node": "0.17.9-beta.192-502786",
55
+ "@motiadev/workbench": "0.17.9-beta.192-502786"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@amplitude/analytics-types": "^2.9.2",