Skip to content

Commit c12963f

Browse files
author
Matt Curtis
committed
Add Python 3.8.5
Python 3.8.5 based off slim-buster is about 82% the size of slim-stretch.
1 parent b13078f commit c12963f

10 files changed

Lines changed: 62 additions & 15 deletions

File tree

.circleci/config.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ orbs:
44
jobs:
55
"test":
66
docker:
7-
- image: circleci/python:3.7.0
7+
- image: circleci/python:3.8.5
88
working_directory: ~/fdk-python
99
steps:
1010
- checkout
@@ -31,10 +31,10 @@ jobs:
3131
- run:
3232
command: |
3333
. venv/bin/activate
34-
tox -epy3.7
34+
tox -epy3.8
3535
"deploy":
3636
docker:
37-
- image: circleci/python:3.7.0
37+
- image: circleci/python:3.8.5
3838
working_directory: ~/fdk-python
3939
steps:
4040
- checkout
@@ -56,6 +56,7 @@ jobs:
5656
5757
./build-images.sh 3.6
5858
./build-images.sh 3.7.1
59+
./build-images.sh 3.8.5
5960
./release.sh
6061
./release_images.sh
6162
fi
@@ -98,6 +99,25 @@ jobs:
9899
policy_bundle_file_path: .circleci/.anchore/policy_bundle.json
99100
- anchore/parse_reports
100101

102+
"python385_security_check":
103+
executor: anchore/anchore_engine
104+
working_directory: ~/fdk-python
105+
steps:
106+
- setup_remote_docker:
107+
docker_layer_caching: false
108+
- checkout
109+
- run:
110+
name: Python 3.8.5 build
111+
command: |
112+
apk add bash
113+
./build-images.sh 3.8.5
114+
- anchore/analyze_local_image:
115+
image_name: "fnproject/python:3.8.5-dev fnproject/python:3.8.5"
116+
timeout: '500'
117+
policy_failure: true
118+
policy_bundle_file_path: .circleci/.anchore/policy_bundle.json
119+
- anchore/parse_reports
120+
101121
workflows:
102122
version: 2
103123
build:
@@ -118,3 +138,4 @@ workflows:
118138
jobs:
119139
- "python36_security_check"
120140
- "python371_security_check"
141+
- "python385_security_check"

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Function development kit for Python
2-
The python FDK lets you write functions in python 3.6/3.7
2+
The python FDK lets you write functions in python 3.6/3.7/3.8
33

44
## Simplest possible function
55

@@ -306,12 +306,12 @@ Then just do:
306306

307307
First of all create a test function:
308308
```bash
309-
fn init --runtime python3.7.1 test-function
309+
fn init --runtime python3.8.5 test-function
310310
```
311311

312312
Create a Dockerfile in a function's folder:
313313
```dockerfile
314-
FROM fnproject/python:3.7.1-dev as build-stage
314+
FROM fnproject/python:3.8.5-dev as build-stage
315315

316316
ADD . /function
317317
WORKDIR /function
@@ -320,7 +320,7 @@ RUN pip3 install --target /python/ --no-cache --no-cache-dir fdk-test-py3-none-
320320

321321
RUN rm -fr ~/.cache/pip /tmp* requirements.txt func.yaml Dockerfile .venv
322322

323-
FROM fnproject/python:3.7.1
323+
FROM fnproject/python:3.8.5
324324

325325
COPY --from=build-stage /function /function
326326
COPY --from=build-stage /python /python
@@ -398,7 +398,7 @@ If you've been using json lib to turn an incoming data into a dictionary you nee
398398
### Dockerfile
399399
If you've been using CLI to build function without modifying runtime in `func.yaml` to `docker`
400400
instead of `python` then the only thing you need is to update the CLI to the latest version and
401-
pin your Python runtime version to `python` or `python3.7.1`.
401+
pin your Python runtime version to `python`, `python3.7.1`, or `python3.8.5`.
402402

403403
If you've been using custom multi-stage Dockerfile (derived from what Fn CLI generates)
404404
the only thing that is necessary to change is an `ENTRYPOINT` from:

build-images.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -xe
44

5-
pyversion=${1:-"3.7.1"}
5+
pyversion=${1:-"3.8.5"}
66

77
pushd images/build-stage/${pyversion} && docker build -t fnproject/python:${pyversion}-dev . && popd
88
pushd images/runtime/${pyversion} && docker build -t fnproject/python:${pyversion} . && popd

images/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ pushd build-stage/3.7.1; docker build -t fnproject/python:3.7.1-dev .; popd
1212
pushd runtime/3.7.1; docker build -t fnproject/python:3.7.1 .; popd
1313
```
1414

15+
```sh
16+
pushd build-stage/3.8.5; docker build -t fnproject/python:3.8.5-dev .; popd
17+
pushd runtime/3.8.5; docker build -t fnproject/python:3.8.5 .; popd
18+
```
19+
1520
Then push:
1621

1722
```sh
@@ -23,3 +28,8 @@ docker push fnproject/python:3.6
2328
docker push fnproject/python:3.7.1-dev
2429
docker push fnproject/python:3.7.1
2530
```
31+
32+
```sh
33+
docker push fnproject/python:3.8.5-dev
34+
docker push fnproject/python:3.8.5
35+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM python:3.8.5-slim-buster
2+
3+
RUN apt-get update && apt-get upgrade -qy && \
4+
apt-get install --no-install-recommends -qy build-essential gcc && \
5+
apt-get clean

images/runtime/3.8.5/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM python:3.8.5-slim-buster
2+
3+
RUN apt-get update && apt-get upgrade -qy && apt-get clean
4+
RUN addgroup --system --gid 1000 fn && adduser --system --uid 1000 --ingroup fn fn

release_images.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
user="fnproject"
44
image="python"
5-
runtime36="3.6"
6-
runtime371="3.7.1"
75

6+
runtime36="3.6"
87
docker push ${user}/${image}:${runtime36}
98
docker push ${user}/${image}:${runtime36}-dev
109

10+
runtime371="3.7.1"
1111
docker push ${user}/${image}:${runtime371}
1212
docker push ${user}/${image}:${runtime371}-dev
13+
14+
runtime385="3.8.5"
15+
docker push ${user}/${image}:${runtime385}
16+
docker push ${user}/${image}:${runtime385}-dev

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ classifier =
1414
Operating System :: POSIX :: Linux
1515
Programming Language :: Python
1616
Programming Language :: Python :: 3
17-
Programming Language :: Python :: 3.7
17+
Programming Language :: Python :: 3.8
1818

1919
[files]
2020
packages =

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
flake8<2.7.0,>=2.6.0
1+
flake8>=2.6.0
22
hacking==1.1.0
33
pytest==5.4.3
44
pytest-cov==2.9.0

tox.ini

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[tox]
2-
envlist = py{3.7,3.6},pep8
2+
envlist = py{3.8,3.7,3.6},pep8
33
skipsdist = True
44

55
[testenv]
66
basepython =
7-
pep8: python3.7
7+
pep8: python3.8
8+
py3.8: python3.8
89
py3.7: python3.7
910
py3.6: python3.6
1011

@@ -26,6 +27,8 @@ commands = flake8
2627
[testenv:venv]
2728
commands = {posargs}
2829

30+
[testenv:py3.8]
31+
commands = pytest -v -s --tb=long --cov=fdk {toxinidir}/fdk/tests
2932

3033
[testenv:py3.7]
3134
commands = pytest -v -s --tb=long --cov=fdk {toxinidir}/fdk/tests

0 commit comments

Comments
 (0)