serverless-offline icon indicating copy to clipboard operation
serverless-offline copied to clipboard

Support Python 3.12

Open robertreservix opened this issue 1 year ago • 5 comments

Description

Add support for Python 3.12

Motivation and Context

  • Python 3.12 is supported since 14 DEC 2023 by AWS
  • Python 3.12 is supported soon (or yet :) ) by serverless

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):

robertreservix avatar Feb 19 '24 10:02 robertreservix

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

nikitajz avatar Feb 21 '24 14:02 nikitajz

@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.

robertreservix avatar Mar 06 '24 11:03 robertreservix

@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

nikitajz avatar Mar 15 '24 16:03 nikitajz

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 avatar Apr 23 '24 21:04 DorianMazur

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

DorianMazur avatar Apr 24 '24 07:04 DorianMazur

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",
 ])

mwidera avatar Jul 03 '24 10:07 mwidera

@mwidera I added it here https://github.com/dherault/serverless-offline/commit/ab8565a8fd5144dcd0b766da5ef0fac90fce8cb1

DorianMazur avatar Aug 01 '24 07:08 DorianMazur