Skip to content

Commit

Permalink
feat(python): support Python 3.11 (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
briandealwis authored Jul 12, 2023
1 parent c3f8cca commit 6711da4
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 11 deletions.
8 changes: 8 additions & 0 deletions python/helper-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ COPY pydevd_2_9_5.patch ./pydevd.patch
RUN patch --binary -p0 -d /dbgpy/pydevd/python3.10/lib/python3.10/site-packages < pydevd.patch
RUN PYTHONUSERBASE=/dbgpy/pydevd-pycharm/python3.10 pip install --user pydevd-pycharm --no-warn-script-location

FROM python:3.11 as python3_11
RUN PYTHONUSERBASE=/dbgpy pip install --user ptvsd debugpy
RUN PYTHONUSERBASE=/dbgpy/pydevd/python3.11 pip install --user pydevd==2.9.5 --no-warn-script-location
COPY pydevd_2_9_5.patch ./pydevd.patch
RUN patch --binary -p0 -d /dbgpy/pydevd/python3.11/lib/python3.11/site-packages < pydevd.patch
RUN PYTHONUSERBASE=/dbgpy/pydevd-pycharm/python3.11 pip install --user pydevd-pycharm --no-warn-script-location

FROM --platform=$BUILDPLATFORM golang:1.17 as build
ARG BUILDPLATFORM
ARG TARGETOS
Expand All @@ -101,4 +108,5 @@ COPY --from=python37 /dbgpy/ python/
COPY --from=python38 /dbgpy/ python/
COPY --from=python39 /dbgpy/ python/
COPY --from=python3_10 /dbgpy/ python/
COPY --from=python3_11 /dbgpy/ python/
COPY --from=build /go/launcher python/
13 changes: 11 additions & 2 deletions python/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ profiles:
- op: add
path: /build/artifacts/-
value:
image: python310app
image: python3_10app
context: test/pythonapp
docker:
buildArgs:
PYTHONVERSION: "3.10"
- op: add
path: /build/artifacts/-
value:
image: python3_11app
context: test/pythonapp
docker:
buildArgs:
PYTHONVERSION: "3.11"
- op: add
path: /build/artifacts/-
value:
Expand All @@ -69,7 +77,8 @@ profiles:
kubectl:
manifests:
- test/k8s-test-pydevd-python39.yaml
- test/k8s-test-pydevd-python310.yaml
- test/k8s-test-pydevd-python3_10.yaml
- test/k8s-test-pydevd-python3_11.yaml

# release: pushes images to production with :latest
- name: release
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: python310pod
name: python3-10pod
labels:
app: hello
protocol: pydevd
runtime: python310
runtime: python3_10
spec:
containers:
- name: python310app
image: python310app
- name: python3-10app
image: python3_10app
command: ["/dbg/python/launcher", "--mode", "pydevd", "--port", "12345", "--"]
args: ["python", "-m", "flask", "run", "--host=0.0.0.0"]
ports:
Expand Down Expand Up @@ -41,7 +41,7 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: hello-pydevd-python310
name: hello-pydevd-python3-10
spec:
ports:
- name: http
Expand All @@ -53,13 +53,13 @@ spec:
selector:
app: hello
protocol: pydevd
runtime: python310
runtime: python3_10

---
apiVersion: batch/v1
kind: Job
metadata:
name: connect-to-python310
name: connect-to-python3-10
labels:
project: container-debug-support
type: integration-test
Expand All @@ -70,8 +70,8 @@ spec:
spec:
restartPolicy: Never
containers:
- name: verify-python310
- name: verify-python3-10
image: pydevconnect
args: ["hello-pydevd-python310:12345"]
args: ["hello-pydevd-python3-10:12345"]


77 changes: 77 additions & 0 deletions python/test/k8s-test-pydevd-python3_11.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
apiVersion: v1
kind: Pod
metadata:
name: python3-11pod
labels:
app: hello
protocol: pydevd
runtime: python3_11
spec:
containers:
- name: python3-11app
image: python3_11app
command: ["/dbg/python/launcher", "--mode", "pydevd", "--port", "12345", "--"]
args: ["python", "-m", "flask", "run", "--host=0.0.0.0"]
ports:
- containerPort: 5000
- containerPort: 12345
name: pydevd
env:
- name: WRAPPER_VERBOSE
value: debug
readinessProbe:
httpGet:
path: /
port: 5000
volumeMounts:
- mountPath: /dbg
name: python-debugging-support
initContainers:
- image: skaffold-debug-python
name: install-python-support
resources: {}
volumeMounts:
- mountPath: /dbg
name: python-debugging-support
volumes:
- emptyDir: {}
name: python-debugging-support

---
apiVersion: v1
kind: Service
metadata:
name: hello-pydevd-python3-11
spec:
ports:
- name: http
port: 5000
protocol: TCP
- name: pydevd
port: 12345
protocol: TCP
selector:
app: hello
protocol: pydevd
runtime: python3_11

---
apiVersion: batch/v1
kind: Job
metadata:
name: connect-to-python3-11
labels:
project: container-debug-support
type: integration-test
spec:
ttlSecondsAfterFinished: 10
backoffLimit: 1
template:
spec:
restartPolicy: Never
containers:
- name: verify-python3-11
image: pydevconnect
args: ["hello-pydevd-python3-11:12345"]


0 comments on commit 6711da4

Please sign in to comment.