From fdef8fdbabdc33bd8523e0540db464f0ffdb67d2 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 3 Oct 2024 19:16:55 +0100 Subject: [PATCH 1/7] Move pyenv clone to builder-py-base image This means when building multiple python versions this repo is only cloned once --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f2bbe2b9..1054af6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,12 +29,13 @@ RUN apt-get -y update \ tk-dev \ && rm -rf /var/lib/apt/lists/* +RUN git clone -b v2.4.10 --depth 1 https://github.com/pyenv/pyenv.git $PYENV_ROOT + COPY --link scripts/build_python.sh / # ------------------------------------------------------------------------------ FROM builder-py-base as builder-py-3_12 -RUN git clone -b v2.4.10 --depth 1 https://github.com/pyenv/pyenv.git $PYENV_ROOT \ - && /build_python.sh 3.12.5 +RUN /build_python.sh 3.12.5 # ------------------------------------------------------------------------------ FROM python:3.12-slim-bookworm as base From 91dd475e5b2bd20777521613d764b28bbfacd675 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 3 Oct 2024 19:17:34 +0100 Subject: [PATCH 2/7] Add Python 3.12.0rc3 support --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1054af6b..ed198c4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ RUN apt-get -y update \ tk-dev \ && rm -rf /var/lib/apt/lists/* -RUN git clone -b v2.4.10 --depth 1 https://github.com/pyenv/pyenv.git $PYENV_ROOT +RUN git clone -b v2.4.14 --depth 1 https://github.com/pyenv/pyenv.git $PYENV_ROOT COPY --link scripts/build_python.sh / @@ -37,6 +37,9 @@ COPY --link scripts/build_python.sh / FROM builder-py-base as builder-py-3_12 RUN /build_python.sh 3.12.5 # ------------------------------------------------------------------------------ +FROM builder-py-base as builder-py-3_13 +RUN /build_python.sh 3.13.0rc3 +# ------------------------------------------------------------------------------ FROM python:3.12-slim-bookworm as base ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \ @@ -52,6 +55,7 @@ RUN apt-get -y update \ COPY --link --from=builder-nsjail /nsjail/nsjail /usr/sbin/ COPY --link --from=builder-py-3_12 /lang/ /lang/ +COPY --link --from=builder-py-3_13 /lang/ /lang/ RUN chmod +x /usr/sbin/nsjail \ && ln -s /lang/python/3.12/ /lang/python/default From 3e76dfaa09344b14a3db8b1621adbcf5efa58a9f Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 3 Oct 2024 19:19:57 +0100 Subject: [PATCH 3/7] Bump eval deps to latest --- requirements/eval-deps.pip | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements/eval-deps.pip b/requirements/eval-deps.pip index d17c5705..495695c9 100644 --- a/requirements/eval-deps.pip +++ b/requirements/eval-deps.pip @@ -1,4 +1,4 @@ -anyio[trio]~=4.4 +anyio[trio]~=4.6 arrow~=1.3 attrs~=24.2 beautifulsoup4~=4.12 @@ -8,7 +8,7 @@ forbiddenfruit~=0.1 fuzzywuzzy~=0.18 lark~=1.2 matplotlib~=3.9 ; python_version == '3.12' -more-itertools~=10.4 +more-itertools~=10.5 networkx~=3.3 numpy~=2.1 ; python_version == '3.12' pandas~=2.2 ; python_version == '3.12' @@ -19,5 +19,5 @@ pyyaml~=6.0 scipy~=1.14 ; python_version == '3.12' sympy~=1.13 typing-extensions~=4.12 -tzdata~=2024.1 -yarl~=1.9 +tzdata~=2024.2 +yarl~=1.13 From 26d30a40f2b92baaeb2b65de81804eca0584916f Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 3 Oct 2024 19:25:33 +0100 Subject: [PATCH 4/7] Remove obsolete version specifier in docker compose file --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b28d61bc..7f89bdac 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3.7" - services: snekbox: container_name: snekbox_dev From 4d05016d19faec5c6c2ad3219ee74dab57ea2ca8 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 3 Oct 2024 19:29:59 +0100 Subject: [PATCH 5/7] Update version specifier tags in eval-deps This ensures only packages that have wheels for 3.13 are installed into the 3.13 eval container --- requirements/eval-deps.pip | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/requirements/eval-deps.pip b/requirements/eval-deps.pip index 495695c9..45496d70 100644 --- a/requirements/eval-deps.pip +++ b/requirements/eval-deps.pip @@ -3,20 +3,20 @@ arrow~=1.3 attrs~=24.2 beautifulsoup4~=4.12 einspect~=0.5 ; python_version == '3.12' -fishhook~=0.3 +fishhook~=0.3; python_version == '3.12' forbiddenfruit~=0.1 fuzzywuzzy~=0.18 lark~=1.2 -matplotlib~=3.9 ; python_version == '3.12' +matplotlib~=3.9 more-itertools~=10.5 networkx~=3.3 -numpy~=2.1 ; python_version == '3.12' -pandas~=2.2 ; python_version == '3.12' -pendulum~=3.0 -pyarrow~=17.0 +numpy~=2.1 +pandas~=2.2 +pendulum~=3.0 ; python_version == '3.12' +pyarrow~=17.0; python_version == '3.12' python-dateutil~=2.9 pyyaml~=6.0 -scipy~=1.14 ; python_version == '3.12' +scipy~=1.14 sympy~=1.13 typing-extensions~=4.12 tzdata~=2024.2 From 8952cac62f1cafce0c4064ab35d841244365a714 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 3 Oct 2024 21:02:04 +0100 Subject: [PATCH 6/7] Update nsjail_args and py_args to store_const instead of nargs='?' When using nargs='?' the nsjail_args argument was sometimes consuming 1 of the arguments passed to the module. By setting these two arguments to store_const actions instead, this is no longer the case, as they will always use the constant specified now. This is more appropriate for their actual use case of being purely for documentation. Co-authored-by: GDWR --- snekbox/__main__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/snekbox/__main__.py b/snekbox/__main__.py index 239f5d58..1e5bceca 100644 --- a/snekbox/__main__.py +++ b/snekbox/__main__.py @@ -13,10 +13,16 @@ def parse_args() -> argparse.Namespace: ) parser.add_argument("code", help="the Python code to evaluate") parser.add_argument( - "nsjail_args", nargs="?", default=[], help="override configured NsJail options" + "nsjail_args", + action="store_const", + const=[], + help="override configured NsJail options (default: [])", ) parser.add_argument( - "py_args", nargs="?", default=["-c"], help="arguments to pass to the Python process" + "py_args", + action="store_const", + const=["-c"], + help="arguments to pass to the Python process (default: ['-c'])", ) # nsjail_args and py_args are just dummies for documentation purposes. From b276a04f2cb9b2e974b84b66719b2b0984f3a800 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Thu, 3 Oct 2024 21:19:47 +0100 Subject: [PATCH 7/7] Include hidden files when uploading artifacts This was a breaking change github introduced recently Co-authored-by: GDWR --- .github/workflows/test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1159d81b..55bdae0f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -52,6 +52,7 @@ jobs: name: coverage-${{ matrix.os }} path: .coverage.* retention-days: 1 + include-hidden-files: true report: name: Report coverage