From 0710e7eca94d7d5dc951a91e3c35de2b236586a8 Mon Sep 17 00:00:00 2001 From: "Armen Zambrano G." <44410+armenzg@users.noreply.github.com> Date: Wed, 27 May 2026 09:17:05 -0400 Subject: [PATCH 1/2] build(make): prefer .venv tooling for Python targets Resolve Python and pip from .venv/bin when available so local make targets use the project virtualenv instead of ambient PATH tools. Co-Authored-By: Codex Co-authored-by: Cursor --- Makefile | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 898e3b57..8e1192c8 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,27 @@ -# Makefile assumes that direnv is active, or that pip/python on PATH -# is what you want to use. +# Makefile prefers local virtualenv tools when available, and falls +# back to PATH tools when .venv has not been created yet. # unstable protos are only included in local development and not part of release packages SENTRY_PROTOS_BUILD_UNSTABLE := 1 +PYTHON ?= $(if $(wildcard .venv/bin/python),.venv/bin/python,python) +PIP ?= $(if $(wildcard .venv/bin/pip),.venv/bin/pip,pip) +PYTEST ?= $(if $(wildcard .venv/bin/pytest),.venv/bin/pytest,pytest) +SABLEDOCS ?= $(if $(wildcard .venv/bin/sabledocs),.venv/bin/sabledocs,sabledocs) .PHONY: update-venv update-venv: - pip install -r requirements.txt + $(PIP) install -r requirements.txt # Python client targets .PHONY: build-py build-py: - pip install -r requirements.txt - SENTRY_PROTOS_BUILD_UNSTABLE=$(SENTRY_PROTOS_BUILD_UNSTABLE) python py/generate.py + $(PIP) install -r requirements.txt + SENTRY_PROTOS_BUILD_UNSTABLE=$(SENTRY_PROTOS_BUILD_UNSTABLE) $(PYTHON) py/generate.py .PHONY: package-py package-py: make build-py SENTRY_PROTO_BUILD_UNSTABLE=0 - cd py && python -m build + cd py && $(PYTHON) -m build .PHONY: clean-py clean-py: @@ -68,11 +72,11 @@ ensure-protoc: .PHONY: docs docs: ensure-protoc - pip install sabledocs + $(PIP) install sabledocs protoc ./proto/sentry_protos/*/*/*.proto -I ./proto/ -o ./docs/descriptor.pb --include_source_info - cd docs && sabledocs + cd docs && $(SABLEDOCS) .PHONY: test-py test-py: - cd py && pip install -e . - pytest py/tests/ + cd py && $(PIP) install -e . + $(PYTEST) py/tests/ From eb3fe6814c4e79ac81f98e39597b8a8d8ff6b76d Mon Sep 17 00:00:00 2001 From: "Armen Zambrano G." <44410+armenzg@users.noreply.github.com> Date: Wed, 27 May 2026 16:16:32 -0400 Subject: [PATCH 2/2] fix(make): use absolute .venv tool paths Resolve .venv tool references from repository root so commands that cd into subdirectories still run the intended virtualenv binaries. Co-Authored-By: Codex Co-authored-by: Cursor --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 8e1192c8..f5aaa9c4 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,10 @@ # unstable protos are only included in local development and not part of release packages SENTRY_PROTOS_BUILD_UNSTABLE := 1 -PYTHON ?= $(if $(wildcard .venv/bin/python),.venv/bin/python,python) -PIP ?= $(if $(wildcard .venv/bin/pip),.venv/bin/pip,pip) -PYTEST ?= $(if $(wildcard .venv/bin/pytest),.venv/bin/pytest,pytest) -SABLEDOCS ?= $(if $(wildcard .venv/bin/sabledocs),.venv/bin/sabledocs,sabledocs) +PYTHON ?= $(if $(wildcard .venv/bin/python),$(CURDIR)/.venv/bin/python,python) +PIP ?= $(if $(wildcard .venv/bin/pip),$(CURDIR)/.venv/bin/pip,pip) +PYTEST ?= $(if $(wildcard .venv/bin/pytest),$(CURDIR)/.venv/bin/pytest,pytest) +SABLEDOCS ?= $(if $(wildcard .venv/bin/sabledocs),$(CURDIR)/.venv/bin/sabledocs,sabledocs) .PHONY: update-venv update-venv: