Skip to content

Commit 0b835a7

Browse files
chore: upgrade to python 3.12 for crud-web-apps (#757)
* feat: Upgrade Python to 3.12 for CRUD web apps Upgrade Python toolchain from 3.10 to 3.12 for all three CRUD web applications (Jupyter, Volumes, Tensorboards) and their shared common backend. Changes: - Update Dockerfiles to use python:3.12-slim base image - Add setuptools and wheel installation (required in Python 3.12 slim) - Update CI workflows to use Python 3.12 for testing and linting - Upgrade common backend dependencies to address vulnerabilities: * Flask: 1.1.1 → 2.3.2 * Werkzeug: 0.16.0 → 3.0.6 * requests: 2.22.0 → 2.32.4 * urllib3: 1.25.7 → 2.5.0 * kubernetes: ==22.6.0 → >=22.6.0 Testing performed: - All CI workflows passed (backend unit tests, integration tests, multi-arch builds) - Local functional testing in Kind cluster with full Kubeflow deployment - Verified all three web apps running on Python 3.12 - Tested CRUD operations via UI: * Created, viewed, and deleted Volumes * Created, viewed, and deleted Jupyter Notebooks * Created, viewed, and deleted TensorBoards - Verified namespace visibility and RBAC permissions - Confirmed API endpoints responding correctly - Validated container startup and health checks Closes: #724, #725, #726 Signed-off-by: Asaad Balum <[email protected]> * mathew: pin `kubernetes` pypi package to `34.1.0` Signed-off-by: Mathew Wicks <[email protected]> * mathew: remove version requirements for `requests` and `urllib3` Signed-off-by: Mathew Wicks <[email protected]> --------- Signed-off-by: Asaad Balum <[email protected]> Signed-off-by: Mathew Wicks <[email protected]> Co-authored-by: Mathew Wicks <[email protected]>
1 parent 5622681 commit 0b835a7

File tree

13 files changed

+37
-38
lines changed

13 files changed

+37
-38
lines changed

.github/workflows/jwa_backend_unittests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
- uses: actions/setup-python@v5
2727
with:
28-
python-version: "3.7"
28+
python-version: "3.12"
2929

3030
- name: Setup Python environment
3131
run: |

.github/workflows/python_lint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
- name: Checkout source repository
1818
uses: actions/checkout@v4
1919

20-
- name: Set up Python environment 3.8
20+
- name: Set up Python
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: "3.8"
23+
python-version: "3.12"
2424

2525
- name: flake8 Lint
2626
uses: py-actions/flake8@v2

components/crud-web-apps/common/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ In order to build a Docker image and use this code you coud build a wheel and th
4545

4646
```dockerfile
4747
### Docker
48-
FROM python:3.7 AS backend-kubeflow-wheel
48+
FROM python:3.12 AS backend-kubeflow-wheel
4949

5050
WORKDIR /src
5151
COPY ./components/crud-web-apps/common/backend .
@@ -54,7 +54,7 @@ RUN python3 setup.py bdist_wheel
5454

5555
...
5656
# Web App
57-
FROM python:3.7
57+
FROM python:3.12
5858

5959
WORKDIR /package
6060
COPY --from=backend-kubeflow-wheel /src .

components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def create_app(name, static_folder, config):
2323

2424
if (config.ENV == BackendMode.DEVELOPMENT.value
2525
or config.ENV == BackendMode.DEVELOPMENT_FULL.value): # noqa: W503
26-
log.warn("RUNNING IN DEVELOPMENT MODE")
26+
log.warning("RUNNING IN DEVELOPMENT MODE")
2727

2828
# Register all the blueprints
2929
app.register_blueprint(authn_bp)

components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class DevConfig(Config):
5959

6060
def __init__(self):
6161
super()
62-
log.warn("RUNNING IN DEVELOPMENT MODE")
62+
log.warning("RUNNING IN DEVELOPMENT MODE")
6363

6464

6565
class ProdConfig(Config):

components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

components/crud-web-apps/common/backend/setup.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import setuptools
22

33
REQUIRES = [
4-
"Flask >= 1.1.1",
4+
"Flask >= 2.3.2",
55
"Flask-API >= 2.0",
6-
"kubernetes == 22.6.0",
7-
"requests >= 2.22.0",
8-
"urllib3 >= 1.25.7",
9-
"Werkzeug >= 0.16.0",
6+
"kubernetes == 34.1.0",
7+
"requests",
8+
"urllib3",
9+
"Werkzeug >= 3.0.6",
1010
"Flask-Cors >= 3.0.8",
1111
"gevent",
1212
"prometheus-flask-exporter >= 0.23.1",
13-
"importlib-metadata >= 1.0;python_version<'3.8'",
1413
]
1514

1615
setuptools.setup(
@@ -27,5 +26,5 @@
2726
"Topic :: Software Development :: Libraries",
2827
"Topic :: Software Development :: Libraries :: Python Modules",
2928
],
30-
python_requires=">=3.6",
29+
python_requires=">=3.12",
3130
)

components/crud-web-apps/jupyter/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# --- Build the backend kubeflow-wheel ---
2-
FROM python:3.10-slim AS backend-kubeflow-wheel
2+
# Python 3.12 upgrade
3+
FROM python:3.12-slim AS backend-kubeflow-wheel
34

45
WORKDIR /src
56

67
COPY ./common/backend/ .
7-
RUN python3 setup.py bdist_wheel
8+
RUN pip install --no-cache-dir setuptools wheel && \
9+
python3 setup.py bdist_wheel
810

911
# --- Build the frontend kubeflow library ---
1012
FROM node:16.20.2-bullseye as frontend-kubeflow-lib
@@ -41,7 +43,7 @@ COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/
4143
RUN npm run build -- --output-path=./dist/default --configuration=production
4244

4345
# Web App
44-
FROM python:3.10-slim
46+
FROM python:3.12-slim
4547

4648
WORKDIR /package
4749
COPY --from=backend-kubeflow-wheel /src .

components/crud-web-apps/jupyter/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ with a [configmap](./manifests/base/configs/logos-configmap.yaml) to make it eas
3232

3333
Requirements:
3434
* node 16.20.2
35-
* python 3.8
35+
* python 3.12
3636

3737
### Frontend
3838

@@ -64,8 +64,8 @@ cd components/crud-web-apps/jupyter
6464

6565
# create a virtual env and install deps
6666
# https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/
67-
python3.8 -m pip install --user virtualenv
68-
python3.8 -m venv web-apps-dev
67+
python3.12 -m pip install --user virtualenv
68+
python3.12 -m venv web-apps-dev
6969
source web-apps-dev/bin/activate
7070

7171
# install the deps on the activated virtual env

components/crud-web-apps/tensorboards/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# --- Build the backend kubeflow-wheel ---
2-
FROM python:3.10-slim AS backend-kubeflow-wheel
2+
# Python 3.12 upgrade
3+
FROM python:3.12-slim AS backend-kubeflow-wheel
34

45
WORKDIR /src
56

67
COPY ./common/backend/ .
7-
RUN python3 setup.py bdist_wheel
8+
RUN pip install --no-cache-dir setuptools wheel && \
9+
python3 setup.py bdist_wheel
810

911
# --- Build the frontend kubeflow library ---
1012
FROM node:16.20.2-bullseye as frontend-kubeflow-lib
@@ -41,7 +43,7 @@ COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/
4143
RUN npm run build -- --output-path=./dist --configuration=production
4244

4345
# Web App
44-
FROM python:3.10-slim
46+
FROM python:3.12-slim
4547

4648
WORKDIR /package
4749
COPY --from=backend-kubeflow-wheel /src .

0 commit comments

Comments
 (0)