Skip to content

Commit

Permalink
[CHORE] Possibility to create environment with system installed uv (#…
Browse files Browse the repository at this point in the history
…3281)

I encountered an inconvenient dependency on a pre-installed version of
Python.
It is very convenient to create an environment with the required version
via uv.
  • Loading branch information
maruschin authored Nov 14, 2024
1 parent c4e1ab2 commit 711e862
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
SHELL=/bin/bash
VENV = .venv
IS_M1 ?= 0
PYTHON_VERSION ?= python3.11

# Hypothesis
HYPOTHESIS_MAX_EXAMPLES ?= 100
Expand All @@ -21,17 +22,21 @@ endif


.venv: ## Set up virtual environment
ifeq (, $(shell which uv))
python3 -m venv $(VENV)
$(VENV_BIN)/python -m pip install --upgrade uv
## Hacks to deal with grpcio compile errors on m1 macs
else
uv venv $(VENV) -p $(PYTHON_VERSION)
endif
ifeq ($(IS_M1), 1)
GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 \
## Hacks to deal with grpcio compile errors on m1 macs
GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 \
GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 \
CFLAGS="${CFLAGS} -I /opt/homebrew/opt/openssl/include" \
LDFLAGS="${LDFLAGS} -L /opt/homebrew/opt/openssl/lib" \
$(VENV_BIN)/uv pip install -r requirements-dev.txt
. $(VENV_BIN)/activate; uv pip install -r requirements-dev.txt
else
$(VENV_BIN)/uv pip install -r requirements-dev.txt
. $(VENV_BIN)/activate; uv pip install -r requirements-dev.txt
endif

.PHONY: check-toolchain
Expand Down

0 comments on commit 711e862

Please sign in to comment.