Skip to content

Commit

Permalink
Add pypy test runs to eels backend tests:
Browse files Browse the repository at this point in the history
- Add pypy py-evm CI jobs; refactor testenvs in ``tox.ini``.
  • Loading branch information
fselmo committed Sep 24, 2024
1 parent dd50c7b commit f3e4f80
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 10 deletions.
96 changes: 90 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ parameters:
type: string

common: &common
parameters:
python_exec:
type: string
default: "python"
working_directory: ~/repo
steps:
- checkout
Expand All @@ -28,6 +32,38 @@ common: &common
- restore_cache:
keys:
- cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
- run:
name: install pypy3 if python_exec is pypy3
command: |
if [ "<< parameters.python_exec >>" == "pypy3" ]; then
sudo apt-get update
# If .pyenv already exists, remove and reinstall to get latest version
if [ -d "$HOME/.pyenv" ]; then
echo "Removing existing .pyenv directory..."
rm -rf $HOME/.pyenv
fi
curl https://pyenv.run | bash
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
# Find the latest PyPy version matching the python minor version
latest_pypy_version=$(pyenv install --list | grep -E "pypy3\.<< parameters.python_minor_version >>" | grep -v "\-src" | tail -1 | tr -d ' ')
echo "Latest PyPy version: $latest_pypy_version"
# Install the latest PyPy 3.10 version using pyenv if not already installed
pyenv install "$latest_pypy_version"
pyenv global "$latest_pypy_version"
# Verify the correct PyPy version is being used
pypy3 --version
# Install pip using the newly installed PyPy version
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
pypy3 get-pip.py
fi
- run:
name: install dependencies
command: |
Expand All @@ -36,7 +72,7 @@ common: &common
python web3/scripts/install_pre_releases.py
- run:
name: run tox
command: python -m tox run -r
command: << parameters.python_exec >> -m tox -r
- save_cache:
paths:
- .hypothesis
Expand Down Expand Up @@ -145,12 +181,30 @@ jobs:
type: string
tox_env:
type: string
python_exec:
type: string
default: "python"
<<: *common
docker:
- image: cimg/python:3.<< parameters.python_minor_version >>
environment:
TOXENV: py3<< parameters.python_minor_version >>-<< parameters.tox_env >>

common-pypy:
parameters:
python_minor_version:
type: string
tox_env:
type: string
python_exec:
type: string
default: "pypy3"
<<: *common
docker:
- image: cimg/python:3.<< parameters.python_minor_version >>
environment:
TOXENV: pypy3<< parameters.python_minor_version >>-<< parameters.tox_env >>

geth:
parameters:
python_minor_version:
Expand Down Expand Up @@ -228,13 +282,44 @@ workflows:
python_minor_version: ["8", "9", "10", "11", "12"]
tox_env: [
"lint",
"core",
"core_async",
"ens",
"core-pyevm",
"core-pyevm_async",
"ens-pyevm",
"ensip15",
"wheel"
]
python_exec: "python"
name: "py3<< matrix.python_minor_version >>-<< matrix.tox_env >>"
- common:
matrix:
parameters:
# eels only supports 3.10 and above
python_minor_version: ["10", "11", "12"]
tox_env: [
"core-eels",
"core-eels_async",
"ens-eels",
"integration-ethtester-eels"
]
python_exec: "python"
name: "py3<< matrix.python_minor_version >>-<< matrix.tox_env >>"
- common-pypy:
matrix:
parameters:
# eels only supports 3.10 and above; pyenv only has pypy3.10 available
python_minor_version: ["10"]
tox_env: [
"core-eels",
"core-eels_async",
"ens-eels",
"integration-ethtester-eels",
"core-pyevm",
"core-pyevm_async",
"ens-pyevm",
"integration-ethtester-pyevm"
]
python_exec: "pypy3"
name: "pypy3<< matrix.python_minor_version >>-<< matrix.tox_env >>"
- geth:
matrix:
parameters:
Expand All @@ -246,7 +331,7 @@ workflows:
"integration-goethereum-http_async",
"integration-goethereum-legacy_ws",
"integration-goethereum-ws",
"integration-ethtester"
"integration-ethtester-pyevm"
]
name: "py3<< matrix.python_minor_version >>-<< matrix.tox_env >>"
- docs:
Expand All @@ -260,7 +345,6 @@ workflows:
python_minor_version: ["10", "11", "12"]
name: "py3<< matrix.python_minor_version >>-windows-wheel"


nightly:
triggers:
- schedule:
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"towncrier>=21,<22",
],
"test": [
# Note: ethereum-maintained libraries in this list should be added to the
# `install_pre_releases.py` script.
"eth-tester[py-evm]>=0.11.0b1,<0.13.0b1",
"py-geth>=5.0.0",
"pytest-asyncio>=0.18.1,<0.23",
"pytest-mock>=1.10",
"pytest-xdist>=2.4.0",
Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[tox]
envlist=
py{38,39,310,311,312}-{ens,core,lint,wheel}-pyevm
py{310,311,312}-{ens,core}-eels
py{38,39,310,311,312}-integration-{goethereum,ethtester}
py{py}{38,39,310,311,312}-{ens,core}-pyevm
py{py}{310,311,312}-{ens,core}-eels
py{38,39,310,311,312}-integration-{goethereum,ethtester-pyevm}
py{310,311,312}-integration-ethtester-eels
py{38,39,310,311,312}-{lint,wheel}
docs
benchmark
windows-wheel
Expand Down
5 changes: 4 additions & 1 deletion web3/_utils/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
def _validate_init_params_and_return_if_found(module_class: Any) -> List[str]:
init_params_raw = list(inspect.signature(module_class.__init__).parameters)
module_init_params = [
param for param in init_params_raw if param not in ["self", "args", "kwargs"]
param
for param in init_params_raw
# pypy uses `obj` and `keywords` instead of `self` and `kwargs`, respectively
if param not in ["self", "obj", "args", "kwargs", "keywords"]
]

if len(module_init_params) > 1:
Expand Down

0 comments on commit f3e4f80

Please sign in to comment.