Skip to content

Commit 3f5b05d

Browse files
authored
build: add env-lowest-torch make target (#50)
* build: add env-lowest-torch make target Mirrors env-highest-torch to give local dev a way to create a venv pinned to the lowest supported PyTorch version, matching what test-lowest-pytorch already builds on demand. * refactor(Makefile): route test-lowest/highest-pytorch through env-lowest/highest-torch test-lowest-pytorch and test-highest-pytorch each duplicated the TORCH_GROUP + use_env logic that env-lowest-torch/env-highest-torch already encapsulate. Make the env-* targets a prerequisite instead, so one place owns how each pinned-torch venv gets built.
1 parent 6513455 commit 3f5b05d

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Use of this source code is governed by a BSD-3-Clause license that can
44
# be found in the LICENSE file or at https://opensource.org/licenses/BSD-3-Clause
55

6-
.PHONY: _maybe_patch_pyproject all api-list build check clean distclean distclean-all docs docs-clean docs-open env env-all env-docs env-highest-torch env-tutorial render-api-index set-auto-venv test test-cov test-fast test-highest-pytorch test-lowest-pytorch test-slow test-smoke test-tutorials version
6+
.PHONY: _maybe_patch_pyproject all api-list build check clean distclean distclean-all docs docs-clean docs-open env env-all env-docs env-highest-torch env-lowest-torch env-tutorial render-api-index set-auto-venv test test-cov test-fast test-highest-pytorch test-lowest-pytorch test-slow test-smoke test-tutorials version
77

88
SHELL := /bin/bash
99

@@ -190,6 +190,11 @@ env-highest-torch: _maybe_patch_pyproject
190190
@TORCH_GROUP=$(HIGHEST_TORCH_GROUP) $(SETUP_ENV) --venv $(VENV_HIGHEST_TORCH) --python-version $(PYTHON_VERSION)
191191
@$(call write_active_venv,$(VENV_HIGHEST_TORCH))
192192

193+
# Set up development environment with lowest supported PyTorch version
194+
env-lowest-torch: _maybe_patch_pyproject
195+
@TORCH_GROUP=$(LOWEST_TORCH_GROUP) $(SETUP_ENV) --venv $(VENV_LOWEST_TORCH) --python-version $(PYTHON_VERSION)
196+
@$(call write_active_venv,$(VENV_LOWEST_TORCH))
197+
193198
# Set up environment for running tutorials (quantization notebook)
194199
env-tutorial: _maybe_patch_pyproject
195200
@$(SETUP_ENV) --venv $(VENV_TUTORIAL) --python-version $(PYTHON_VERSION) --with-tutorial
@@ -254,18 +259,18 @@ test-smoke:
254259
echo "All smoke tests passed!"
255260

256261
# Run tests on lowest supported PyTorch version (pass PYTEST_ARGS for custom flags)
257-
test-lowest-pytorch:
262+
test-lowest-pytorch: env-lowest-torch
258263
@echo "Running tests on lowest PyTorch version supported..."
259-
@TORCH_GROUP=$(LOWEST_TORCH_GROUP) $(call use_env,VENV_LOWEST_TORCH) && \
264+
@source $(VENV_LOWEST_TORCH)/bin/activate && \
260265
echo "Testing with lowest supported PyTorch versions" && \
261266
uv run --no-sync --active python $(SCRIPTS)/make/log_versions.py && \
262267
$(RUN_TESTS) $(PYTEST_ARGS) && \
263268
echo "All tests passed!"
264269

265270
# Run tests on highest supported PyTorch version (pass PYTEST_ARGS for custom flags)
266-
test-highest-pytorch:
271+
test-highest-pytorch: env-highest-torch
267272
@echo "Running tests on highest PyTorch version supported..."
268-
@TORCH_GROUP=$(HIGHEST_TORCH_GROUP) $(call use_env,VENV_HIGHEST_TORCH) && \
273+
@source $(VENV_HIGHEST_TORCH)/bin/activate && \
269274
echo "Testing with latest supported PyTorch versions" && \
270275
uv run --no-sync --active python $(SCRIPTS)/make/log_versions.py && \
271276
$(RUN_TESTS) $(PYTEST_ARGS) && \

0 commit comments

Comments
 (0)