Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 98c2c69

Browse files
authored
Add Python 3.9 (#157)
Add runtime Python 3.9 Update Python packages set openwhisk/action-python-v3.9 base image to current tag d1c3d3f Adapt cloudant and watson test for new sdk and versions migration from 3.7 to 3.9
1 parent cd82df1 commit 98c2c69

32 files changed

+613
-41
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ deploy:
2525
all_branches: true
2626
repo: ibm-functions/runtime-python
2727
- provider: script
28-
script: "./tools/travis/publish.sh ibmfunctions 3.6 master && ./tools/travis/publish.sh ibmfunctions 3.7 master "
28+
script: "./tools/travis/publish.sh ibmfunctions 3.6 master && ./tools/travis/publish.sh ibmfunctions 3.7 master && ./tools/travis/publish.sh ibmfunctions 3.9 master"
2929
on:
3030
branch: master
3131
repo: ibm-functions/runtime-python

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# IBM Cloud Functions Runtime for Python
22
[![Build Status](https://travis-ci.com/ibm-functions/runtime-python.svg?branch=master)](https://travis-ci.com/ibm-functions/runtime-python)
33

4+
- The runtime provides [python v3.9](python3.9/) with a set of [python packages](python3.9/requirements.txt), see [python3.9/CHANGELOG.md](python3.9/CHANGELOG.md)
45
- The runtime provides [python v3.7](python3.7/) with a set of [python packages](python3.7/requirements.txt), see [python3.7/CHANGELOG.md](python3.7/CHANGELOG.md)
56
- The runtime provides [python v3.6](python3.6/) with a set of [python packages](python3.6/requirements.txt), see [python3.6/CHANGELOG.md](python3.6/CHANGELOG.md)
67

ansible/environments/local/group_vars/all

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,10 @@ runtimes_manifest:
5555
image:
5656
name: "action-python-v3.7"
5757
deprecated: false
58+
- kind: "python:3.9"
59+
default: false
60+
image:
61+
name: "action-python-v3.9"
62+
deprecated: false
5863
blackboxes:
5964
- name: "dockerskeleton"

python3.9/CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# IBM Functions Python 3.9 Runtime Container
2+
3+
## Migrating from Python:3.7 to Python:3.9
4+
- Replaced `cloudant` with `ibmcloudant`
5+
- The `cloudant` sdk has moved to the new `ibmcloudant` sdk. It includes a number of breaking changes. See [migration guide](https://github.com/cloudant/python-cloudant/blob/master/MIGRATION.md) for more information.
6+
- [pypi cloudant](https://pypi.org/project/cloudant/)
7+
- Replaced `watson-developer-cloud` with `ibm-watson`
8+
- The `watson-developer-cloud` sdk has renamed to the new `ibm-watson` sdk and includes breaking changes.
9+
- [pypi ibm-watson](https://pypi.org/project/ibm-watson/)
10+
- [github ibm-watson](https://github.com/watson-developer-cloud/python-sdk)
11+
12+
## 1.0.0
13+
Changes:
14+
- update all packages to their lates versions
15+
16+
Python version:
17+
- [3.9.9](https://www.python.org/downloads/release/python-399/)
18+
19+
Python packages:
20+
- The file [requirements.txt](requirements.txt) lists the packages we guarantee to be included in this runtime.<br/>
21+
Ensure that you only use packages mentioned there.<br/>
22+
Other python packages might be part of this runtime, but only due to indirect dependencies of the above listed packages. These indirectly included packages are candidates to be removed at any time in case they are not required by the referring package anymore.

python3.9/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM openwhisk/action-python-v3.9:d1c3d3f
2+
3+
COPY requirements.txt requirements.txt
4+
5+
RUN apt-get update \
6+
# Upgrade installed packages to get latest security fixes if the base image does not contain them already.
7+
&& apt-get upgrade -y --no-install-recommends \
8+
# cleanup package lists, they are not used anymore in this image
9+
&& rm -rf /var/lib/apt/lists/* \
10+
# We do not have mysql-server installed but mysql-common contains config files (/etc/mysql/my.cnf) for it.
11+
# We need to add some dummy entries to /etc/mysql/my.cnf to sattisfy vulnerability checking of it.
12+
&& echo "\n[mysqld]\nssl-ca=/tmp/ca.pem\nssl-cert=/tmp/server-cert.pem\nssl-key=/tmp/server-key.pem\n" >> /etc/mysql/my.cnf \
13+
# install additional python modules
14+
# we pin setuptools==57.5.0, reason is that ibm_db<=3.0.4 requires 'use_2to3' during install which has been
15+
# removed from setuptools starting with the 58.x.x release. The install therefore fails with:
16+
# error in ibm_db setup command: use_2to3 is invalid.
17+
# When ibm_db is upgraded to a version that does not need 'use_2to3' anymore the pin can also be removed.
18+
&& pip install --upgrade pip \
19+
&& pip install --no-cache-dir -r requirements.txt \
20+
# Show actual python version in the build output.
21+
&& echo "Actual python version is:" \
22+
&& python --version \
23+
# Show actual /bin/proxy version in the build output, makes it easier to check if go security fixes need to be applied.
24+
&& echo "Actual /bin/proxy version is:" \
25+
&& /bin/proxy -version

python3.9/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ext.dockerImageName = 'action-python-v3.9'
2+
apply from: '../gradle/docker.gradle'

python3.9/requirements.txt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This requirements.txt file contains the list of packages included in the Python 3.9 runtime.
2+
#
3+
# These packages are guaranteed to be included. Ensure that your action code only uses the listed ones.
4+
# Other Python packages might be part of the runtime, but only due to indirect dependencies of
5+
# the listed packages. These indirectly included packages are candidates to be removed
6+
# at any time in case they are not required by the referring package anymore.
7+
8+
9+
# Setup modules
10+
gevent == 21.8.0
11+
flask == 2.0.2
12+
13+
# default available packages for python3action
14+
beautifulsoup4 == 4.10.0
15+
httplib2 == 0.20.2
16+
kafka_python == 2.0.2
17+
lxml == 4.6.4
18+
python-dateutil == 2.8.2
19+
requests == 2.26.0
20+
scrapy == 2.5.1
21+
simplejson == 3.17.6
22+
virtualenv == 20.10.0
23+
twisted == 21.7.0
24+
PyJWT == 2.3.0
25+
26+
# packages for numerics
27+
numpy == 1.21.4
28+
scikit-learn == 1.0.1
29+
scipy == 1.7.2
30+
pandas == 1.3.4
31+
32+
# packages for image processing
33+
Pillow == 8.4.0
34+
35+
# IBM specific python modules
36+
ibm_db == 3.1.0
37+
ibmcloudant == 0.0.40
38+
ibm-watson == 5.3.0
39+
ibm-cos-sdk == 2.10.0
40+
ibmcloudsql == 0.5.0
41+
42+
# Compose Libs
43+
psycopg2 == 2.9.2
44+
pymongo == 3.12.1
45+
redis == 4.0.1
46+
pika == 1.2.0
47+
elasticsearch == 7.15.2
48+
cassandra-driver == 3.25.0
49+
etcd3 == 0.12.0
50+
51+
# Other required modules
52+
botocore == 1.23.8
53+
tornado == 6.1

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ include 'tests'
22

33
include 'python3.6'
44
include 'python3.7'
5+
include 'python3.9'
56

67
rootProject.name = 'runtime-python-ibm'
78

Binary file not shown.

tests/dat/cloudant/testCloudantSDK.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44

55

66
def main(dict):
7+
load_successful = False
78
client = Cloudant("test-user", "test", url='https://{0}'.format("host.cloudant.com"))
8-
return {"_user": client._user,
9-
"server_url": client.server_url}
9+
if client._user == "test-user" and client.server_url == "https://host.cloudant.com":
10+
load_successful = True
11+
return {
12+
"load_successful" : load_successful
13+
}
1014

1115

1216
if __name__ == "__main__":

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy