Skip to content

Commit

Permalink
deps: use uv if present
Browse files Browse the repository at this point in the history
`uv` is a compatible `pip` replacement made in Rust, which runs
significantly faster. It saves about 70 seconds on my M3 when installing
deps.
  • Loading branch information
Oppen committed May 8, 2024
1 parent 258dd84 commit f4f1612
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ ifndef PROPTEST_CASES
export PROPTEST_CASES
endif

ifeq (, $(shell which uv))
PIP_CMD=python -m pip
VENV_CMD=python -m venv
else
PIP_CMD=uv pip
VENV_CMD=uv venv
endif

.PHONY: build-cairo-1-compiler build-cairo-1-compiler-macos build-cairo-2-compiler build-cairo-2-compiler-macos \
deps deps-macos cargo-deps build run check test clippy coverage benchmark flamegraph\
compare_benchmarks_deps compare_benchmarks docs clean \
Expand Down Expand Up @@ -210,23 +218,23 @@ cairo1-run-deps:

deps: create-proof-programs-symlinks cargo-deps build-cairo-1-compiler build-cairo-2-compiler cairo1-run-deps
pyenv install -s pypy3.9-7.3.9
PYENV_VERSION=pypy3.9-7.3.9 python -m venv cairo-vm-pypy-env
PYENV_VERSION=pypy3.9-7.3.9 $(VENV_CMD) cairo-vm-pypy-env
. cairo-vm-pypy-env/bin/activate ; \
pip install -r requirements.txt ; \
$(PIP_CMD) install -r requirements.txt ; \
pyenv install -s 3.9.15
PYENV_VERSION=3.9.15 python -m venv cairo-vm-env
PYENV_VERSION=3.9.15 $(VENV_CMD) cairo-vm-env
. cairo-vm-env/bin/activate ; \
pip install -r requirements.txt ; \
$(PIP_CMD) install -r requirements.txt ; \

deps-macos: create-proof-programs-symlinks cargo-deps build-cairo-1-compiler-macos build-cairo-2-compiler-macos cairo1-run-deps
arch -x86_64 pyenv install -s pypy3.9-7.3.9
PYENV_VERSION=pypy3.9-7.3.9 python -m venv cairo-vm-pypy-env
PYENV_VERSION=pypy3.9-7.3.9 $(VENV_CMD) cairo-vm-pypy-env
. cairo-vm-pypy-env/bin/activate ; \
CFLAGS=-I/opt/homebrew/opt/gmp/include LDFLAGS=-L/opt/homebrew/opt/gmp/lib pip install -r requirements.txt ; \
CFLAGS=-I/opt/homebrew/opt/gmp/include LDFLAGS=-L/opt/homebrew/opt/gmp/lib $(PIP_CMD) install -r requirements.txt ; \
pyenv install -s 3.9.15
PYENV_VERSION=3.9.15 python -m venv cairo-vm-env
PYENV_VERSION=3.9.15 $(VENV_CMD) cairo-vm-env
. cairo-vm-env/bin/activate ; \
CFLAGS=-I/opt/homebrew/opt/gmp/include LDFLAGS=-L/opt/homebrew/opt/gmp/lib pip install -r requirements.txt ; \
CFLAGS=-I/opt/homebrew/opt/gmp/include LDFLAGS=-L/opt/homebrew/opt/gmp/lib $(PIP_CMD) install -r requirements.txt ; \

$(RELBIN):
cargo build --release
Expand Down Expand Up @@ -366,7 +374,7 @@ clean:
fuzzer-deps: build
cargo +nightly install cargo-fuzz
. cairo-vm-env/bin/activate; \
pip install atheris==2.2.2 maturin==1.2.3; \
$(PIP_CMD) install atheris==2.2.2 maturin==1.2.3; \
cd fuzzer/; \
maturin develop

Expand Down

0 comments on commit f4f1612

Please sign in to comment.