Add files using upload-large-folder tool
Browse files
LiveCodeBench-venv-portable-20260407.tar.zst
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:da52c6e9200a7f14b8fba8d733b0b168f4cdf42c69f328986405b0a53fe5a0a0
|
| 3 |
+
size 4215221600
|
LiveCodeBench-venv-portable-20260407.tar.zst.sha256
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a318a4d821af326cabd183e4a60932941456ae3280c8aec777293ec365aa8db1
|
| 3 |
+
size 117
|
README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LiveCodeBench Portable Venv Bundle
|
| 2 |
+
|
| 3 |
+
This directory contains a portable transfer bundle for the LiveCodeBench Python environment.
|
| 4 |
+
|
| 5 |
+
## Files
|
| 6 |
+
|
| 7 |
+
- `LiveCodeBench-venv-portable-20260407.tar.zst`
|
| 8 |
+
Portable environment archive.
|
| 9 |
+
- `LiveCodeBench-venv-portable-20260407.tar.zst.sha256`
|
| 10 |
+
SHA256 checksum file for archive verification.
|
| 11 |
+
- `restore_livecodebench_venv.sh`
|
| 12 |
+
Restore the environment on the target server and rewrite internal absolute paths.
|
| 13 |
+
- `send_livecodebench_venv_to_server.sh`
|
| 14 |
+
Copy the bundle to a remote server with `scp`.
|
| 15 |
+
|
| 16 |
+
## Recommended Workflow
|
| 17 |
+
|
| 18 |
+
Run from this directory on the source server:
|
| 19 |
+
|
| 20 |
+
```bash
|
| 21 |
+
cd ~/LiveCodeBench-venv-portable-bundle
|
| 22 |
+
bash ./send_livecodebench_venv_to_server.sh user@your-server ~ /data/repos/LiveCodeBench/.venv
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
Then restore on the target server:
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
ssh user@your-server 'bash ~/restore_livecodebench_venv.sh ~/LiveCodeBench-venv-portable-20260407.tar.zst /data/repos/LiveCodeBench/.venv'
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
## Manual Workflow
|
| 32 |
+
|
| 33 |
+
If you prefer to copy files yourself:
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
scp LiveCodeBench-venv-portable-20260407.tar.zst \
|
| 37 |
+
LiveCodeBench-venv-portable-20260407.tar.zst.sha256 \
|
| 38 |
+
restore_livecodebench_venv.sh \
|
| 39 |
+
user@your-server:~
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
Restore manually on the target server:
|
| 43 |
+
|
| 44 |
+
```bash
|
| 45 |
+
bash ~/restore_livecodebench_venv.sh \
|
| 46 |
+
~/LiveCodeBench-venv-portable-20260407.tar.zst \
|
| 47 |
+
/data/repos/LiveCodeBench/.venv
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## What The Restore Script Does
|
| 51 |
+
|
| 52 |
+
- Verifies the archive checksum when the `.sha256` file is present.
|
| 53 |
+
- Extracts the environment.
|
| 54 |
+
- Rewrites shebangs and `pyvenv.cfg` for the target path.
|
| 55 |
+
- Uses the bundled `.python-home` runtime so the venv does not depend on the original source machine's `uv` Python location.
|
| 56 |
+
|
| 57 |
+
## Notes
|
| 58 |
+
|
| 59 |
+
- The target server should have a compatible Linux userspace.
|
| 60 |
+
- Native wheels may still require compatible CPU architecture, `glibc`, `libstdc++`, and CUDA driver/runtime versions.
|
| 61 |
+
- The default target path is `/data/repos/LiveCodeBench/.venv`, but you can restore to a different path by passing a different second argument to `restore_livecodebench_venv.sh`.
|
| 62 |
+
|
| 63 |
+
## Checksum
|
| 64 |
+
|
| 65 |
+
Current archive SHA256:
|
| 66 |
+
|
| 67 |
+
```text
|
| 68 |
+
da52c6e9200a7f14b8fba8d733b0b168f4cdf42c69f328986405b0a53fe5a0a0
|
| 69 |
+
```
|
restore_livecodebench_venv.sh
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 5 |
+
|
| 6 |
+
ARCHIVE="${1:-$SCRIPT_DIR/LiveCodeBench-venv-portable-20260407.tar.zst}"
|
| 7 |
+
TARGET="${2:-/data/repos/LiveCodeBench/.venv}"
|
| 8 |
+
OLD_PATH="${OLD_PATH:-/data/repos/LiveCodeBench/.venv}"
|
| 9 |
+
VERIFY_SHA="${VERIFY_SHA:-1}"
|
| 10 |
+
|
| 11 |
+
if [[ ! -f "$ARCHIVE" ]]; then
|
| 12 |
+
echo "archive not found: $ARCHIVE" >&2
|
| 13 |
+
exit 1
|
| 14 |
+
fi
|
| 15 |
+
|
| 16 |
+
if ! command -v tar >/dev/null 2>&1; then
|
| 17 |
+
echo "tar is required on the target server" >&2
|
| 18 |
+
exit 1
|
| 19 |
+
fi
|
| 20 |
+
|
| 21 |
+
if [[ "$ARCHIVE" == *.tar.zst ]] && ! tar --help 2>/dev/null | grep -q -- --zstd; then
|
| 22 |
+
echo "this tar does not support --zstd; install GNU tar with zstd support" >&2
|
| 23 |
+
exit 1
|
| 24 |
+
fi
|
| 25 |
+
|
| 26 |
+
sha_file="${ARCHIVE}.sha256"
|
| 27 |
+
if [[ "$VERIFY_SHA" != "0" && -f "$sha_file" ]] && command -v sha256sum >/dev/null 2>&1; then
|
| 28 |
+
(
|
| 29 |
+
cd "$(dirname "$sha_file")"
|
| 30 |
+
sha256sum -c "$(basename "$sha_file")"
|
| 31 |
+
)
|
| 32 |
+
fi
|
| 33 |
+
|
| 34 |
+
target_parent="$(dirname "$TARGET")"
|
| 35 |
+
tmp_root="$(mktemp -d)"
|
| 36 |
+
tmp_extract="$tmp_root/extract"
|
| 37 |
+
|
| 38 |
+
cleanup() {
|
| 39 |
+
rm -rf "$tmp_root"
|
| 40 |
+
}
|
| 41 |
+
trap cleanup EXIT
|
| 42 |
+
|
| 43 |
+
mkdir -p "$tmp_extract" "$target_parent"
|
| 44 |
+
tar --zstd -xpf "$ARCHIVE" -C "$tmp_extract"
|
| 45 |
+
|
| 46 |
+
if [[ ! -d "$tmp_extract/.venv" ]]; then
|
| 47 |
+
echo "archive did not contain .venv at its root" >&2
|
| 48 |
+
exit 1
|
| 49 |
+
fi
|
| 50 |
+
|
| 51 |
+
rm -rf "$TARGET"
|
| 52 |
+
mkdir -p "$TARGET"
|
| 53 |
+
cp -a "$tmp_extract/.venv/." "$TARGET/"
|
| 54 |
+
|
| 55 |
+
NEW_PATH="$TARGET"
|
| 56 |
+
BUNDLED_PYTHON_HOME="$TARGET/.python-home"
|
| 57 |
+
|
| 58 |
+
if [[ -x "$BUNDLED_PYTHON_HOME/bin/python3.11" ]]; then
|
| 59 |
+
rm -f "$TARGET/bin/python" "$TARGET/bin/python3" "$TARGET/bin/python3.11"
|
| 60 |
+
ln -s ../.python-home/bin/python3.11 "$TARGET/bin/python"
|
| 61 |
+
ln -s python "$TARGET/bin/python3"
|
| 62 |
+
ln -s python "$TARGET/bin/python3.11"
|
| 63 |
+
fi
|
| 64 |
+
|
| 65 |
+
NEW_PYTHON="$TARGET/bin/python3"
|
| 66 |
+
if [[ ! -x "$NEW_PYTHON" ]]; then
|
| 67 |
+
NEW_PYTHON="$TARGET/bin/python"
|
| 68 |
+
fi
|
| 69 |
+
|
| 70 |
+
rewrite_text_file() {
|
| 71 |
+
local file="$1"
|
| 72 |
+
OLD_PATH="$OLD_PATH" NEW_PATH="$NEW_PATH" perl -0pi -e 's/\Q$ENV{OLD_PATH}\E/$ENV{NEW_PATH}/g' "$file"
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
patch_shebang() {
|
| 76 |
+
local file="$1"
|
| 77 |
+
local first_line
|
| 78 |
+
first_line="$(head -n 1 "$file" || true)"
|
| 79 |
+
if [[ "$first_line" == "#!"*"$OLD_PATH/bin/python"* ]]; then
|
| 80 |
+
NEW_PYTHON="$NEW_PYTHON" perl -0pi -e 's@^#!.*$@#!$ENV{NEW_PYTHON}@m' "$file"
|
| 81 |
+
fi
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
while IFS= read -r -d '' file; do
|
| 85 |
+
if grep -Iq . "$file"; then
|
| 86 |
+
rewrite_text_file "$file"
|
| 87 |
+
patch_shebang "$file"
|
| 88 |
+
fi
|
| 89 |
+
done < <(find "$TARGET/bin" -maxdepth 1 -type f -print0)
|
| 90 |
+
|
| 91 |
+
if [[ -f "$TARGET/pyvenv.cfg" ]]; then
|
| 92 |
+
rewrite_text_file "$TARGET/pyvenv.cfg"
|
| 93 |
+
if [[ -d "$BUNDLED_PYTHON_HOME/bin" ]]; then
|
| 94 |
+
BUNDLED_PYTHON_HOME="$BUNDLED_PYTHON_HOME" perl -0pi -e 's/^home = .*$/home = $ENV{BUNDLED_PYTHON_HOME}\/bin/m' "$TARGET/pyvenv.cfg"
|
| 95 |
+
else
|
| 96 |
+
NEW_PATH="$NEW_PATH" perl -0pi -e 's/^home = .*$/home = $ENV{NEW_PATH}\/bin/m' "$TARGET/pyvenv.cfg"
|
| 97 |
+
fi
|
| 98 |
+
fi
|
| 99 |
+
|
| 100 |
+
"$NEW_PYTHON" -c 'import sys; print(sys.executable); print(sys.prefix)'
|
| 101 |
+
|
| 102 |
+
cat <<EOF
|
| 103 |
+
restore complete
|
| 104 |
+
archive: $ARCHIVE
|
| 105 |
+
target: $TARGET
|
| 106 |
+
python: $NEW_PYTHON
|
| 107 |
+
|
| 108 |
+
activate with:
|
| 109 |
+
source $TARGET/bin/activate
|
| 110 |
+
|
| 111 |
+
note:
|
| 112 |
+
native packages still require a compatible target server
|
| 113 |
+
(same CPU arch, similar glibc/libstdc++, and matching CUDA stack if used)
|
| 114 |
+
EOF
|
send_livecodebench_venv_to_server.sh
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
| 5 |
+
|
| 6 |
+
REMOTE="${1:-}"
|
| 7 |
+
REMOTE_STAGE_DIR="${2:-~}"
|
| 8 |
+
REMOTE_TARGET="${3:-/data/repos/LiveCodeBench/.venv}"
|
| 9 |
+
|
| 10 |
+
ARCHIVE="$SCRIPT_DIR/LiveCodeBench-venv-portable-20260407.tar.zst"
|
| 11 |
+
SHA_FILE="${ARCHIVE}.sha256"
|
| 12 |
+
RESTORE_SCRIPT="$SCRIPT_DIR/restore_livecodebench_venv.sh"
|
| 13 |
+
|
| 14 |
+
if [[ -z "$REMOTE" ]]; then
|
| 15 |
+
echo "usage: $0 user@host [remote_stage_dir] [remote_target_venv_path]" >&2
|
| 16 |
+
exit 1
|
| 17 |
+
fi
|
| 18 |
+
|
| 19 |
+
for path in "$ARCHIVE" "$SHA_FILE" "$RESTORE_SCRIPT"; do
|
| 20 |
+
if [[ ! -e "$path" ]]; then
|
| 21 |
+
echo "missing required file: $path" >&2
|
| 22 |
+
exit 1
|
| 23 |
+
fi
|
| 24 |
+
done
|
| 25 |
+
|
| 26 |
+
scp "$ARCHIVE" "$SHA_FILE" "$RESTORE_SCRIPT" "$REMOTE":"$REMOTE_STAGE_DIR"/
|
| 27 |
+
|
| 28 |
+
archive_name="$(basename "$ARCHIVE")"
|
| 29 |
+
restore_name="$(basename "$RESTORE_SCRIPT")"
|
| 30 |
+
|
| 31 |
+
cat <<EOF
|
| 32 |
+
copied files to $REMOTE:$REMOTE_STAGE_DIR
|
| 33 |
+
|
| 34 |
+
next step on the remote server:
|
| 35 |
+
ssh $REMOTE 'bash $REMOTE_STAGE_DIR/$restore_name $REMOTE_STAGE_DIR/$archive_name $REMOTE_TARGET'
|
| 36 |
+
EOF
|