dherault / serverless-offline

Emulate AWS λ and API Gateway locally when developing your Serverless project
MIT License
5.16k stars 794 forks source link

Support Python 3.12 #1761

Open robertreservix opened 4 months ago

robertreservix commented 4 months ago

Description

Add support for Python 3.12

Motivation and Context

How Has This Been Tested?

There is a warning, coming probably from serverless, but nevertheless I can work with Python 3.12 using this fork

❯ serverless offline
Running "serverless" from node_modules

Warning: Invalid configuration encountered
  at 'provider.runtime': must be equal to one of the allowed values [dotnet6, go1.x, java17, java11, java8, java8.al2, nodejs14.x, nodejs16.x, nodejs18.x, nodejs20.x, provided, provided.al2, provided.al2023, python3.7, python3.8, python3.9, python3.10, python3.11, ruby2.7, ruby3.2]

Learn more about configuration validation here: http://slss.io/configuration-validation

Starting Offline at stage dev (<some-aws-region>)

Offline [http for lambda] listening on http://localhost:3002
Function names exposed for local invocation by aws-sdk:
           * main: <some-function-name>

   ┌────────────────────────────────────────────────────────────────────────┐
   │                                                                        │
   │   POST | http://localhost:3000/                                        │
   │   POST | http://localhost:3000/2015-03-31/functions/main/invocations   │
   │                                                                        │
   └────────────────────────────────────────────────────────────────────────┘

Server ready: http://localhost:3000 🚀

Screenshots (if appropriate):

nikitajz commented 4 months ago

Seems a duplicate of https://github.com/serverless/serverless/pull/12300

robertreservix commented 4 months ago

@nikitajz Will the changes from serverless/serverless automatically built into this project? I thought that the versions are hard coded, but I might be wrong.

nikitajz commented 3 months ago

@robertreservix seems you're right - it's more a duplicate of the code (configuration) rather than GH issue. I didn't pay enough attention that it's a separate project since I left a comment when was reviewing serverless repo issues

DorianMazur commented 2 months ago

Thank you @robertreservix for the PR. This is no longer needed I think. I just merged a PR that adds support for python3.12 - #1755

DorianMazur commented 2 months ago

Actually I need to reopen this, because serverless doesn't support python 3.12 - https://github.com/serverless/serverless/pull/12300

mwidera commented 5 days ago

Hello just wanted to ask whether this will be merged anytime soon? As a workaround right now I'm using: https://www.npmjs.com/package/patch-package With this patch:

diff --git a/node_modules/serverless-offline/src/config/supportedRuntimes.js b/node_modules/serverless-offline/src/config/supportedRuntimes.js
index 9fe7f0e..c0fbc3a 100644
--- a/node_modules/serverless-offline/src/config/supportedRuntimes.js
+++ b/node_modules/serverless-offline/src/config/supportedRuntimes.js
@@ -20,6 +20,7 @@ export const supportedRuntimesArchitecture = {
   "python3.9": [ARM64, X86_64],
   "python3.10": [ARM64, X86_64],
   "python3.11": [ARM64, X86_64],
+  "python3.12": [ARM64, X86_64],
   "ruby2.7": [ARM64, X86_64],
   "ruby3.2": [ARM64, X86_64],
   java8: [X86_64],
@@ -62,6 +63,7 @@ export const supportedPython = new Set([
   "python3.9",
   "python3.10",
   "python3.11",
+  "python3.12",
 ])