This is an automated email from the ASF dual-hosted git repository.

lukeroy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-python.git


The following commit(s) were added to refs/heads/master by this push:
     new 8a4eb7d  Add Python 3.12 (#152)
8a4eb7d is described below

commit 8a4eb7d7805651fbdc0612ac4c74f32b8a58f356
Author: Luke Roy <[email protected]>
AuthorDate: Mon Jan 29 16:26:08 2024 +0100

    Add Python 3.12 (#152)
    
    * Add Python 3.12
    
    * downgrade twisted for scrapy
    
    * downgrade twisted for scrapy: The user requested twisted==23.8.0 scrapy 
2.11.0 depends on Twisted<23.8.0 and >=18.9.0
    
    * downgrade twisted for scrapy: The user requested twisted==22.8.0
    
    * Update core/python312Action/Dockerfile
    
    Co-authored-by: David Grove <[email protected]>
    
    * Update core/python312Action/requirements.txt
    
    Co-authored-by: David Grove <[email protected]>
    
    ---------
    
    Co-authored-by: David Grove <[email protected]>
---
 .github/workflows/ci.yaml                          |  4 ++
 README.md                                          |  1 +
 core/python312Action/Dockerfile                    | 70 ++++++++++++++++++++++
 .../python312Action/build.gradle                   | 56 ++++++++---------
 core/python312Action/requirements.txt              | 15 +++++
 settings.gradle                                    |  1 +
 tests/src/test/resources/build.sh                  |  2 +-
 .../runtime/actionContainers/Python312Tests.scala  | 32 ++++------
 8 files changed, 130 insertions(+), 51 deletions(-)

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 398c5ad..136d812 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -96,6 +96,8 @@ jobs:
           ./gradlew :core:python310Action:distDocker 
-PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk 
-PdockerImageTag=$SHORT_COMMIT
           ./gradlew :core:python311Action:distDocker 
-PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk 
-PdockerImageTag=nightly
           ./gradlew :core:python311Action:distDocker 
-PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk 
-PdockerImageTag=$SHORT_COMMIT
+          ./gradlew :core:python312Action:distDocker 
-PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk 
-PdockerImageTag=nightly
+          ./gradlew :core:python312Action:distDocker 
-PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk 
-PdockerImageTag=$SHORT_COMMIT
       - name: Push Release Images
         if: ${{ env.PUSH_RELEASE == 'true' }}
         working-directory: runtime
@@ -108,5 +110,7 @@ jobs:
             RUNTIME="python310Action"
           elif [ ${RUNTIME_VERSION} == "311" ]; then
             RUNTIME="python311Action"
+          elif [ ${RUNTIME_VERSION} == "312" ]; then
+            RUNTIME="python312Action"
           fi
           ./gradlew :core:$RUNTIME:distDocker -PdockerRegistry=docker.io 
-PdockerImagePrefix=openwhisk -PdockerImageTag=$IMAGE_TAG
diff --git a/README.md b/README.md
index d25df8a..4859a02 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,7 @@ The following Python runtime versions (with kind & image 
labels) are generated b
 - Python 3.9 (python:3.9 & openwhisk/action-python-v3.9)
 - Python 3.10 (python:3.10 & openwhisk/action-python-v3.10)
 - Python 3.11 (python:3.11 & openwhisk/action-python-v3.11)
+- Python 3.12 (python:3.12 & openwhisk/action-python-v3.12)
 
 This README documents the build, customization and testing of these runtime 
images.
 
diff --git a/core/python312Action/Dockerfile b/core/python312Action/Dockerfile
new file mode 100644
index 0000000..48e8f98
--- /dev/null
+++ b/core/python312Action/Dockerfile
@@ -0,0 +1,70 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# build go proxy from source
+FROM golang:1.21 AS builder_source
+ARG GO_PROXY_GITHUB_USER=apache
+ARG GO_PROXY_GITHUB_BRANCH=master
+RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \
+   https://github.com/${GO_PROXY_GITHUB_USER}/openwhisk-runtime-go /src ;\
+   cd /src ; env GO111MODULE=on CGO_ENABLED=0 go build main/proxy.go && \
+   mv proxy /bin/proxy
+
+# or build it from a release
+FROM golang:1.21 AS builder_release
+ARG [email protected]
+RUN curl -sL \
+  
https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
+  | tar xzf -\
+  && cd openwhisk-runtime-go-*/main\
+  && GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy
+
+FROM python:3.12-bookworm
+
+# select the builder to use
+ARG GO_PROXY_BUILD_FROM=release
+
+# install zip
+RUN apt-get update && apt-get install -y zip gcc \
+    && rm -rf /var/lib/apt/lists/*
+
+# Install common modules for python
+COPY requirements_common.txt requirements_common.txt
+COPY requirements.txt requirements.txt
+RUN pip3 install --upgrade pip six wheel &&\
+    pip3 install --no-cache-dir -r requirements.txt
+
+RUN mkdir -p /action
+WORKDIR /
+
+COPY --from=builder_source /bin/proxy /bin/proxy_source
+COPY --from=builder_release /bin/proxy /bin/proxy_release
+RUN mv /bin/proxy_${GO_PROXY_BUILD_FROM} /bin/proxy
+
+ADD bin/compile /bin/compile
+ADD lib/launcher.py /lib/launcher.py
+
+# log initialization errors
+ENV OW_LOG_INIT_ERROR=1
+# the launcher must wait for an ack
+ENV OW_WAIT_FOR_ACK=1
+# using the runtime name to identify the execution environment
+ENV OW_EXECUTION_ENV=openwhisk/action-python-v3.12
+# compiler script
+ENV OW_COMPILER=/bin/compile
+
+ENTRYPOINT ["/bin/proxy"]
diff --git a/settings.gradle b/core/python312Action/build.gradle
similarity index 55%
copy from settings.gradle
copy to core/python312Action/build.gradle
index 9d0b863..ae770b2 100644
--- a/settings.gradle
+++ b/core/python312Action/build.gradle
@@ -15,31 +15,31 @@
  * limitations under the License.
  */
 
-include 'tests'
-
-include 'core:python39Action'
-include 'core:python310Action'
-include 'core:python311Action'
-
-rootProject.name = 'runtime-python'
-
-gradle.ext.openwhisk = [
-        version: '1.0.1-SNAPSHOT'
-]
-
-gradle.ext.scala = [
-    version: '2.12.10',
-    depVersion  : '2.12',
-    compileFlags: ['-feature', '-unchecked', '-deprecation', 
'-Xfatal-warnings', '-Ywarn-unused-import']
-]
-
-gradle.ext.akka = [version : '2.6.12']
-gradle.ext.akka_http = [version : '10.2.4']
-
-gradle.ext.scalafmt = [
-    version: '1.5.0',
-    config: new File(rootProject.projectDir, '.scalafmt.conf')
-]
-
-gradle.ext.akka = [version: '2.6.12']
-gradle.ext.akka_http = [version: '10.2.4']
+ext.dockerImageName = 'action-python-v3.12'
+apply from: '../../gradle/docker.gradle'
+
+distDocker.dependsOn 'copyLib'
+distDocker.dependsOn 'copyBin'
+distDocker.dependsOn 'copyReqrCommon'
+distDocker.finalizedBy('cleanup')
+
+task copyLib(type: Copy) {
+    from '../python3Action/lib'
+    into './lib'
+}
+
+task copyBin(type: Copy) {
+    from '../python3Action/bin'
+    into './bin'
+}
+
+task copyReqrCommon(type: Copy) {
+    from '../requirements_common.txt'
+    into './'
+}
+
+task cleanup(type: Delete) {
+    delete 'bin'
+    delete 'lib'
+    delete 'requirements_common.txt'
+}
diff --git a/core/python312Action/requirements.txt 
b/core/python312Action/requirements.txt
new file mode 100644
index 0000000..7c74d3a
--- /dev/null
+++ b/core/python312Action/requirements.txt
@@ -0,0 +1,15 @@
+# default packages available for action-python-v3.12
+#-r requirements_common.txt
+beautifulsoup4==4.12.3
+httplib2==0.22.0
+kafka_python==2.0.2
+lxml==5.1.0
+python-dateutil==2.8.2
+requests==2.31.0
+scrapy==2.11.0
+simplejson==3.19.2
+virtualenv==20.25.0
+twisted==22.8.0
+netifaces==0.11.0
+# fix issue: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use 
build and pip and other standards-based tools
+setuptools == 69.0.3
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 9d0b863..3d79ce1 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -20,6 +20,7 @@ include 'tests'
 include 'core:python39Action'
 include 'core:python310Action'
 include 'core:python311Action'
+include 'core:python312Action'
 
 rootProject.name = 'runtime-python'
 
diff --git a/tests/src/test/resources/build.sh 
b/tests/src/test/resources/build.sh
index 5c53bb1..7cdc2aa 100755
--- a/tests/src/test/resources/build.sh
+++ b/tests/src/test/resources/build.sh
@@ -21,7 +21,7 @@ if [ -f ".built" ]; then
   exit 0
 fi
 
-for i in v3.9 v3.10 v3.11
+for i in v3.9 v3.10 v3.11 v3.12
 do echo "*** $i ***"
    zip -r -j - python_virtualenv | docker run -i action-python-$i -compile 
main >python-${i}_virtualenv.zip
    cp python-${i}_virtualenv.zip python-${i}_virtualenv_invalid_main.zip
diff --git a/settings.gradle 
b/tests/src/test/scala/runtime/actionContainers/Python312Tests.scala
similarity index 55%
copy from settings.gradle
copy to tests/src/test/scala/runtime/actionContainers/Python312Tests.scala
index 9d0b863..6e791e3 100644
--- a/settings.gradle
+++ b/tests/src/test/scala/runtime/actionContainers/Python312Tests.scala
@@ -15,31 +15,19 @@
  * limitations under the License.
  */
 
-include 'tests'
+package runtime.actionContainers
 
-include 'core:python39Action'
-include 'core:python310Action'
-include 'core:python311Action'
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
 
-rootProject.name = 'runtime-python'
+@RunWith(classOf[JUnitRunner])
+class Python312Tests extends Python3Tests {
 
-gradle.ext.openwhisk = [
-        version: '1.0.1-SNAPSHOT'
-]
+  override lazy val imageName = "action-python-v3.12"
 
-gradle.ext.scala = [
-    version: '2.12.10',
-    depVersion  : '2.12',
-    compileFlags: ['-feature', '-unchecked', '-deprecation', 
'-Xfatal-warnings', '-Ywarn-unused-import']
-]
+  override lazy val zipPrefix = "python-v3.12"
 
-gradle.ext.akka = [version : '2.6.12']
-gradle.ext.akka_http = [version : '10.2.4']
+  override lazy val errorCodeOnRun = false
 
-gradle.ext.scalafmt = [
-    version: '1.5.0',
-    config: new File(rootProject.projectDir, '.scalafmt.conf')
-]
-
-gradle.ext.akka = [version: '2.6.12']
-gradle.ext.akka_http = [version: '10.2.4']
+  override val testNoSource = TestConfig("", hasCodeStub = false)
+}

Reply via email to