Skip to content

Commit bdd3942

Browse files
Migrate from poetry to uv (#2785)
* Update template * Update `Makefile` * Update `README.md` * Update `test-pr.yml` * Update `update-version.yml` * Remove tests for `solc-to-k` from `Makefile` * migrate from `poetry` to `uv` * add `uv2nix` and `pyproject-build-systems` to `update-version.yml` * update nix in CI * remove poetry patch files from `nix/resources` --------- Co-authored-by: Julian Kuners <[email protected]>
1 parent d45f12f commit bdd3942

32 files changed

+1915
-2465
lines changed

.github/actions/with-docker/action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ inputs:
1515
required: false
1616
type: string
1717
default: './'
18-
os:
18+
os:
1919
description: 'OS to setup Docker for.'
2020
required: false
2121
type: string
@@ -55,6 +55,7 @@ runs:
5555
GROUP=${USER}
5656
Z3_VERSION=$(cat deps/z3)
5757
K_VERSION=$(cat deps/k_release)
58+
UV_VERSION=$(cat deps/uv_release)
5859
USER_ID=1000
5960
GROUP_ID=${USER_ID}
6061
@@ -67,7 +68,8 @@ runs:
6768
--build-arg BASE_DISTRO=${BASE_DISTRO} \
6869
--build-arg K_VERSION=${K_VERSION} \
6970
--build-arg Z3_VERSION=${Z3_VERSION} \
70-
--build-arg LLVM_VERSION=${LLVM_VERSION}
71+
--build-arg LLVM_VERSION=${LLVM_VERSION} \
72+
--build-arg UV_VERSION=${UV_VERSION}
7173
7274
docker run \
7375
--name ${CONTAINER_NAME} \

.github/workflows/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ WORKDIR /home/${USER}/workspace
4343

4444
ENV PATH=/home/${USER}/.local/bin:${PATH}
4545

46-
RUN curl -sSL https://install.python-poetry.org | python3 - --version 1.8.3 \
47-
&& poetry --version
46+
ARG UV_VERSION
47+
RUN curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | sh \
48+
&& uv --version

.github/workflows/test-pr.yml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,20 @@ jobs:
1212
name: 'Code Quality Checks'
1313
runs-on: ubuntu-latest
1414
steps:
15+
- name: 'Check out code'
16+
uses: actions/checkout@v4
1517
- name: 'Setup Python 3.10'
1618
uses: actions/setup-python@v5
1719
with:
1820
python-version: '3.10'
19-
- name: 'Check out code'
20-
uses: actions/checkout@v4
21-
- name: 'Install Poetry'
22-
uses: Gr1N/setup-poetry@v9
21+
- name: 'Get uv release'
22+
id: uv_release
23+
run: |
24+
echo uv_version=$(cat deps/uv_release) >> "${GITHUB_OUTPUT}"
25+
- name: 'Install uv'
26+
uses: astral-sh/setup-uv@v6
27+
with:
28+
version: ${{ steps.uv_release.outputs.uv_version }}
2329
- name: 'Run code quality checks'
2430
run: make -C kevm-pyk check
2531
- name: 'Run pyupgrade'
@@ -32,8 +38,14 @@ jobs:
3238
steps:
3339
- name: 'Check out code'
3440
uses: actions/checkout@v4
35-
- name: 'Install Poetry'
36-
uses: Gr1N/setup-poetry@v9
41+
- name: 'Get uv release'
42+
id: uv_release
43+
run: |
44+
echo uv_version=$(cat deps/uv_release) >> "${GITHUB_OUTPUT}"
45+
- name: 'Install uv'
46+
uses: astral-sh/setup-uv@v6
47+
with:
48+
version: ${{ steps.uv_release.outputs.uv_version }}
3749
- name: 'Run unit tests'
3850
run: make -C kevm-pyk cov-unit
3951

@@ -44,8 +56,14 @@ jobs:
4456
steps:
4557
- name: 'Check out code'
4658
uses: actions/checkout@v4
47-
- name: 'Install Poetry'
48-
uses: Gr1N/setup-poetry@v9
59+
- name: 'Get uv release'
60+
id: uv_release
61+
run: |
62+
echo uv_version=$(cat deps/uv_release) >> "${GITHUB_OUTPUT}"
63+
- name: 'Install uv'
64+
uses: astral-sh/setup-uv@v6
65+
with:
66+
version: ${{ steps.uv_release.outputs.uv_version }}
4967
- name: 'Run profiling'
5068
run: |
5169
make -C kevm-pyk profile
@@ -64,10 +82,8 @@ jobs:
6482
uses: ./.github/actions/with-docker
6583
with:
6684
container-name: kevm-ci-concrete-${{ github.sha }}
67-
- name: 'Build kevm-pyk'
68-
run: docker exec -u github-user kevm-ci-concrete-${{ github.sha }} /bin/bash -c 'make poetry'
6985
- name: 'Build targets'
70-
run: docker exec -u github-user kevm-ci-concrete-${{ github.sha }} /bin/bash -c 'CXX=clang++-14 poetry -C kevm-pyk run kdist --verbose build -j`nproc` evm-semantics.haskell evm-semantics.kllvm evm-semantics.kllvm-runtime'
86+
run: docker exec -u github-user kevm-ci-concrete-${{ github.sha }} /bin/bash -c 'CXX=clang++-14 uv --project kevm-pyk run -- kdist --verbose build -j`nproc` evm-semantics.haskell evm-semantics.kllvm evm-semantics.kllvm-runtime'
7187
- name: 'Test integration'
7288
run: docker exec -u github-user kevm-ci-concrete-${{ github.sha }} /bin/bash -c 'make test-integration'
7389
- name: 'Test conformance'
@@ -131,10 +147,8 @@ jobs:
131147
uses: ./.github/actions/with-docker
132148
with:
133149
container-name: kevm-ci-haskell-${{ matrix.test-suite }}-${{ github.sha }}
134-
- name: 'Build kevm-pyk'
135-
run: docker exec -u github-user kevm-ci-haskell-${{ matrix.test-suite }}-${{ github.sha }} /bin/bash -c 'make poetry'
136150
- name: 'Build distribution'
137-
run: docker exec -u github-user kevm-ci-haskell-${{ matrix.test-suite }}-${{ github.sha }} /bin/bash -c 'CXX=clang++-14 poetry -C kevm-pyk run kdist --verbose build -j`nproc` evm-semantics.plugin evm-semantics.haskell evm-semantics.haskell-summary'
151+
run: docker exec -u github-user kevm-ci-haskell-${{ matrix.test-suite }}-${{ github.sha }} /bin/bash -c 'CXX=clang++-14 uv --project kevm-pyk run -- kdist --verbose build -j`nproc` evm-semantics.plugin evm-semantics.haskell evm-semantics.haskell-summary'
138152
- name: 'Run proofs'
139153
run: docker exec -u github-user kevm-ci-haskell-${{ matrix.test-suite }}-${{ github.sha }} /bin/bash -c "make ${{ matrix.test-suite }} PYTEST_ARGS='-vv ${{ matrix.test-args }}' PYTEST_PARALLEL=${{ matrix.parallel }}"
140154
- name: 'Tear down Docker'

.github/workflows/update-version.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
- '_update-deps/runtimeverification/blockchain-k-plugin'
66
- '_update-deps/runtimeverification/k'
77
- '_update-deps/runtimeverification/rv-nix-tools'
8+
- '_update-deps-cron/uv2nix'
9+
- '_update-deps-cron/pyproject-build-systems'
810
workflow_dispatch:
911
# Stop in progress workflows on the same branch and same workflow to use latest committed code
1012
concurrency:
@@ -26,23 +28,34 @@ jobs:
2628
run: |
2729
git config user.name devops
2830
git config user.email [email protected]
29-
- name: 'Install Poetry'
30-
uses: Gr1N/setup-poetry@v9
31+
- name: 'Get uv release'
32+
id: uv_release
33+
run: |
34+
UV2NIX_VERSION=$(cat deps/uv2nix)
35+
UV_VERSION=$(curl -s https://raw.githubusercontent.com/pyproject-nix/uv2nix/$(cat deps/uv2nix)/pkgs/uv-bin/srcs.json | jq -r .version)
36+
[[ "${UV_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
37+
echo ${UV_VERSION} > deps/uv_release
38+
git add deps/uv_release && git commit -m "Sync uv version: uv ${UV_VERSION}" || true
39+
echo uv_version=${UV_VERSION} >> "${GITHUB_OUTPUT}"
40+
- name: 'Install uv'
41+
uses: astral-sh/setup-uv@v6
42+
with:
43+
version: ${{ steps.uv_release.outputs.uv_version }}
3144
- name: 'Update pyk release tag'
3245
run: |
3346
K_VERSION=$(cat deps/k_release)
34-
sed -i 's!kframework = "[0-9\.]*"!kframework = "'${K_VERSION}'"!' kevm-pyk/pyproject.toml
35-
poetry -C kevm-pyk update
36-
git add kevm-pyk/ && git commit -m "kevm-pyk/: sync poetry files pyk version ${K_VERSION}" || true
47+
sed -i 's! "kframework==[0-9\.]*,"! "kframework=='${K_VERSION}'",!' kevm-pyk/pyproject.toml
48+
uv --project kevm-pyk lock --upgrade
49+
git add kevm-pyk/ && git commit -m "kevm-pyk/: sync uv files pyk version ${K_VERSION}" || true
3750
- name: 'Update plugin release file'
3851
run: |
3952
BKP_VERSION=$(git -C kevm-pyk/src/kevm_pyk/kproj/plugin rev-parse HEAD)
4053
echo ${BKP_VERSION} > deps/blockchain-k-plugin_release
4154
git add deps/blockchain-k-plugin_release && git commit -m "deps/blockchain-k-plugin_release: sync release file version ${BKP_VERSION}" || true
4255
- name: 'Install Nix/Cachix'
43-
uses: cachix/install-nix-action@v19
56+
uses: cachix/install-nix-action@v31.5.1
4457
with:
45-
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
58+
install_url: https://releases.nixos.org/nix/nix-2.30.1/install
4659
extra_nix_config: |
4760
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
4861
- uses: cachix/cachix-action@v12
@@ -53,9 +66,13 @@ jobs:
5366
run: |
5467
K_VERSION=v$(cat deps/k_release)
5568
BKP_VERSION=$(cat deps/blockchain-k-plugin_release)
69+
UV2NIX_VERSION=$(cat deps/uv2nix)
70+
PYPROJECT_BUILD_SYSTEMS_VERSION=$(cat deps/pyproject-build-systems)
5671
RV_NIX_TOOLS_VERSION=$(cat deps/rv-nix-tools)
5772
sed -i 's! k-framework.url = "github:runtimeverification/k/[v0-9\.]*"! k-framework.url = "github:runtimeverification/k/'"${K_VERSION}"'"!' flake.nix
5873
sed -i 's! "github:runtimeverification/blockchain-k-plugin/[0-9a-f]*"! "github:runtimeverification/blockchain-k-plugin/'"${BKP_VERSION}"'"!' flake.nix
74+
sed -i 's! uv2nix.url = "github:pyproject-nix/uv2nix/[a-z0-9\.]*"! uv2nix.url = "github:pyproject-nix/uv2nix/'"${UV2NIX_VERSION}"'"!' flake.nix
75+
sed -i 's! pyproject-build-systems.url = "github:pyproject-nix/build-system-pkgs/[a-z0-9\.]*"! pyproject-build-systems.url = "github:pyproject-nix/build-system-pkgs/'"${PYPROJECT_BUILD_SYSTEMS_VERSION}"'"!' flake.nix
5976
sed -i 's! rv-nix-tools.url = "github:runtimeverification/rv-nix-tools/[a-z0-9\.]*"! rv-nix-tools.url = "github:runtimeverification/rv-nix-tools/'"${RV_NIX_TOOLS_VERSION}"'"!' flake.nix
6077
nix run .#update-from-submodules
6178
nix flake update

Makefile

Lines changed: 42 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
all: poetry
1+
default: kevm-pyk
22

33

44
# Building
@@ -11,21 +11,11 @@ else
1111
endif
1212

1313
KEVM_PYK_DIR := ./kevm-pyk
14-
POETRY := poetry -C $(KEVM_PYK_DIR)
15-
POETRY_RUN := $(POETRY) run --
14+
UV := uv --project $(KEVM_PYK_DIR)
15+
UV_RUN := $(UV) run --
1616

17-
18-
.PHONY: poetry-env download-json-fixtures
19-
poetry-env:
20-
$(POETRY) env use --no-cache $(PYTHON_BIN)
21-
22-
poetry: poetry-env
23-
$(POETRY) install
24-
25-
shell: poetry
26-
$(POETRY) shell
27-
28-
kevm-pyk: poetry-env
17+
.PHONY: kevm-pyk
18+
kevm-pyk:
2919
$(MAKE) -C $(KEVM_PYK_DIR)
3020

3121

@@ -37,10 +27,12 @@ test: test-integration test-conformance test-prove test-interactive
3727

3828
# Conformance Tests
3929

40-
test-conformance: poetry
30+
.PHONY: test-conformance
31+
test-conformance:
4132
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_conformance.py"
4233

43-
conformance-failing-list: poetry
34+
.PHONY: conformance-failing-list
35+
conformance-failing-list:
4436
cat /dev/null > tests/failing.llvm
4537
- $(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_conformance.py --save-failing --maxfail=10000"
4638
LC_ALL=en_US.UTF-8 sort -f -d -o tests/failing.llvm tests/failing.llvm
@@ -51,14 +43,15 @@ conformance-failing-list: poetry
5143
sed -i '1{/^[[:space:]]*$$/d;}' tests/failing.llvm ;\
5244
fi
5345

46+
.PHONY: download-json-fixtures
5447
download-json-fixtures:
5548
rm -rf tests/execution-spec-tests/fixtures
5649
cd tests/execution-spec-tests && bash get_execution_spec_tests.sh
5750

58-
test-fixtures: poetry download-json-fixtures
51+
test-fixtures: download-json-fixtures
5952
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_execution_spec_tests.py"
6053

61-
fixtures-failing-list: poetry download-json-fixtures
54+
fixtures-failing-list: download-json-fixtures
6255
cat /dev/null > tests/execution-spec-tests/failing.llvm
6356
- $(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_execution_spec_tests.py --save-failing --maxfail=10000"
6457
LC_ALL=en_US.UTF-8 sort -f -d -o tests/execution-spec-tests/failing.llvm tests/execution-spec-tests/failing.llvm
@@ -69,49 +62,61 @@ fixtures-failing-list: poetry download-json-fixtures
6962
sed -i '1{/^[[:space:]]*$$/d;}' tests/execution-spec-tests/failing.llvm ;\
7063
fi
7164

72-
test-vm: poetry
65+
.PHONY: test-vm
66+
test-vm:
7367
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_vm"
7468

75-
test-rest-vm: poetry
69+
.PHONY: test-rest-vm
70+
test-rest-vm:
7671
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_rest_vm"
7772

78-
test-bchain: poetry
73+
.PHONY: test-bchain
74+
test-bchain:
7975
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_bchain"
8076

81-
test-rest-bchain: poetry
77+
.PHONY: test-rest-bchain
78+
test-rest-bchain:
8279
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_rest_bchain"
8380

8481

8582
# Proof Tests
8683

8784
test-prove: test-prove-rules test-prove-functional test-prove-optimizations test-prove-dss
8885

89-
test-prove-rules: poetry
86+
.PHONY: test-prove-rules
87+
test-prove-rules:
9088
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_prove_rules"
9189

92-
test-prove-functional: poetry
90+
.PHONY: test-prove-functional
91+
test-prove-functional:
9392
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_prove_functional"
9493

95-
test-prove-optimizations: poetry
94+
.PHONY: test-prove-optimizations
95+
test-prove-optimizations:
9696
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_prove_optimizations"
9797

98-
test-prove-summaries: poetry
98+
.PHONY: test-prove-summaries
99+
test-prove-summaries:
99100
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_prove_summaries"
100101

101-
test-prove-dss: poetry
102+
.PHONY: test-prove-dss
103+
test-prove-dss:
102104
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+="-k test_prove_dss"
103105

104106

105107
# Integration Tests
106108

107-
test-integration: poetry
108-
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+='-k "(test_kast.py or test_run.py or test_solc_to_k.py)"'
109+
.PHONY: test-integration
110+
test-integration:
111+
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+='-k "(test_kast.py or test_run.py)"'
109112

110-
profile: poetry
113+
.PHONY: profile
114+
profile:
111115
$(MAKE) -C kevm-pyk/ profile
112116
find /tmp/pytest-of-$$(whoami)/pytest-current/ -type f -name '*.prof' | sort | xargs tail -n +1
113117

114-
test-summarize: poetry
118+
.PHONY: test-summarize
119+
test-summarize:
115120
$(MAKE) -C kevm-pyk/ test-integration PYTEST_ARGS+='-k "test_summarize"'
116121

117122

@@ -126,31 +131,13 @@ KPROVE_EXT = k
126131
KEVM_OPTS ?=
127132
KPROVE_OPTS ?=
128133

129-
130-
tests/specs/examples/%-bin-runtime.k: KEVM_OPTS += --verbose
131-
132-
tests/specs/examples/erc20-spec/haskell/timestamp: tests/specs/examples/erc20-bin-runtime.k
133-
tests/specs/examples/erc20-bin-runtime.k: tests/specs/examples/ERC20.sol $(KEVM_LIB)/$(haskell_kompiled) poetry
134-
$(KEVM) solc-to-k $< ERC20 $(KEVM_OPTS) --verbose --definition $(KEVM_LIB)/$(haskell_dir) --main-module ERC20-VERIFICATION > $@
135-
136-
tests/specs/examples/erc721-spec/haskell/timestamp: tests/specs/examples/erc721-bin-runtime.k
137-
tests/specs/examples/erc721-bin-runtime.k: tests/specs/examples/ERC721.sol $(KEVM_LIB)/$(haskell_kompiled) poetry
138-
$(KEVM) solc-to-k $< ERC721 $(KEVM_OPTS) --verbose --definition $(KEVM_LIB)/$(haskell_dir) --main-module ERC721-VERIFICATION > $@
139-
140-
tests/specs/examples/storage-spec/haskell/timestamp: tests/specs/examples/storage-bin-runtime.k
141-
tests/specs/examples/storage-bin-runtime.k: tests/specs/examples/Storage.sol $(KEVM_LIB)/$(haskell_kompiled) poetry
142-
$(KEVM) solc-to-k $< Storage $(KEVM_OPTS) --verbose --definition $(KEVM_LIB)/$(haskell_dir) --main-module STORAGE-VERIFICATION > $@
143-
144-
tests/specs/examples/empty-bin-runtime.k: tests/specs/examples/Empty.sol $(KEVM_LIB)/$(haskell_kompiled) poetry
145-
$(KEVM) solc-to-k $< Empty $(KEVM_OPTS) --verbose --definition $(KEVM_LIB)/$(haskell_dir) --main-module EMPTY-VERIFICATION > $@
146-
147134
.SECONDEXPANSION:
148135
tests/specs/%.prove: tests/specs/% tests/specs/$$(firstword $$(subst /, ,$$*))/$$(KPROVE_FILE)/$(TEST_SYMBOLIC_BACKEND)/timestamp
149-
$(POETRY_RUN) kevm-pyk prove $< $(KEVM_OPTS) $(KPROVE_OPTS) \
136+
$(UV_RUN) kevm-pyk prove $< $(KEVM_OPTS) $(KPROVE_OPTS) \
150137
--definition tests/specs/$(firstword $(subst /, ,$*))/$(KPROVE_FILE)/$(TEST_SYMBOLIC_BACKEND)
151138

152139
tests/specs/%/timestamp: tests/specs/$$(firstword $$(subst /, ,$$*))/$$(KPROVE_FILE).$$(KPROVE_EXT)
153-
$(POETRY_RUN) kevm-pyk kompile-spec \
140+
$(UV_RUN) kevm-pyk kompile-spec \
154141
$< \
155142
--target $(word 3, $(subst /, , $*)) \
156143
--output-definition tests/specs/$(firstword $(subst /, ,$*))/$(KPROVE_FILE)/$(word 3, $(subst /, , $*)) \
@@ -181,9 +168,9 @@ tests/ethereum-tests/BlockchainTests/GeneralStateTests/VMTests/%: KEVM_MODE
181168
tests/ethereum-tests/BlockchainTests/GeneralStateTests/VMTests/%: KEVM_SCHEDULE = DEFAULT
182169

183170
tests/%.run-interactive: tests/%
184-
$(POETRY_RUN) kevm-pyk run $< $(KEVM_OPTS) $(KRUN_OPTS) --target $(TEST_CONCRETE_BACKEND) \
185-
--mode $(KEVM_MODE) --schedule $(KEVM_SCHEDULE) --chainid $(KEVM_CHAINID) \
186-
> tests/$*.$(TEST_CONCRETE_BACKEND)-out \
171+
$(UV_RUN) kevm-pyk run $< $(KEVM_OPTS) $(KRUN_OPTS) --target $(TEST_CONCRETE_BACKEND) \
172+
--mode $(KEVM_MODE) --schedule $(KEVM_SCHEDULE) --chainid $(KEVM_CHAINID) \
173+
> tests/$*.$(TEST_CONCRETE_BACKEND)-out \
187174
|| $(CHECK) tests/$*.$(TEST_CONCRETE_BACKEND)-out tests/templates/output-success-$(TEST_CONCRETE_BACKEND).json
188175
$(KEEP_OUTPUTS) || rm -rf tests/$*.$(TEST_CONCRETE_BACKEND)-out
189176

0 commit comments

Comments
 (0)