From e772807b46317e4e5e560bed8d0d9a471456eab7 Mon Sep 17 00:00:00 2001 From: Andrei Neagu Date: Tue, 20 May 2025 10:12:01 +0200 Subject: [PATCH 1/3] upgraded to py 3.9 --- docker/python/Dockerfile | 2 +- requirements.txt | 109 +++++++------ src/osparc_python_runner/requirements.txt | 181 +++++++++++++++++++--- 3 files changed, 218 insertions(+), 74 deletions(-) diff --git a/docker/python/Dockerfile b/docker/python/Dockerfile index 46a1be8..4951365 100644 --- a/docker/python/Dockerfile +++ b/docker/python/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8.10-slim as base +FROM python:3.9.10-slim as base # # USAGE: # cd services/osparc-python-runner diff --git a/requirements.txt b/requirements.txt index e62b2bb..0441274 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,76 +1,75 @@ # -# This file is autogenerated by pip-compile with python 3.8 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: # # pip-compile --output-file=requirements.txt # -arrow==1.2.2 - # via jinja2-time -attrs==21.4.0 +arrow==1.3.0 + # via cookiecutter +attrs==25.3.0 # via # jsonschema # referencing binaryornot==0.4.4 # via cookiecutter -black==23.7.0 +black==25.1.0 # via -r requirements.in bump2version==1.0.1 # via bumpversion bumpversion==0.6.0 # via -r requirements.in -certifi==2021.10.8 +certifi==2025.4.26 # via requests -chardet==4.0.0 +chardet==5.2.0 # via binaryornot -charset-normalizer==2.0.12 +charset-normalizer==3.4.2 # via requests -click==8.1.0 +click==8.1.8 # via # black # cookiecutter -cookiecutter==2.1.1 +cookiecutter==2.6.0 # via pytest-cookies -coverage[toml]==6.3.2 +coverage[toml]==7.8.0 # via # -r requirements.in # pytest-cov -docker==6.0.0 +docker==7.1.0 # via -r requirements.in -idna==3.3 +exceptiongroup==1.3.0 + # via pytest +idna==3.10 # via requests -iniconfig==1.1.1 +iniconfig==2.1.0 # via pytest -jinja2==3.1.1 - # via - # cookiecutter - # jinja2-time -jinja2-time==0.2.0 +jinja2==3.1.6 # via cookiecutter -jsonschema==4.19.0 +jsonschema==4.23.0 # via -r requirements.in -markupsafe==2.1.1 +jsonschema-specifications==2025.4.1 + # via jsonschema +markdown-it-py==3.0.0 + # via rich +markupsafe==3.0.2 # via jinja2 -mypy-extensions==0.4.3 +mdurl==0.1.2 + # via markdown-it-py +mypy-extensions==1.1.0 # via black -packaging==23.0 +packaging==25.0 # via # black - # docker # pytest # pytest-sugar -pathspec==0.9.0 +pathspec==0.12.1 # via black -platformdirs==2.5.1 +platformdirs==4.3.8 # via black -pluggy==1.0.0 +pluggy==1.6.0 # via pytest -py==1.11.0 - # via pytest -pyparsing==3.0.7 - # via packaging -pyrsistent==0.18.1 - # via jsonschema -pytest==7.1.3 +pygments==2.19.1 + # via rich +pytest==8.3.5 # via # -r requirements.in # pytest-cookies @@ -80,44 +79,56 @@ pytest==7.1.3 # pytest-sugar pytest-cookies==0.7.0 # via -r requirements.in -pytest-cov==4.1.0 +pytest-cov==6.1.1 # via -r requirements.in pytest-instafail==0.5.0 # via -r requirements.in -pytest-mock==3.11.1 +pytest-mock==3.14.0 # via -r requirements.in -pytest-sugar==0.9.7 +pytest-sugar==1.0.0 # via -r requirements.in -python-dateutil==2.8.2 +python-dateutil==2.9.0.post0 # via arrow -python-slugify==6.1.1 +python-slugify==8.0.4 # via cookiecutter -pyyaml==6.0.1 +pyyaml==6.0.2 # via # -r requirements.in # cookiecutter -requests==2.27.1 +referencing==0.36.2 + # via + # jsonschema + # jsonschema-specifications +requests==2.32.3 # via # cookiecutter # docker -rpds-py==0.8.10 +rich==14.0.0 + # via cookiecutter +rpds-py==0.25.0 # via # jsonschema # referencing -six==1.16.0 +six==1.17.0 # via python-dateutil -termcolor==1.1.0 +termcolor==3.1.0 # via pytest-sugar text-unidecode==1.3 # via python-slugify -tomli==2.0.1 +tomli==2.2.1 # via # black # coverage # pytest -urllib3==1.26.9 +types-python-dateutil==2.9.0.20250516 + # via arrow +typing-extensions==4.13.2 + # via + # black + # exceptiongroup + # referencing + # rich +urllib3==2.4.0 # via # docker # requests -websocket-client==1.3.2 - # via docker diff --git a/src/osparc_python_runner/requirements.txt b/src/osparc_python_runner/requirements.txt index 81ef4f4..60f6ce9 100644 --- a/src/osparc_python_runner/requirements.txt +++ b/src/osparc_python_runner/requirements.txt @@ -1,61 +1,194 @@ # -# This file is autogenerated by pip-compile with python 3.8 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: # # pip-compile --output-file=osparc_python_runner/requirements.txt requirements.in # -certifi==2022.12.7 +asttokens==3.0.0 + # via stack-data +attrs==25.3.0 + # via + # jsonschema + # referencing +backcall==0.2.0 + # via ipython +beautifulsoup4==4.13.4 + # via nbconvert +bleach[css]==6.2.0 + # via nbconvert +certifi==2025.4.26 # via requests -chardet==4.0.0 +charset-normalizer==3.4.2 # via requests -cycler==0.10.0 +contourpy==1.3.0 + # via matplotlib +cycler==0.12.1 # via matplotlib +decorator==5.2.1 + # via ipython +defusedxml==0.7.1 + # via nbconvert docopt==0.6.2 # via pipreqs -idna==2.10 +executing==2.2.0 + # via stack-data +fastjsonschema==2.21.1 + # via nbformat +fonttools==4.58.0 + # via matplotlib +idna==3.10 # via requests -kiwisolver==1.3.1 +importlib-metadata==8.7.0 + # via + # jupyter-client + # nbconvert +importlib-resources==6.5.2 # via matplotlib -matplotlib==3.4.2 +ipython==8.12.3 + # via pipreqs +jedi==0.19.2 + # via ipython +jinja2==3.1.6 + # via nbconvert +jsonschema==4.23.0 + # via nbformat +jsonschema-specifications==2025.4.1 + # via jsonschema +jupyter-client==8.6.3 + # via nbclient +jupyter-core==5.7.2 + # via + # jupyter-client + # nbclient + # nbconvert + # nbformat +jupyterlab-pygments==0.3.0 + # via nbconvert +kiwisolver==1.4.7 + # via matplotlib +markupsafe==3.0.2 + # via + # jinja2 + # nbconvert +matplotlib==3.9.4 # via # -r requirements.in # seaborn -numpy==1.22.0 +matplotlib-inline==0.1.7 + # via ipython +mistune==3.1.3 + # via nbconvert +nbclient==0.10.2 + # via nbconvert +nbconvert==7.16.6 + # via pipreqs +nbformat==5.10.4 + # via + # nbclient + # nbconvert +numpy==2.0.2 # via # -r requirements.in + # contourpy # matplotlib # pandas # scipy # seaborn -pandas==1.2.5 +packaging==25.0 + # via + # matplotlib + # nbconvert +pandas==2.2.3 # via # -r requirements.in # seaborn -pillow==9.0.1 +pandocfilters==1.5.1 + # via nbconvert +parso==0.8.4 + # via jedi +pexpect==4.9.0 + # via ipython +pickleshare==0.7.5 + # via ipython +pillow==11.2.1 # via matplotlib -pipreqs==0.4.10 +pipreqs==0.5.0 # via -r requirements.in -pyparsing==2.4.7 +platformdirs==4.3.8 + # via jupyter-core +prompt-toolkit==3.0.51 + # via ipython +ptyprocess==0.7.0 + # via pexpect +pure-eval==0.2.3 + # via stack-data +pygments==2.19.1 + # via + # ipython + # nbconvert +pyparsing==3.2.3 # via matplotlib -python-dateutil==2.8.1 +python-dateutil==2.9.0.post0 # via + # jupyter-client # matplotlib # pandas -pytz==2021.1 +pytz==2025.2 # via pandas -requests==2.25.1 +pyzmq==26.4.0 + # via jupyter-client +referencing==0.36.2 + # via + # jsonschema + # jsonschema-specifications +requests==2.32.3 # via yarg -scipy==1.7.0 +rpds-py==0.25.0 # via - # -r requirements.in - # seaborn -seaborn==0.11.1 + # jsonschema + # referencing +scipy==1.13.1 # via -r requirements.in -six==1.16.0 +seaborn==0.13.2 + # via -r requirements.in +six==1.17.0 + # via python-dateutil +soupsieve==2.7 + # via beautifulsoup4 +stack-data==0.6.3 + # via ipython +tinycss2==1.4.0 + # via bleach +tornado==6.5 + # via jupyter-client +traitlets==5.14.3 + # via + # ipython + # jupyter-client + # jupyter-core + # matplotlib-inline + # nbclient + # nbconvert + # nbformat +typing-extensions==4.13.2 # via - # cycler - # python-dateutil -urllib3==1.26.5 + # beautifulsoup4 + # ipython + # mistune + # referencing +tzdata==2025.2 + # via pandas +urllib3==2.4.0 # via requests +wcwidth==0.2.13 + # via prompt-toolkit +webencodings==0.5.1 + # via + # bleach + # tinycss2 yarg==0.1.9 # via pipreqs +zipp==3.21.0 + # via + # importlib-metadata + # importlib-resources From 785e307f1405006ac7be0211c5fe02e298a0d927 Mon Sep 17 00:00:00 2001 From: Andrei Neagu Date: Tue, 20 May 2025 10:13:23 +0200 Subject: [PATCH 2/3] using correct python version --- .github/workflows/github-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-ci.yml b/.github/workflows/github-ci.yml index af5e077..e2d459c 100644 --- a/.github/workflows/github-ci.yml +++ b/.github/workflows/github-ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python: ["3.8"] + python: ["3.9"] os: [ubuntu-22.04] node: [10] fail-fast: false From 9e58279f90fbe911e05d52a9504d6118473a05e9 Mon Sep 17 00:00:00 2001 From: Andrei Neagu Date: Tue, 20 May 2025 10:53:11 +0200 Subject: [PATCH 3/3] upgraded to python 3.9 and repleced venv with vritualenv --- docker/python/Dockerfile | 2 ++ src/osparc_python_runner/main.py | 9 ++++----- src/osparc_python_runner/requirements.txt | 10 +++++++++- src/requirements.in | 1 + 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docker/python/Dockerfile b/docker/python/Dockerfile index 4951365..f43ab7a 100644 --- a/docker/python/Dockerfile +++ b/docker/python/Dockerfile @@ -21,6 +21,8 @@ RUN apt-get update \ && apt-get -y install --no-install-recommends \ jq \ && rm --recursive --force /var/lib/apt/lists/* +# install uv +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ # -------------------------- Build stage ------------------- # Installs build/package management tools and third party dependencies diff --git a/src/osparc_python_runner/main.py b/src/osparc_python_runner/main.py index 2dbd34a..a67cec2 100644 --- a/src/osparc_python_runner/main.py +++ b/src/osparc_python_runner/main.py @@ -117,17 +117,16 @@ def setup(): "set -o nounset", "IFS=$(printf '\\n\\t')", 'echo "Creating virtual environment ..."', - f'python3 -m venv --system-site-packages --symlinks --upgrade "{venv_dir}"', - f'"{venv_dir}/bin/pip" install -U pip wheel setuptools', - f'"{venv_dir}/bin/pip" install -r "{requirements_txt}"', + f'python3 -m virtualenv --system-site-packages --symlinks --without-pip "{venv_dir}"', + 'uv pip install -U pip wheel setuptools', + f'uv pip install -r "{requirements_txt}"', "\n".join(bash_input_env_export), "\n".join(bash_output_env_export), f'echo "Executing code {user_code_entrypoint.name}..."', f'"{venv_dir}/bin/python3" "{user_code_entrypoint}"', 'echo "DONE ..."', ] - main_script_path = Path("main.sh") - main_script_path.write_text("\n".join(script)) + Path("main.sh").write_text("\n".join(script)) def teardown(): diff --git a/src/osparc_python_runner/requirements.txt b/src/osparc_python_runner/requirements.txt index 60f6ce9..0437431 100644 --- a/src/osparc_python_runner/requirements.txt +++ b/src/osparc_python_runner/requirements.txt @@ -28,12 +28,16 @@ decorator==5.2.1 # via ipython defusedxml==0.7.1 # via nbconvert +distlib==0.3.9 + # via virtualenv docopt==0.6.2 # via pipreqs executing==2.2.0 # via stack-data fastjsonschema==2.21.1 # via nbformat +filelock==3.18.0 + # via virtualenv fonttools==4.58.0 # via matplotlib idna==3.10 @@ -115,7 +119,9 @@ pillow==11.2.1 pipreqs==0.5.0 # via -r requirements.in platformdirs==4.3.8 - # via jupyter-core + # via + # jupyter-core + # virtualenv prompt-toolkit==3.0.51 # via ipython ptyprocess==0.7.0 @@ -180,6 +186,8 @@ tzdata==2025.2 # via pandas urllib3==2.4.0 # via requests +virtualenv==20.31.2 + # via -r requirements.in wcwidth==0.2.13 # via prompt-toolkit webencodings==0.5.1 diff --git a/src/requirements.in b/src/requirements.in index 4e4a13f..d038f9b 100644 --- a/src/requirements.in +++ b/src/requirements.in @@ -7,3 +7,4 @@ seaborn # tools pipreqs +virtualenv