Skip to content

Commit 78e2833

Browse files
committed
refactor(Makefile): alias highest/lowest torch groups for maintainability
Add HIGHEST_TORCH_GROUP/LOWEST_TORCH_GROUP variables and route the 4 places that hardcoded torch_2_11/torch_2_8 as a stand-in for "the extreme" (TORCH_GROUP's default, env-highest-torch, test-highest- pytorch, test-lowest-pytorch) through them instead. Addresses PR review feedback: bumping the project's torch version bounds now means changing 2 lines instead of manually finding every hardcoded reference. #32 (comment)
1 parent 92da64c commit 78e2833

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

Makefile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,15 @@ VENV_HIGHEST_TORCH ?= .venv-highest-torch
5353
VENV_LOWEST_TORCH ?= .venv-lowest-torch
5454
VENV_TUTORIAL ?= .venv-tutorial
5555

56+
# The torch_2_* groups (pyproject.toml [dependency-groups]) currently at
57+
# each end of the supported range. Bump these two lines — nothing else —
58+
# when the project's torch version bounds change.
59+
HIGHEST_TORCH_GROUP := torch_2_11
60+
LOWEST_TORCH_GROUP := torch_2_8
61+
5662
# Torch dependency group (pyproject.toml [dependency-groups]) that every
5763
# environment-building target (env, test, test-smoke, docs, ...) pins to.
58-
TORCH_GROUP ?= torch_2_11
64+
TORCH_GROUP ?= $(HIGHEST_TORCH_GROUP)
5965
export TORCH_GROUP
6066

6167
# Documentation directory. Defaults to $(MAKEFILE_DIR)docs so the same recipe
@@ -181,7 +187,7 @@ env: _maybe_patch_pyproject
181187

182188
# Set up development environment with latest supported PyTorch version
183189
env-highest-torch: _maybe_patch_pyproject
184-
@TORCH_GROUP=torch_2_11 $(SETUP_ENV) --venv $(VENV_HIGHEST_TORCH) --python-version $(PYTHON_VERSION)
190+
@TORCH_GROUP=$(HIGHEST_TORCH_GROUP) $(SETUP_ENV) --venv $(VENV_HIGHEST_TORCH) --python-version $(PYTHON_VERSION)
185191
@$(call write_active_venv,$(VENV_HIGHEST_TORCH))
186192

187193
# Set up environment for running tutorials (quantization notebook)
@@ -240,7 +246,7 @@ test-slow:
240246
@$(MAKE) test PYTEST_ARGS="--marker slow"
241247

242248
# Run smoke tests only (pass PYTEST_ARGS for custom flags, e.g., make test-smoke PYTEST_ARGS="--junitxml=results.xml").
243-
# Pass TORCH_GROUP to smoke test against a specific torch version (default: torch_2_11).
249+
# Pass TORCH_GROUP to smoke test against a specific torch version (default: HIGHEST_TORCH_GROUP).
244250
test-smoke:
245251
@$(call use_env,VENV) && \
246252
echo "Running smoke tests..." && \
@@ -250,7 +256,7 @@ test-smoke:
250256
# Run tests on lowest supported PyTorch version (pass PYTEST_ARGS for custom flags)
251257
test-lowest-pytorch:
252258
@echo "Running tests on lowest PyTorch version supported..."
253-
@TORCH_GROUP=torch_2_8 $(call use_env,VENV_LOWEST_TORCH) && \
259+
@TORCH_GROUP=$(LOWEST_TORCH_GROUP) $(call use_env,VENV_LOWEST_TORCH) && \
254260
echo "Testing with lowest supported PyTorch versions" && \
255261
uv run --no-sync --active python $(SCRIPTS)/make/log_versions.py && \
256262
$(RUN_TESTS) $(PYTEST_ARGS) && \
@@ -259,7 +265,7 @@ test-lowest-pytorch:
259265
# Run tests on highest supported PyTorch version (pass PYTEST_ARGS for custom flags)
260266
test-highest-pytorch:
261267
@echo "Running tests on highest PyTorch version supported..."
262-
@TORCH_GROUP=torch_2_11 $(call use_env,VENV_HIGHEST_TORCH) && \
268+
@TORCH_GROUP=$(HIGHEST_TORCH_GROUP) $(call use_env,VENV_HIGHEST_TORCH) && \
263269
echo "Testing with latest supported PyTorch versions" && \
264270
uv run --no-sync --active python $(SCRIPTS)/make/log_versions.py && \
265271
$(RUN_TESTS) $(PYTEST_ARGS) && \

0 commit comments

Comments
 (0)