Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: use uv if present #1754

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
31 changes: 22 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,21 @@ STARKNET_SIERRA_COMPILE_CAIRO_1:=cairo1/bin/starknet-sierra-compile
STARKNET_COMPILE_CAIRO_2:=cairo2/bin/starknet-compile
STARKNET_SIERRA_COMPILE_CAIRO_2:=cairo2/bin/starknet-sierra-compile

export PATH:=$(PATH):$(HOME)/.cargo/bin

ifndef PROPTEST_CASES
PROPTEST_CASES:=10
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 @@ -196,6 +206,9 @@ build-cairo-2-compiler:
&& mv cairo/ cairo2/; \
fi

uv-program:
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.1.41/uv-installer.sh | sh

cargo-deps:
cargo install --version 0.3.1 iai-callgrind-runner
cargo install --version 1.1.0 cargo-criterion
Expand All @@ -210,23 +223,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 +379,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
5 changes: 1 addition & 4 deletions install-scripts/install-debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ eval "$(pyenv init -)"
# Make sure pyenv has been installed correctly
pyenv -v

make uv-program
make deps

pyenv local 3.9.15

pip install -r requirements.txt

echo "-- You need to follow these instructions to finish installing pyenv: --"
pyenv init || true
5 changes: 1 addition & 4 deletions install-scripts/install-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ brew install pyenv gmp
# Make sure pyenv has been installed correctly
pyenv -v

make uv-program
make deps-macos

pyenv local 3.9.15

pip install -r requirements.txt

echo "-- You need to follow these instructions to finish installing pyenv: --"
pyenv init || true
5 changes: 1 addition & 4 deletions install-scripts/install-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ eval "$(pyenv init -)"
# Make sure pyenv has been installed correctly
pyenv -v

make uv-program
make deps

pyenv local 3.9.15

pip install -r requirements.txt

echo "-- You need to follow these instructions to finish installing pyenv: --"
pyenv init || true
Loading