Skip to content

Commit be20006

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

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
@@ -145,12 +181,30 @@ jobs:
145181
type: string
146182
tox_env:
147183
type: string
184+
python_exec:
185+
type: string
186+
default: "python"
148187
<<: *common
149188
docker:
150189
- image: cimg/python:3.<< parameters.python_minor_version >>
151190
environment:
152191
TOXENV: py3<< parameters.python_minor_version >>-<< parameters.tox_env >>
153192

193+
common-pypy:
194+
parameters:
195+
python_minor_version:
196+
type: string
197+
tox_env:
198+
type: string
199+
python_exec:
200+
type: string
201+
default: "pypy3"
202+
<<: *common
203+
docker:
204+
- image: cimg/python:3.<< parameters.python_minor_version >>
205+
environment:
206+
TOXENV: pypy3<< parameters.python_minor_version >>-<< parameters.tox_env >>
207+
154208
geth:
155209
parameters:
156210
python_minor_version:
@@ -228,13 +282,44 @@ workflows:
228282
python_minor_version: ["8", "9", "10", "11", "12", "13"]
229283
tox_env: [
230284
"lint",
231-
"core",
232-
"core_async",
233-
"ens",
285+
"core-pyevm",
286+
"core-pyevm_async",
287+
"ens-pyevm",
234288
"ensip15",
235289
"wheel"
236290
]
291+
python_exec: "python"
237292
name: "py3<< matrix.python_minor_version >>-<< matrix.tox_env >>"
293+
- common:
294+
matrix:
295+
parameters:
296+
# eels only supports 3.10 and above
297+
python_minor_version: ["10", "11", "12"]
298+
tox_env: [
299+
"core-eels",
300+
"core-eels_async",
301+
"ens-eels",
302+
"integration-ethtester-eels"
303+
]
304+
python_exec: "python"
305+
name: "py3<< matrix.python_minor_version >>-<< matrix.tox_env >>"
306+
- common-pypy:
307+
matrix:
308+
parameters:
309+
# eels only supports 3.10 and above; pyenv only has pypy3.10 available
310+
python_minor_version: ["10"]
311+
tox_env: [
312+
"core-eels",
313+
"core-eels_async",
314+
"ens-eels",
315+
"integration-ethtester-eels",
316+
"core-pyevm",
317+
"core-pyevm_async",
318+
"ens-pyevm",
319+
"integration-ethtester-pyevm"
320+
]
321+
python_exec: "pypy3"
322+
name: "pypy3<< matrix.python_minor_version >>-<< matrix.tox_env >>"
238323
- geth:
239324
matrix:
240325
parameters:
@@ -246,7 +331,7 @@ workflows:
246331
"integration-goethereum-http_async",
247332
"integration-goethereum-legacy_ws",
248333
"integration-goethereum-ws",
249-
"integration-ethtester"
334+
"integration-ethtester-pyevm"
250335
]
251336
name: "py3<< matrix.python_minor_version >>-<< matrix.tox_env >>"
252337
- docs:
@@ -260,7 +345,6 @@ workflows:
260345
python_minor_version: ["10", "11", "12", "13"]
261346
name: "py3<< matrix.python_minor_version >>-windows-wheel"
262347

263-
264348
nightly:
265349
triggers:
266350
- 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)