diff --git a/src/commands/deploy.ts b/src/commands/deploy.ts index 6d41487..8926b33 100644 --- a/src/commands/deploy.ts +++ b/src/commands/deploy.ts @@ -570,7 +570,7 @@ Additionally, you can also retry the build with the debug flag: async __detectPlatformVersion(config: any, body: any) { if (body.platformConfig.pythonVersion) { - // django and flask + // django, flask, python this.logKeyValue('Python version', body.platformConfig.pythonVersion); return body; } @@ -594,6 +594,7 @@ Additionally, you can also retry the build with the debug flag: switch (config.platform) { case 'django': case 'flask': + case 'python': platformVersion = await getPlatformVersion( config.platform, config.path, diff --git a/src/constants.ts b/src/constants.ts index 0630629..83d7178 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -28,6 +28,7 @@ export const AVAILABLE_PLATFORMS = [ 'node', 'laravel', 'php', + 'python', 'django', 'flask', 'dotnet', diff --git a/src/services/get-platform-version.ts b/src/services/get-platform-version.ts index 622fa4b..70512af 100644 --- a/src/services/get-platform-version.ts +++ b/src/services/get-platform-version.ts @@ -49,6 +49,7 @@ async function getPlatformVersion( switch (platform) { case 'django': case 'flask': + case 'python': pureVersion = getPythonVersion(projectPath, debug); break; case 'php': diff --git a/src/utils/detect-platform.ts b/src/utils/detect-platform.ts index 6355577..7fd9e83 100644 --- a/src/utils/detect-platform.ts +++ b/src/utils/detect-platform.ts @@ -8,6 +8,8 @@ import addNullBetweenChars from './add-null-between-chars.js'; export default function detectPlatform(projectPath: string) { const pipfilePath = path.join(projectPath, 'Pipfile'); + const pyprojectFilePath = path.join(projectPath, 'pyproject.toml'); + const poetryFilePath = path.join(projectPath, 'poetry'); const indexPHPFilePath = path.join(projectPath, 'index.php'); const packageJsonFilePath = path.join(projectPath, 'package.json'); const composeJsonFilePath = path.join(projectPath, 'composer.json'); @@ -20,6 +22,8 @@ export default function detectPlatform(projectPath: string) { }); const hasPipfilePathFile = existsSync(pipfilePath); + const hasPyprojectPathFile = existsSync(pyprojectFilePath); + const hasPoetryPathFile = existsSync(poetryFilePath); const hasIndexPHPFile = existsSync(indexPHPFilePath); const hasPackageFile = existsSync(packageJsonFilePath); const hasComposerJsonFile = existsSync(composeJsonFilePath); @@ -69,6 +73,10 @@ Please specify your platform with --platform=laravel or docker.`); return 'php'; } + if (hasPyprojectPathFile || hasPoetryPathFile) { + return 'python'; + } + if (hasRequirementsTxtFile) { const requirementsTxt = readFileSync(requirementsTxtFilePath); @@ -89,6 +97,8 @@ Please specify your platform with --platform=laravel or docker.`); ) { return 'flask'; } + + return 'python'; } if (hasPipfilePathFile) { @@ -101,6 +111,8 @@ Please specify your platform with --platform=laravel or docker.`); if (pipfile.includes('Flask') || pipfile.includes('flask')) { return 'flask'; } + + return 'python'; } if (hasPackageFile && hasDockerFile) { diff --git a/src/utils/get-port.ts b/src/utils/get-port.ts index 261fce8..37ac37f 100644 --- a/src/utils/get-port.ts +++ b/src/utils/get-port.ts @@ -5,6 +5,7 @@ interface IPorts { export function getPort(platform: string): number { const ports: IPorts = { static: 80, + python: 80, react: 80, vue: 80, angular: 80,