From 2d8661120eb1b599a72b654b52bb0b6d20a94a71 Mon Sep 17 00:00:00 2001 From: Youssef Assis <46084564+youssefassis@users.noreply.github.com> Date: Sun, 4 Oct 2026 08:03:14 +0200 Subject: [PATCH] [CHORE] Remove the Docker image uv.lock already pins every dependency, including the PyTorch build, so uv sync gives the same environment as the image. Removing it drops a second installation path to maintain and the slowest CI job. The DEEPANESEG_GIT_COMMIT fallback, only set by the image, goes too: outside a git checkout, run_info records the commit as 'unknown'. --- .dockerignore | 13 ------------- .github/workflows/ci.yml | 11 ----------- Dockerfile | 24 ------------------------ README.md | 15 --------------- deepaneseg/utils.py | 4 ++-- 5 files changed, 2 insertions(+), 65 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index aea440e..0000000 --- a/.dockerignore +++ /dev/null @@ -1,13 +0,0 @@ -.git -.github -.venv -**/__pycache__ -.pytest_cache -.ruff_cache -*.egg-info -outputs -multirun -logs -*.pytorch -*.nii -*.nii.gz diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de11514..624674d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,14 +43,3 @@ jobs: /tmp/venv/bin/deepaneseg-train --help /tmp/venv/bin/deepaneseg-preprocess data_dir=data test -f data/0Work/split_pats.json - - docker: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build (CPU PyTorch) - run: docker build -t deepaneseg:cpu --build-arg TORCH=cpu . - - name: Smoke test - run: | - docker run --rm deepaneseg:cpu python -c "import torch, deepaneseg.utils; print(torch.__version__)" - docker run --rm deepaneseg:cpu deepaneseg-train --help diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 427424a..0000000 --- a/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM python:3.12-slim - -COPY --from=ghcr.io/astral-sh/uv:0.11.15 /uv /uvx /bin/ - -# PyTorch build: cu126 (NVIDIA GPU, run with --gpus all) or cpu -ARG TORCH=cu126 -# Recorded in each training's run_info.json, since the image has no .git -ARG GIT_COMMIT=unknown -ENV UV_COMPILE_BYTECODE=1 \ - UV_LINK_MODE=copy \ - UV_PYTHON_DOWNLOADS=never \ - DEEPANESEG_GIT_COMMIT=${GIT_COMMIT} \ - PATH="/app/.venv/bin:$PATH" - -WORKDIR /app - -# Dependencies first, so that code changes don't reinstall them -COPY pyproject.toml uv.lock ./ -RUN uv sync --locked --no-install-project --no-dev --extra ${TORCH} && rm -rf /root/.cache/uv - -COPY . . -RUN uv sync --locked --no-dev --extra ${TORCH} && rm -rf /root/.cache/uv - -CMD ["deepaneseg-train", "--help"] diff --git a/README.md b/README.md index e30b9b5..39a4a72 100644 --- a/README.md +++ b/README.md @@ -65,21 +65,6 @@ is activated. Without uv, `pip install git+https://github.com/youssefassis/DeepAneSeg` installs the package and its commands (with PyTorch's default build from PyPI). -### Docker -The image installs the same locked versions, with the GPU (default) or CPU PyTorch build: -``` -docker build -t deepaneseg --build-arg GIT_COMMIT=$(git rev-parse HEAD) . -docker build -t deepaneseg:cpu --build-arg TORCH=cpu . -``` -Mount the data folder and run any command; outputs are written to the mounted folder: -``` -docker run --rm --gpus all --shm-size=8g -v /path/to/Data:/data deepaneseg \ - deepaneseg-train data_dir=/data name=exp1 -``` -GPU runs need the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/) on -the host. `--shm-size` gives the data-loading workers enough shared memory, and `--user $(id -u):$(id -g)` creates -the output files with your own user. - ## Data ### Layout Each patient is a folder named `P` followed by four digits: diff --git a/deepaneseg/utils.py b/deepaneseg/utils.py index 98288d0..d9ab6d9 100644 --- a/deepaneseg/utils.py +++ b/deepaneseg/utils.py @@ -92,14 +92,14 @@ def seed_everything(seed): def _git_commit(): - """Commit of the checkout the code runs from, or DEEPANESEG_GIT_COMMIT (set in the Docker image).""" + """Commit of the checkout the code runs from ("unknown" outside a git checkout).""" repo = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) try: commit = subprocess.run(["git", "rev-parse", "HEAD"], cwd=repo, capture_output=True, text=True, check=True) status = subprocess.run(["git", "status", "--porcelain"], cwd=repo, capture_output=True, text=True, check=True) return commit.stdout.strip(), bool(status.stdout.strip()) except (OSError, subprocess.CalledProcessError): - return os.environ.get("DEEPANESEG_GIT_COMMIT", "unknown"), None + return "unknown", None def run_info(**extra):