drop support for Python 3.7 (EOL June 2023) (#147)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c9e22fa..65c9e06 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml
@@ -88,8 +88,6 @@ working-directory: runtime run: | SHORT_COMMIT=$(git rev-parse --short "$GITHUB_SHA") - ./gradlew :core:python3Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=nightly - ./gradlew :core:python3Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT ./gradlew :core:python39Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=nightly ./gradlew :core:python39Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT ./gradlew :core:python310Action:distDocker -PdockerRegistry=docker.io -PdockerImagePrefix=openwhisk -PdockerImageTag=nightly @@ -102,9 +100,7 @@ run: | RUNTIME_VERSION=${GITHUB_REF_NAME%@*} IMAGE_TAG=${GITHUB_REF_NAME##*@} - if [ ${RUNTIME_VERSION} == "3" ]; then - RUNTIME="python3Action" - elif [ ${RUNTIME_VERSION} == "39" ]; then + if [ ${RUNTIME_VERSION} == "39" ]; then RUNTIME="python39Action" elif [ ${RUNTIME_VERSION} == "310" ]; then RUNTIME="python310Action"
diff --git a/README.md b/README.md index 9eaff37..d25df8a 100644 --- a/README.md +++ b/README.md
@@ -25,7 +25,6 @@ The following Python runtime versions (with kind & image labels) are generated by the build system: -- Python 3.7 (python:3.7 & openwhisk/action-python-v3.7) - 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) @@ -90,10 +89,10 @@ You can optionally build a specific image by modifying the gradle command. For example: ``` -./gradlew core:python3Action:distDocker +./gradlew core:python311Action:distDocker ``` -The build will produce Docker images such as `action-python-v3.7` +The build will produce Docker images such as `action-python-v3.11` and will also tag the same image with the `whisk/` prefix. The latter is a convenience, which if you're testing with a local OpenWhisk stack, allows you to skip pushing the image to Docker Hub. @@ -120,11 +119,11 @@ ### Using Your Image as an OpenWhisk Action You can now use this image as an OpenWhisk action. For example, to use -the image `action-python-v3.7` as an action runtime, you would run +the image `action-python-v3.11` as an action runtime, you would run the following command. ``` -wsk action update myAction myAction.py --docker $DOCKER_USER/action-python-v3.7 +wsk action update myAction myAction.py --docker $DOCKER_USER/action-python-v3.11 ``` ## Test Runtimes @@ -178,9 +177,9 @@ If you have an action in the format described before (with a `requirements.txt`) you can build the zip file with the included files with: ``` -zip -j -r myaction | docker run -i action-python-v3.7 -compile main > myaction.zip +zip -j -r myaction | docker run -i action-python-v3.11 -compile main > myaction.zip ``` -You may use `v3.11`, `v3.10`, or `v3.9` as well according to your Python version needs. +You may use `v3.11`, `v3.10`, or `v3.9` according to your Python version needs. The resulting action includes a virtualenv already built for you and that is fast to deploy and start as all the dependencies are already resolved. Note that there is a limit on the size of the zip file and this approach will not work for installing large libraries like Pandas or Numpy, instead build a custom docker image that includes these libraries.
diff --git a/core/python3Action/Dockerfile b/core/python3Action/Dockerfile deleted file mode 100644 index 291b9fb..0000000 --- a/core/python3Action/Dockerfile +++ /dev/null
@@ -1,66 +0,0 @@ -# -# 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.18 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.18 AS builder_release -ARG GO_PROXY_RELEASE_VERSION=1.18@1.20.0 -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.7-buster - -# select the builder to use -ARG GO_PROXY_BUILD_FROM=release - -# 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 -# execution environment -ENV OW_EXECUTION_ENV=openwhisk/action-python-v3.7 -# compiler script -ENV OW_COMPILER=/bin/compile - -ENTRYPOINT ["/bin/proxy"]
diff --git a/core/python3Action/Makefile b/core/python3Action/Makefile deleted file mode 100644 index 7430512..0000000 --- a/core/python3Action/Makefile +++ /dev/null
@@ -1,31 +0,0 @@ -# -# 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. -# -IMG=whisk/actionloop-python-v3.7:latest - -build: - docker build -t $(IMG) . - -clean: - docker rmi -f $(IMG) - -debug: build - docker run -p 8080:8080 \ - -ti --entrypoint=/bin/bash -v $(PWD):/mnt \ - -e OW_COMPILER=/mnt/bin/compile \ - $(IMG) - -.PHONY: build clean debug
diff --git a/core/python3Action/build.gradle b/core/python3Action/build.gradle deleted file mode 100644 index e3b2382..0000000 --- a/core/python3Action/build.gradle +++ /dev/null
@@ -1,31 +0,0 @@ -/* - * 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.7' -apply from: '../../gradle/docker.gradle' - -distDocker.dependsOn 'copyReqrCommon' -distDocker.finalizedBy('cleanup') - -task copyReqrCommon(type: Copy) { - from '../requirements_common.txt' - into './' -} - -task cleanup(type: Delete) { - delete 'requirements_common.txt' -}
diff --git a/core/python3Action/requirements.txt b/core/python3Action/requirements.txt deleted file mode 100644 index 0ab215a..0000000 --- a/core/python3Action/requirements.txt +++ /dev/null
@@ -1,2 +0,0 @@ -# default packages available for action-python-v3.7 --r requirements_common.txt
diff --git a/settings.gradle b/settings.gradle index 2976fbe..9d0b863 100644 --- a/settings.gradle +++ b/settings.gradle
@@ -17,7 +17,6 @@ include 'tests' -include 'core:python3Action' include 'core:python39Action' include 'core:python310Action' include 'core:python311Action'
diff --git a/tests/src/test/resources/build.sh b/tests/src/test/resources/build.sh index a8f651c..5c53bb1 100755 --- a/tests/src/test/resources/build.sh +++ b/tests/src/test/resources/build.sh
@@ -21,7 +21,7 @@ exit 0 fi -for i in v3.7 v3.9 v3.10 v3.11 +for i in v3.9 v3.10 v3.11 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/tests/src/test/scala/runtime/actionContainers/Python310Tests.scala b/tests/src/test/scala/runtime/actionContainers/Python310Tests.scala index 4db7721..a65f3a6 100644 --- a/tests/src/test/scala/runtime/actionContainers/Python310Tests.scala +++ b/tests/src/test/scala/runtime/actionContainers/Python310Tests.scala
@@ -21,7 +21,7 @@ import org.scalatest.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) -class Python310Tests extends Python37Tests { +class Python310Tests extends Python3Tests { override lazy val imageName = "action-python-v3.10"
diff --git a/tests/src/test/scala/runtime/actionContainers/Python311Tests.scala b/tests/src/test/scala/runtime/actionContainers/Python311Tests.scala index e758872..5d36a14 100644 --- a/tests/src/test/scala/runtime/actionContainers/Python311Tests.scala +++ b/tests/src/test/scala/runtime/actionContainers/Python311Tests.scala
@@ -21,7 +21,7 @@ import org.scalatest.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) -class Python311Tests extends Python37Tests { +class Python311Tests extends Python3Tests { override lazy val imageName = "action-python-v3.11"
diff --git a/tests/src/test/scala/runtime/actionContainers/Python39Tests.scala b/tests/src/test/scala/runtime/actionContainers/Python39Tests.scala index 344e672..cb41dab 100644 --- a/tests/src/test/scala/runtime/actionContainers/Python39Tests.scala +++ b/tests/src/test/scala/runtime/actionContainers/Python39Tests.scala
@@ -21,7 +21,7 @@ import org.scalatest.junit.JUnitRunner @RunWith(classOf[JUnitRunner]) -class Python39Tests extends Python37Tests { +class Python39Tests extends Python3Tests { override lazy val imageName = "action-python-v3.9"
diff --git a/tests/src/test/scala/runtime/actionContainers/Python37Tests.scala b/tests/src/test/scala/runtime/actionContainers/Python3Tests.scala similarity index 90% rename from tests/src/test/scala/runtime/actionContainers/Python37Tests.scala rename to tests/src/test/scala/runtime/actionContainers/Python3Tests.scala index be40663..25d5dd1 100644 --- a/tests/src/test/scala/runtime/actionContainers/Python37Tests.scala +++ b/tests/src/test/scala/runtime/actionContainers/Python3Tests.scala
@@ -26,16 +26,9 @@ import spray.json._ @RunWith(classOf[JUnitRunner]) -class Python37Tests extends PythonBasicTests with PythonAdvancedTests with WskActorSystem { +abstract class Python3Tests extends PythonBasicTests with PythonAdvancedTests with WskActorSystem { - override lazy val imageName = "action-python-v3.7" - - lazy val zipPrefix = "python-v3.7" - - override val testNoSource = TestConfig("", hasCodeStub = false) - - /** actionloop based image does not log init errors - return the error in the body */ - override lazy val errorCodeOnRun = false + lazy val zipPrefix = "???" def testArtifact(name: String): File = { new File(this.getClass.getClassLoader.getResource(name).toURI)
diff --git a/tutorials/local_build.md b/tutorials/local_build.md index ab0c33f..b00adaf 100644 --- a/tutorials/local_build.md +++ b/tutorials/local_build.md
@@ -32,45 +32,45 @@ ## Build the docker image -Build docker image using Python 3.7 (recommended). This tutorial assumes you're building with python 3.7. +Build docker image using Python 3.11 (recommended). This tutorial assumes you're building with python 3.11. Run `local_build.sh` to build docker. This script takes two parameters as input -- `-r` Specific runtime image folder name to be built, it can be one of `python3Action`, `python39Action`, `python310Action`, or `python311Action` -- `-t` The name for docker image and tag used for building the docker image. Example: `action-python-v3.7:1.0-SNAPSHOT` +- `-r` Specific runtime image folder name to be built, it can be one of `python39Action`, `python310Action`, or `python311Action` +- `-t` The name for docker image and tag used for building the docker image. Example: `action-python-v3.11:1.0-SNAPSHOT` ``` cd tutorials chmod 755 local_build.sh cd .. -./tutorials/local_build.sh -r python3Action -t action-python-v3.7:1.0-SNAPSHOT +./tutorials/local_build.sh -r python311Action -t action-python-v3.11:1.0-SNAPSHOT ``` ### Verify docker image -Check docker `IMAGE ID` (3rd column) for repository `action-python-v3.7` +Check docker `IMAGE ID` (3rd column) for repository `action-python-v3.11` ``` docker images ``` If the `local_build.sh` script is sucessful, you should see an image that looks something like: ``` -action-python-v3.7 1.0-SNAPSHOT ... +action-python-v3.11 1.0-SNAPSHOT ... ``` ### (Optional) Tag docker image This is required if you’re pushing your docker image to a registry e.g. dockerHub ``` -docker tag <docker_image_ID> <dockerHub_username>/action-python-v3.7:1.0-SNAPSHOT +docker tag <docker_image_ID> <dockerHub_username>/action-python-v3.11:1.0-SNAPSHOT ``` ## Run docker image Run docker on localhost with either the following commands: ``` -docker run -p 127.0.0.1:80:8080/tcp --name=bloom_whisker --rm -it action-python-v3.7:1.0-SNAPSHOT +docker run -p 127.0.0.1:80:8080/tcp --name=bloom_whisker --rm -it action-python-v3.11:1.0-SNAPSHOT ``` Or run the container in the background (Add -d (detached) to the command above) ``` -docker run -d -p 127.0.0.1:80:8080/tcp --name=bloom_whisker --rm -it action-python-v3.7:1.0-SNAPSHOT +docker run -d -p 127.0.0.1:80:8080/tcp --name=bloom_whisker --rm -it action-python-v3.11:1.0-SNAPSHOT ``` **Note:** If you run your docker container in the background you'll want to stop it with: ```
diff --git a/tutorials/local_build.sh b/tutorials/local_build.sh index d6f16ea..0934066 100755 --- a/tutorials/local_build.sh +++ b/tutorials/local_build.sh
@@ -20,8 +20,8 @@ { echo "" echo "Usage: $0 -r runtimeParameter -t dockerImageTag" - echo -e "\t-r Specific runtime image folder name to be built, it can be one of python3Action, python39Action, python310Action, or python311Action" - echo -e "\t-t The name for docker image and tag used for building the docker image. Example: action-python-v3.7:1.0-SNAPSHOT" + echo -e "\t-r Specific runtime image folder name to be built, it can be one of python39Action, python310Action, or python311Action" + echo -e "\t-t The name for docker image and tag used for building the docker image. Example: action-python-v3.11:1.0-SNAPSHOT" exit 1 #Exit script } @@ -35,20 +35,14 @@ done # Print helperInstructions in case parameters are empty -if [ -z "$runtimeParameter" ] || [ -z "$dockerImageTag" ] || ( [[ "$runtimeParameter" != "python3Action" ]] && [[ "$runtimeParameter" != "python39Action" ]] && [[ "$runtimeParameter" != "python310Action" ]] && [[ "$runtimeParameter" != "python311Action" ]] ) +if [ -z "$runtimeParameter" ] || [ -z "$dockerImageTag" ] || ( [[ "$runtimeParameter" != "python39Action" ]] && [[ "$runtimeParameter" != "python310Action" ]] && [[ "$runtimeParameter" != "python311Action" ]] ) then echo "Runtime parameter is empty or not supported"; helperInstructions fi # For every runtime 1. copy the required dependent folders 2. build the docker image 3. delete the copied folder -if [[ "$runtimeParameter" == "python3Action" ]] - then - echo "Building docker for python3Action." - cp $(pwd)/core/requirements_common.txt $(pwd)/core/python3Action/requirements_common.txt - docker build -t "$dockerImageTag" $(pwd)/core/python3Action - rm $(pwd)/core/python3Action/requirements_common.txt -elif [[ "$runtimeParameter" == "python39Action" ]] +if [[ "$runtimeParameter" == "python39Action" ]] then echo "Building docker for python39Action." cp $(pwd)/core/requirements_common.txt $(pwd)/core/python39Action/requirements_common.txt