Download cpython_17/environment/Dockerfile from lolbench26/LoLBench: direct link, hf CLI and curl.
- Browser
- Download file 7.02 kB
-
https://huggingface.co/datasets/lolbench26/LoLBench/resolve/main/cpython_17/environment/Dockerfile
- Command line
-
hf download hf://datasets/lolbench26/LoLBench/cpython_17/environment/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/datasets/lolbench26/LoLBench/resolve/main/cpython_17/environment/Dockerfile
7.02 kB
| LoLBench Harbor image: CPython PR-142351 (PEP 810: Explicit lazy imports) | |
| Requirement: https://peps.python.org/pep-0810/ | |
| base_commit: cac0c98450c27dbb6e185ab1c05e1d51d34135d9 (parent of squash- | |
| merge commit 46d5106cfa903329821c097c3bf309e3efcd718f — | |
| see spec.json base_commit_note) | |
| # Harbor-facing contract: the same image is used for the network-disabled | |
| agent container and the separate verifier container. The verifier receives | |
| private tests and candidate patches only through Harbor mounts: | |
| # docker run --rm \ | |
| # --network=none \ | |
| # -v $(pwd)/solution.patch:/in/solution.patch:ro \ | |
| # -v $(pwd)/out:/out \ | |
| # lolbench/cpython-pr-142351:1 | |
| # PEP 810 introduces explicit `lazy import x` / `from x lazy import y` | |
| syntax + builtin `__lazy_import__` + sys.set_lazy_imports/is_lazy_import. | |
| Scope: | |
| - parser/grammar: Grammar/python.gram, Parser/parser.c, | |
| Parser/action_helpers.c | |
| - AST: Python/Python-ast.c, Lib/keyword.py + pycore_ast*.h | |
| - compile/symtable: Python/compile.c, Python/symtable.c + | |
| pycore_compile.h, pycore_symtable.h | |
| - bytecode/ceval: Python/bytecodes.c, Python/ceval.c, | |
| Python/specialize.c, Python/{executor,generated}_cases.c.h | |
| - new runtime object: Objects/lazyimportobject.c (NEW) + | |
| Include/internal/pycore_lazyimportobject.h (NEW) | |
| - import machinery: Python/import.c, Objects/moduleobject.c + | |
| Lib/importlib/_bootstrap.py + pycore_import.h | |
| - lifecycle/init: Python/pylifecycle.c, Python/initconfig.c, | |
| Python/sysmodule.c + pycore_interp_structs.h | |
| - error suggestions / traceback: Objects/exceptions.c, | |
| Objects/dictobject.c, Lib/traceback.py + pyerrors.h | |
| - Python stdlib: Lib/types.py, Lib/dis.py, Lib/_compat_pickle.py, | |
| Lib/_pyrepl/utils.py, Lib/idlelib/colorizer.py, Lib/rlcompleter.py | |
| # No special capabilities are needed. The container stays --network=none | |
| with the default seccomp profile. | |
| # The agent runs as the non-root `agent` user in /workspace/cpython. | |
| # Layered build per docs/executable_environment_plan.md §4: | |
| layer 1: ubuntu:22.04 | |
| layer 2: lolbench/cpython-base:1 (toolchain + stdlib build deps) | |
| layer 3: THIS image (cpython @ base_commit + built python) | |
| ARG BASE_IMAGE=lolbench/cpython-base:1 | |
| FROM ${BASE_IMAGE} | |
| ARG BASE_COMMIT=cac0c98450c27dbb6e185ab1c05e1d51d34135d9 | |
| RUN mkdir -p /opt/lolbench/private /in /out /workspace | |
| WORKDIR /workspace | |
| RUN git init cpython && \ | |
| cd cpython && \ | |
| git remote add origin https://github.com/python/cpython.git && \ | |
| git fetch --no-tags origin ${BASE_COMMIT} && \ | |
| git checkout ${BASE_COMMIT} && \ | |
| git config user.email lolbench@local && \ | |
| git config user.name lolbench && \ | |
| if ! git diff --quiet || ! git diff --cached --quiet || [ -n "$(git ls-files --others --exclude-standard)" ]; then \ | |
| git add -A && git -c commit.gpgsign=false commit -q -m "LoLBench environment overlay"; \ | |
| fi && \ | |
| git tag -f base && git tag -f lolbench-base && \ | |
| git for-each-ref --format='%(refname)' refs/heads refs/remotes refs/tags | \ | |
| while read ref; do \ | |
| case "$ref" in refs/tags/base|refs/tags/lolbench-base) ;; *) git update-ref -d "$ref" ;; esac; \ | |
| done && \ | |
| ( git remote remove origin 2>/dev/null || true ) && \ | |
| rm -f .git/FETCH_HEAD && \ | |
| git reflog expire --expire=now --all && \ | |
| git repack -Ad && \ | |
| git prune --expire=now && \ | |
| git config --global --add safe.directory /workspace/cpython | |
| Pre-build CPython at base_commit. solution.patch touches Grammar/python.gram | |
| + Parser/Python.asdl, but `make` regenerates the parser tables and Python-ast.c | |
| from those sources via the standard build rules. No configure.ac / | |
| Makefile.pre.in / pyconfig.h.in changes — no reconfigure is needed at eval time. | |
| SHELL ["/bin/bash", "-o", "pipefail", "-c"] | |
| RUN cd /workspace/cpython && \ | |
| ./configure --prefix=/usr/local --enable-optimizations=no && \ | |
| jobs=$(awk '$1!="max"{printf("%d", ($1+$2-1)/$2)}' /sys/fs/cgroup/cpu.max 2>/dev/null); \ | |
| : "${jobs:=$(nproc)}"; \ | |
| [ "$jobs" -lt 1 ] && jobs=1; \ | |
| make -j"$jobs" 2>&1 | tee /tmp/cpython-build.log | tail -400 | |
| Harbor runtime adapter: keep the image public/agent-safe. | |
| RUN mkdir -p /opt/lolbench /logs/artifacts /logs/agent /logs/verifier /in /out && \ | |
| if ! id -u agent >/dev/null 2>&1; then useradd -m -s /bin/bash agent; fi | |
| COPY metadata.json /opt/lolbench/metadata.json | |
| COPY lolbench-submit /usr/local/bin/lolbench-submit | |
| RUN chmod +x /usr/local/bin/lolbench-submit && \ | |
| git config --global --add safe.directory /workspace/cpython && \ | |
| if [ -d /workspace/cpython/.git ]; then \ | |
| cd /workspace/cpython && LC_ALL=C git ls-files --others --exclude-standard | LC_ALL=C sort > /opt/lolbench/base_untracked.txt; \ | |
| else \ | |
| : > /opt/lolbench/base_untracked.txt; \ | |
| fi && \ | |
| chown -R agent:agent /workspace/cpython /logs | |
| Local-reference hardening: retain only the approved base history. | |
| RUN cd /workspace/cpython && \ | |
| git for-each-ref --format='%(refname)' refs/heads refs/remotes refs/tags | \ | |
| while read ref; do \ | |
| case "$ref" in refs/tags/base|refs/tags/lolbench-base) ;; *) git update-ref -d "$ref" ;; esac; \ | |
| done && \ | |
| ( git remote remove origin 2>/dev/null || true ) && \ | |
| rm -f .git/FETCH_HEAD && \ | |
| git reflog expire --expire=now --all && \ | |
| git repack -Ad && \ | |
| git prune --expire=now && \ | |
| unreachable=$(git fsck --unreachable --no-reflogs) && \ | |
| test -z "$unreachable" && \ | |
| chown -R agent:agent .git | |
| Remove installed Python source copies/backports and package caches. | |
| RUN for root in /usr/local/lib /usr/lib; do \ | |
| [ ! -d "$root" ] || find "$root" -type d \ | |
| \( -path '*/site-packages/pip' -o -path '*/dist-packages/pip' -o \ | |
| -name ensurepip -o -name tomllib -o -name zoneinfo -o \ | |
| -path '*/site-packages/tomli*' -o -path '*/dist-packages/tomli*' -o \ | |
| -path '*/site-packages/typing_extensions*' -o -path '*/dist-packages/typing_extensions*' -o \ | |
| -path '*/site-packages/exceptiongroup*' -o -path '*/dist-packages/exceptiongroup*' \) \ | |
| -prune -exec rm -rf '{}' +; \ | |
| [ ! -d "$root" ] || find "$root" -type f \ | |
| \( -name 'tomli*.py' -o -name 'typing_extensions*.py' -o -name 'exceptiongroup*.py' \) -delete; \ | |
| done && \ | |
| rm -rf /usr/share/python-wheels /usr/share/python3-wheels \ | |
| /root/.cache/pip /root/.cache/uv /home/agent/.cache/pip /home/agent/.cache/uv && \ | |
| rm -f /usr/local/bin/pip /usr/local/bin/pip3 /usr/local/bin/pip3.* \ | |
| /usr/bin/pip /usr/bin/pip3 /usr/bin/pip3.* && \ | |
| for p in /usr/local/lib/python*/site-packages /usr/lib/python*/dist-packages; do \ | |
| [ ! -d "$p" ] || { chown -R root:root "$p"; chmod -R go-w "$p"; chmod 0711 "$p"; }; \ | |
| done | |
| USER agent | |
| WORKDIR /workspace/cpython | |
| ENV LOLBENCH_INSTANCE_ID=cpython_17 | |
| ENV LOLBENCH_SOURCE_SLUG=CPython_PEP-810_Explicit-lazy-imports_PR-142351 | |