dherault / serverless-offline

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

feat: add support for runtime python3.10 #1685

Closed trygveaa closed 11 months ago

trygveaa commented 1 year ago

Description

AWS recently released support for Python 3.10: https://aws.amazon.com/blogs/compute/python-3-10-runtime-now-available-in-aws-lambda/

This makes it possible to use the runtime with serverless-offline.

Motivation and Context

To use Python 3.10.

How Has This Been Tested?

I tested running my project with serverless-offline and Python 3.10 and it works fine when it's added to supported runtimes.

bartelemi commented 1 year ago

Would be good to get this merged, can we get it approved @dnalborczyk or @dherault 🙏🏻

To add some value, I can also confirm that it works without any issues with this changeset.

szbartnik commented 1 year ago

It may help someone while we wait for this fix merged & published:

  1. Go to node_modules/serverless-offline/src/config/supportedRuntimes.js
  2. Add 'python3.10' to the list & save file
  3. npm i patch-package --save-dev (https://github.com/ds300/patch-package)
  4. Add "postinstall": "patch-package" entry to the "scripts" section in package.json
  5. npx patch-package serverless-offline

Library will generate patches/serverless-offline+12.0.4.patch file:

diff --git a/node_modules/serverless-offline/src/config/supportedRuntimes.js b/node_modules/serverless-offline/src/config/supportedRuntimes.js
index b23fd17..43d7449 100644
--- a/node_modules/serverless-offline/src/config/supportedRuntimes.js
+++ b/node_modules/serverless-offline/src/config/supportedRuntimes.js
@@ -30,6 +30,7 @@ export const supportedPython = new Set([
   'python3.7',
   'python3.8',
   'python3.9',
+  'python3.10'
 ])

 // RUBY

So the patch will be applied during postinstall phase automatically.

yp717 commented 1 year ago

Is there anything blocking this PR? Seems like a simple change on the surface of it :)

bartelemi commented 1 year ago

I guess just lack of maintenance. You can see that last commits and release were over 5 months ago.

You can use the workaround posted above or be patient 😅

yp717 commented 1 year ago

Yeah the patch works like a charm 😃

bjornhansen commented 1 year ago

Looks like this was approved a few weeks ago. @dherault - is there any reason it hasn't been merged yet? Thanks so much for your open source work! Serverless Offline is great.

cristiansandru11 commented 1 year ago

add also 3.11 & merge it please!

sergiors commented 1 year ago

UP!

andidev commented 1 year ago

new PR for 3.11 as well here https://github.com/dherault/serverless-offline/pull/1727 please merge

mohokh67 commented 11 months ago

Already been added here https://github.com/dherault/serverless-offline/pull/1727