Skip to content

Commit f17311c

Browse files
authored
Replace pip with uv pip (ethereum#4100)
1 parent 526d550 commit f17311c

2 files changed

Lines changed: 15 additions & 26 deletions

File tree

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ commands:
3535
description: "Restore the cache with pyspec keys"
3636
steps:
3737
- restore_cached_venv:
38-
venv_name: v32-pyspec
38+
venv_name: v33-pyspec
3939
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "pyproject.toml" }}
4040
save_pyspec_cached_venv:
4141
description: Save a venv into a cache with pyspec keys"
4242
steps:
4343
- save_cached_venv:
44-
venv_name: v32-pyspec
44+
venv_name: v33-pyspec
4545
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "pyproject.toml" }}
4646
venv_path: ./venv
4747
jobs:
@@ -75,7 +75,7 @@ jobs:
7575
- restore_pyspec_cached_venv
7676
- run:
7777
name: Install pyspec requirements
78-
command: make eth2spec
78+
command: make pyspec
7979
- save_pyspec_cached_venv
8080
test-phase0:
8181
docker:

Makefile

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ ALL_EXECUTABLE_SPEC_NAMES = \
1919
clean \
2020
coverage \
2121
detect_errors \
22-
eth2spec \
2322
gen_all \
2423
gen_list \
2524
help \
@@ -41,7 +40,6 @@ help:
4140
@echo "make $(BOLD)clean$(NORM) -- delete all untracked files"
4241
@echo "make $(BOLD)coverage$(NORM) -- run pyspec tests with coverage"
4342
@echo "make $(BOLD)detect_errors$(NORM) -- detect generator errors"
44-
@echo "make $(BOLD)eth2spec$(NORM) -- force rebuild eth2spec package"
4543
@echo "make $(BOLD)gen_<gen>$(NORM) -- run a single generator"
4644
@echo "make $(BOLD)gen_all$(NORM) -- run all generators"
4745
@echo "make $(BOLD)gen_list$(NORM) -- list all generator targets"
@@ -60,32 +58,23 @@ PYTHON_VENV = $(VENV)/bin/python3
6058
PIP_VENV = $(VENV)/bin/pip3
6159
CODESPELL_VENV = $(VENV)/bin/codespell
6260

63-
# Make a virtual environment will all of the necessary dependencies.
64-
$(VENV): pyproject.toml
61+
# Make a virtual environment.
62+
$(VENV):
6563
@echo "Creating virtual environment"
6664
@python3 -m venv $(VENV)
65+
@$(PIP_VENV) install --quiet uv==0.5.24
6766

6867
###############################################################################
6968
# Specification
7069
###############################################################################
7170

7271
TEST_LIBS_DIR = $(CURDIR)/tests/core
7372
PYSPEC_DIR = $(TEST_LIBS_DIR)/pyspec
74-
SITE_PACKAGES := $(wildcard $(VENV)/lib/python*/site-packages)
75-
ETH2SPEC := $(SITE_PACKAGES)/eth2spec
76-
77-
# Install the eth2spec package.
78-
# The pipe indicates that venv is an order-only prerequisite.
79-
# When restoring venv cache, its timestamp is newer than eth2spec.
80-
$(ETH2SPEC): setup.py | $(VENV)
81-
@$(PIP_VENV) install .[docs,lint,test,generator]
82-
83-
# Force rebuild/install the eth2spec package.
84-
eth2spec:
85-
@$(MAKE) --always-make $(ETH2SPEC)
8673

8774
# Create the pyspec for all phases.
88-
pyspec: $(VENV) setup.py
75+
pyspec: $(VENV) setup.py pyproject.toml
76+
@echo "Building eth2spec"
77+
@$(PYTHON_VENV) -m uv pip install .[docs,lint,test,generator]
8978
@echo "Building all pyspecs"
9079
@$(PYTHON_VENV) setup.py pyspecdev
9180

@@ -112,7 +101,7 @@ test: MAYBE_TEST := $(if $(k),-k=$(k))
112101
test: MAYBE_FORK := $(if $(fork),--fork=$(fork))
113102
test: PRESET := --preset=$(if $(preset),$(preset),minimal)
114103
test: BLS := --bls-type=$(if $(bls),$(bls),fastest)
115-
test: $(ETH2SPEC) pyspec
104+
test: pyspec
116105
@mkdir -p $(TEST_REPORT_DIR)
117106
@$(PYTHON_VENV) -m pytest \
118107
-n auto \
@@ -136,7 +125,7 @@ COVERAGE_SCOPE := $(foreach S,$(ALL_EXECUTABLE_SPEC_NAMES), --cov=eth2spec.$S.$(
136125
# Run pytest with coverage tracking
137126
_test_with_coverage: MAYBE_TEST := $(if $(k),-k=$(k))
138127
_test_with_coverage: MAYBE_FORK := $(if $(fork),--fork=$(fork))
139-
_test_with_coverage: $(ETH2SPEC) pyspec
128+
_test_with_coverage: pyspec
140129
@$(PYTHON_VENV) -m pytest \
141130
-n auto \
142131
$(MAYBE_TEST) \
@@ -210,7 +199,7 @@ _check_toc: $(MARKDOWN_FILES:=.toc)
210199
@[ "$$(find . -name '*.md.tmp' -print -quit)" ] && exit 1 || exit 0
211200

212201
# Check for mistakes.
213-
lint: $(ETH2SPEC) pyspec _check_toc
202+
lint: pyspec _check_toc
214203
@$(CODESPELL_VENV) . --skip "./.git,$(VENV),$(PYSPEC_DIR)/.mypy_cache" -I .codespell-whitelist
215204
@$(PYTHON_VENV) -m flake8 --config $(FLAKE8_CONFIG) $(PYSPEC_DIR)/eth2spec
216205
@$(PYTHON_VENV) -m flake8 --config $(FLAKE8_CONFIG) $(TEST_GENERATORS_DIR)
@@ -235,11 +224,11 @@ gen_list:
235224
done
236225

237226
# Run one generator.
238-
# This will forcibly rebuild eth2spec just in case.
227+
# This will forcibly rebuild pyspec just in case.
239228
# To check modules for a generator, append modcheck=true, eg:
240229
# make gen_genesis modcheck=true
241230
gen_%: MAYBE_MODCHECK := $(if $(filter true,$(modcheck)),--modcheck)
242-
gen_%: eth2spec
231+
gen_%: pyspec
243232
@mkdir -p $(TEST_VECTOR_DIR)
244233
@$(PYTHON_VENV) $(GENERATOR_DIR)/$*/main.py \
245234
--output $(TEST_VECTOR_DIR) \
@@ -259,7 +248,7 @@ detect_errors: $(TEST_VECTOR_DIR)
259248
fi
260249

261250
# Generate KZG trusted setups for testing.
262-
kzg_setups: $(ETH2SPEC)
251+
kzg_setups: pyspec
263252
@for preset in minimal mainnet; do \
264253
$(PYTHON_VENV) $(SCRIPTS_DIR)/gen_kzg_trusted_setups.py \
265254
--secret=1337 \

0 commit comments

Comments
 (0)