Skip to content

Commit 17a491b

Browse files
committed
Add pypy test runs to eels backend tests:
- Add pypy py-evm CI jobs; refactor testenvs in ``tox.ini``.
1 parent 8555a5a commit 17a491b

File tree

3 files changed

+98
-10
lines changed

3 files changed

+98
-10
lines changed

Diff for: .circleci/config.yml

+90-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ parameters:
1111
type: string
1212

1313
common: &common
14+
parameters:
15+
python_exec:
16+
type: string
17+
default: "python"
1418
working_directory: ~/repo
1519
steps:
1620
- checkout
@@ -28,6 +32,38 @@ common: &common
2832
- restore_cache:
2933
keys:
3034
- cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
35+
- run:
36+
name: install pypy3 if python_exec is pypy3
37+
command: |
38+
if [ "<< parameters.python_exec >>" == "pypy3" ]; then
39+
sudo apt-get update
40+
41+
# If .pyenv already exists, remove and reinstall to get latest version
42+
if [ -d "$HOME/.pyenv" ]; then
43+
echo "Removing existing .pyenv directory..."
44+
rm -rf $HOME/.pyenv
45+
fi
46+
curl https://pyenv.run | bash
47+
export PATH="$HOME/.pyenv/bin:$PATH"
48+
eval "$(pyenv init --path)"
49+
eval "$(pyenv init -)"
50+
eval "$(pyenv virtualenv-init -)"
51+
52+
# Find the latest PyPy version matching the python minor version
53+
latest_pypy_version=$(pyenv install --list | grep -E "pypy3\.<< parameters.python_minor_version >>" | grep -v "\-src" | tail -1 | tr -d ' ')
54+
echo "Latest PyPy version: $latest_pypy_version"
55+
56+
# Install the latest PyPy 3.10 version using pyenv if not already installed
57+
pyenv install "$latest_pypy_version"
58+
pyenv global "$latest_pypy_version"
59+
60+
# Verify the correct PyPy version is being used
61+
pypy3 --version
62+
63+
# Install pip using the newly installed PyPy version
64+
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
65+
pypy3 get-pip.py
66+
fi
3167
- run:
3268
name: install dependencies
3369
command: |
@@ -36,7 +72,7 @@ common: &common
3672
python web3/scripts/install_pre_releases.py
3773
- run:
3874
name: run tox
39-
command: python -m tox run -r
75+
command: << parameters.python_exec >> -m tox -r
4076
- save_cache:
4177
paths:
4278
- .hypothesis
@@ -141,12 +177,30 @@ jobs:
141177
type: string
142178
tox_env:
143179
type: string
180+
python_exec:
181+
type: string
182+
default: "python"
144183
<<: *common
145184
docker:
146185
- image: cimg/python:3.<< parameters.python_minor_version >>
147186
environment:
148187
TOXENV: py3<< parameters.python_minor_version >>-<< parameters.tox_env >>
149188

189+
common-pypy:
190+
parameters:
191+
python_minor_version:
192+
type: string
193+
tox_env:
194+
type: string
195+
python_exec:
196+
type: string
197+
default: "pypy3"
198+
<<: *common
199+
docker:
200+
- image: cimg/python:3.<< parameters.python_minor_version >>
201+
environment:
202+
TOXENV: pypy3<< parameters.python_minor_version >>-<< parameters.tox_env >>
203+
150204
geth:
151205
parameters:
152206
python_minor_version:
@@ -224,13 +278,44 @@ workflows:
224278
python_minor_version: ["8", "9", "10", "11", "12", "13"]
225279
tox_env: [
226280
"lint",
227-
"core",
228-
"core_async",
229-
"ens",
281+
"core-pyevm",
282+
"core-pyevm_async",
283+
"ens-pyevm",
230284
"ensip15",
231285
"wheel"
232286
]
287+
python_exec: "python"
233288
name: "py3<< matrix.python_minor_version >>-<< matrix.tox_env >>"
289+
- common:
290+
matrix:
291+
parameters:
292+
# eels only supports 3.10 and above
293+
python_minor_version: ["10", "11", "12"]
294+
tox_env: [
295+
"core-eels",
296+
"core-eels_async",
297+
"ens-eels",
298+
"integration-ethtester-eels"
299+
]
300+
python_exec: "python"
301+
name: "py3<< matrix.python_minor_version >>-<< matrix.tox_env >>"
302+
- common-pypy:
303+
matrix:
304+
parameters:
305+
# eels only supports 3.10 and above; pyenv only has pypy3.10 available
306+
python_minor_version: ["10"]
307+
tox_env: [
308+
"core-eels",
309+
"core-eels_async",
310+
"ens-eels",
311+
"integration-ethtester-eels",
312+
"core-pyevm",
313+
"core-pyevm_async",
314+
"ens-pyevm",
315+
"integration-ethtester-pyevm"
316+
]
317+
python_exec: "pypy3"
318+
name: "pypy3<< matrix.python_minor_version >>-<< matrix.tox_env >>"
234319
- geth:
235320
matrix:
236321
parameters:
@@ -242,7 +327,7 @@ workflows:
242327
"integration-goethereum-http_async",
243328
"integration-goethereum-legacy_ws",
244329
"integration-goethereum-ws",
245-
"integration-ethtester"
330+
"integration-ethtester-pyevm"
246331
]
247332
name: "py3<< matrix.python_minor_version >>-<< matrix.tox_env >>"
248333
- docs:
@@ -256,7 +341,6 @@ workflows:
256341
python_minor_version: ["10", "11", "12", "13"]
257342
name: "py3<< matrix.python_minor_version >>-windows-wheel"
258343

259-
260344
nightly:
261345
triggers:
262346
- schedule:

Diff for: tox.ini

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
[tox]
22
envlist=
3-
py{38,39,310,311,312,313}-{ens,core,lint,wheel}-pyevm
4-
py{310,311,312, 313}-{ens,core}-eels
5-
py{38,39,310,311,312,313}-integration-{goethereum,ethtester}
3+
py{py}{38,39,310,311,312,313}-{ens,core}-pyevm
4+
py{py}{310,311,312,313}-{ens,core}-eels
5+
py{38,39,310,311,312,313}-integration-{goethereum,ethtester-pyevm}
66
py{310,311,312,313}-integration-ethtester-eels
7+
py{38,39,310,311,312,313}-{lint,wheel}
78
docs
89
benchmark
910
windows-wheel

Diff for: web3/_utils/module.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
def _validate_init_params_and_return_if_found(module_class: Any) -> List[str]:
2828
init_params_raw = list(inspect.signature(module_class.__init__).parameters)
2929
module_init_params = [
30-
param for param in init_params_raw if param not in ["self", "args", "kwargs"]
30+
param
31+
for param in init_params_raw
32+
# pypy uses `obj` and `keywords` instead of `self` and `kwargs`, respectively
33+
if param not in ["self", "obj", "args", "kwargs", "keywords"]
3134
]
3235

3336
if len(module_init_params) > 1:

0 commit comments

Comments
 (0)