diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 81f75fb6..0e0b48ad 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -98,6 +98,8 @@ jobs: ./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 + ./gradlew :core:python313Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=nightly + ./gradlew :core:python313Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT - name: Push Release Images if: ${{ env.PUSH_RELEASE == 'true' }} working-directory: runtime @@ -112,5 +114,7 @@ jobs: RUNTIME="python311Action" elif [ ${RUNTIME_VERSION} == "312" ]; then RUNTIME="python312Action" + elif [ ${RUNTIME_VERSION} == "313" ]; then + RUNTIME="python313Action" fi ./gradlew :core:$RUNTIME:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$IMAGE_TAG diff --git a/README.md b/README.md index 4859a026..1cc244aa 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ The following Python runtime versions (with kind & image labels) are generated b - 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) +- Python 3.13 (python:3.13 & openwhisk/action-python-v3.13) This README documents the build, customization and testing of these runtime images. diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index ab9f5d52..8de756ec 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -19,6 +19,10 @@ # Python 3 OpenWhisk Runtime Container +## Next + - add Python 3.13 + - update Python 3.9 base image to bookworm + ## 1.20.0 - Dependabot Fixes (#159) - Update virtualenv for python:3.9 to fix tests. (#161) diff --git a/core/python313Action/Dockerfile b/core/python313Action/Dockerfile new file mode 100644 index 00000000..64071c98 --- /dev/null +++ b/core/python313Action/Dockerfile @@ -0,0 +1,71 @@ +# +# 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.24 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.24 AS builder_release +ARG GO_PROXY_RELEASE_VERSION=1.23@1.25.0 +ARG GO_PROXY_GITHUB_USER=apache +RUN curl -sL \ + https://github.com/${GO_PROXY_GITHUB_USER}/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.13-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/core/python313Action/build.gradle b/core/python313Action/build.gradle new file mode 100644 index 00000000..f820c31c --- /dev/null +++ b/core/python313Action/build.gradle @@ -0,0 +1,45 @@ +/* + * 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. + */ + +ext.dockerImageName = 'action-python-v3.13' +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/python313Action/requirements.txt b/core/python313Action/requirements.txt new file mode 100644 index 00000000..9210016f --- /dev/null +++ b/core/python313Action/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.2 +simplejson==3.19.2 +virtualenv==20.25.0 +twisted==24.7.0 +netifaces==0.11.0 +# fix issue: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools +setuptools == 70.0.0 \ No newline at end of file diff --git a/core/python39Action/Dockerfile b/core/python39Action/Dockerfile index b654f977..310153b7 100644 --- a/core/python39Action/Dockerfile +++ b/core/python39Action/Dockerfile @@ -34,7 +34,7 @@ RUN curl -sL \ && cd openwhisk-runtime-go-*/main\ && GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy -FROM python:3.9-buster +FROM python:3.9-bookworm # select the builder to use ARG GO_PROXY_BUILD_FROM=release diff --git a/settings.gradle b/settings.gradle index 9070b13a..d21803ce 100644 --- a/settings.gradle +++ b/settings.gradle @@ -21,6 +21,7 @@ include 'core:python39Action' include 'core:python310Action' include 'core:python311Action' include 'core:python312Action' +include 'core:python313Action' rootProject.name = 'runtime-python' diff --git a/tests/src/test/scala/runtime/actionContainers/Python313Tests.scala b/tests/src/test/scala/runtime/actionContainers/Python313Tests.scala new file mode 100644 index 00000000..40e4853c --- /dev/null +++ b/tests/src/test/scala/runtime/actionContainers/Python313Tests.scala @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package runtime.actionContainers + +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +class Python313Tests extends Python3Tests { + + override lazy val imageName = "action-python-v3.13" + + override lazy val zipPrefix = "python-v3.13" + + override lazy val errorCodeOnRun = false + + override val testNoSource = TestConfig("", hasCodeStub = false) +}