Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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),$(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:
pip install -r requirements.txt
$(PIP) install -r requirements.txt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be switching over to uv run instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good 👍🏻

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good callout. I kept this PR on the existing devenv/pip flow to keep scope tight, but I pushed a follow-up commit that fixes the path issue by resolving .venv tools with absolute $(CURDIR) paths so subdirectory recipes work reliably.

If you want, I can open a separate PR to evaluate moving these Make targets to uv run end-to-end.


# 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:
Expand Down Expand Up @@ -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/
Loading